summaryrefslogtreecommitdiff
path: root/src/btree/bt_read.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-08-25 16:38:11 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-08-25 16:38:11 +1000
commite792859174eca5e6e427bfa50dc1f92125ad8bb1 (patch)
tree73adc33464f11907e0dbbf5cd6e788fa75d38cd4 /src/btree/bt_read.c
parentc2af7abe72db5786b5d511bed997eaa0e745b0af (diff)
downloadmongo-e792859174eca5e6e427bfa50dc1f92125ad8bb1.tar.gz
WT-2853 Don't force eviction if multiple cursors are pinning the page. (#2974)
In some patterns of index lookups, we don't want the second cursor in a session to attempt forced eviction: it will just stall itself to no purpose. Expand test case added testutil_assert for failure condition and reduced test run length. Also cosmetic changes: remove unneeded vars, var declaration reordering, var renaming.
Diffstat (limited to 'src/btree/bt_read.c')
-rw-r--r--src/btree/bt_read.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c
index c1485d26192..fd9c371f8c3 100644
--- a/src/btree/bt_read.c
+++ b/src/btree/bt_read.c
@@ -319,7 +319,15 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref)
/* Pages are usually small enough, check that first. */
if (page->memory_footprint < btree->splitmempage)
return (false);
- else if (page->memory_footprint < btree->maxmempage)
+
+ /*
+ * If this session has more than one hazard pointer, eviction will fail
+ * and there is no point trying.
+ */
+ if (__wt_hazard_count(session, page) > 1)
+ return (false);
+
+ if (page->memory_footprint < btree->maxmempage)
return (__wt_leaf_page_can_split(session, page));
/* Trigger eviction on the next page release. */