summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/support/hazard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/support/hazard.c')
-rw-r--r--src/third_party/wiredtiger/src/support/hazard.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/src/support/hazard.c b/src/third_party/wiredtiger/src/support/hazard.c
index 815c876f444..eb65c00741c 100644
--- a/src/third_party/wiredtiger/src/support/hazard.c
+++ b/src/third_party/wiredtiger/src/support/hazard.c
@@ -67,7 +67,7 @@ hazard_grow(WT_SESSION_IMPL *session)
int
__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp
#ifdef HAVE_DIAGNOSTIC
- , const char *file, int line
+ , const char *func, int line
#endif
)
{
@@ -146,7 +146,7 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp
*/
hp->ref = ref;
#ifdef HAVE_DIAGNOSTIC
- hp->file = file;
+ hp->func = func;
hp->line = line;
#endif
/* Publish the hazard pointer before reading page's state. */
@@ -401,6 +401,29 @@ __wt_hazard_count(WT_SESSION_IMPL *session, WT_REF *ref)
#ifdef HAVE_DIAGNOSTIC
/*
+ * __wt_hazard_check_assert --
+ * Assert there's no hazard pointer to the page.
+ */
+bool
+__wt_hazard_check_assert(WT_SESSION_IMPL *session, void *ref, bool waitfor)
+{
+ WT_HAZARD *hp;
+ int i;
+
+ for (i = 0;;) {
+ if ((hp = __wt_hazard_check(session, ref)) == NULL)
+ return (true);
+ if (!waitfor || ++i > 100)
+ break;
+ __wt_sleep(0, 10000);
+ }
+ __wt_errx(session,
+ "hazard pointer reference to discarded object: (%p: %s, line %d)",
+ (void *)hp->ref, hp->func, hp->line);
+ return (false);
+}
+
+/*
* __hazard_dump --
* Display the list of hazard pointers.
*/
@@ -415,6 +438,6 @@ __hazard_dump(WT_SESSION_IMPL *session)
__wt_errx(session,
"session %p: hazard pointer %p: %s, line %d",
(void *)session,
- (void *)hp->ref, hp->file, hp->line);
+ (void *)hp->ref, hp->func, hp->line);
}
#endif