diff options
Diffstat (limited to 'src/btree/bt_walk.c')
-rw-r--r-- | src/btree/bt_walk.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/btree/bt_walk.c b/src/btree/bt_walk.c index 4b0b4484c6f..d783f8f6e71 100644 --- a/src/btree/bt_walk.c +++ b/src/btree/bt_walk.c @@ -18,7 +18,7 @@ __ref_index_slot(WT_SESSION_IMPL *session, { WT_PAGE_INDEX *pindex; WT_REF **start, **stop, **p, **t; - uint64_t yield_count; + uint64_t sleep_count, yield_count; uint32_t entries, slot; /* @@ -27,7 +27,7 @@ __ref_index_slot(WT_SESSION_IMPL *session, * split, their WT_REF structure home values are updated; yield * and wait for that to happen. */ - for (yield_count = 0;; yield_count++, __wt_yield()) { + for (sleep_count = yield_count = 0;;) { /* * Copy the parent page's index value: the page can split at * any time, but the index's value is always valid, even if @@ -65,14 +65,19 @@ __ref_index_slot(WT_SESSION_IMPL *session, goto found; } } - + /* + * We failed to get the page index and slot reference, yield + * before retrying, and if we've yielded enough times, start + * sleeping so we don't burn CPU to no purpose. + */ + __wt_ref_state_yield_sleep(&yield_count, &sleep_count); + WT_STAT_CONN_INCRV(session, page_index_slot_ref_blocked, + sleep_count); } found: WT_ASSERT(session, pindex->index[slot] == ref); *pindexp = pindex; *slotp = slot; - - WT_STAT_CONN_INCRV(session, page_index_slot_blocked, yield_count); } /* |