diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2016-11-15 12:12:22 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-15 12:12:22 +1100 |
commit | 46d66e2840cf6950d3bd012206a0cbc8c3ba4be8 (patch) | |
tree | f7cd7c67c3f3ff2e43e1d50b8530ded668c622ea | |
parent | adfd8056806c640a8d8aaba8766d07dd5fc79569 (diff) | |
download | mongo-46d66e2840cf6950d3bd012206a0cbc8c3ba4be8.tar.gz |
WT-3020 Always make LSM chunks evictable when they are switched out. (#3147)
-rw-r--r-- | src/include/btree.i | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/include/btree.i b/src/include/btree.i index 9c8ec1dbdea..8f44bc4eddd 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -1562,7 +1562,7 @@ __wt_btree_lsm_switch_primary(WT_SESSION_IMPL *session, bool on) cache = S2C(session)->cache; root = btree->root.page; - if (on && !F_ISSET(btree, WT_BTREE_LSM_PRIMARY)) + if (!F_ISSET(btree, WT_BTREE_LSM_PRIMARY)) F_SET(btree, WT_BTREE_LSM_PRIMARY | WT_BTREE_NO_EVICTION); if (!on && F_ISSET(btree, WT_BTREE_LSM_PRIMARY)) { pindex = WT_INTL_INDEX_GET_SAFE(root); @@ -1575,21 +1575,19 @@ __wt_btree_lsm_switch_primary(WT_SESSION_IMPL *session, bool on) * We're reaching down into the page without a hazard pointer, * but that's OK because we know that no-eviction is set so the * page can't disappear. - */ - child = first->page; - if (first->state != WT_REF_MEM || - child->type != WT_PAGE_ROW_LEAF || - !__wt_page_is_modified(child)) - return; - - /* + * * While this tree was the primary, its dirty bytes were not * included in the cache accounting. Fix that now before we * open it up for eviction. */ - size = child->modify->bytes_dirty; - (void)__wt_atomic_add64(&btree->bytes_dirty_leaf, size); - (void)__wt_atomic_add64(&cache->bytes_dirty_leaf, size); + child = first->page; + if (first->state == WT_REF_MEM && + child->type == WT_PAGE_ROW_LEAF && + __wt_page_is_modified(child)) { + size = child->modify->bytes_dirty; + (void)__wt_atomic_add64(&btree->bytes_dirty_leaf, size); + (void)__wt_atomic_add64(&cache->bytes_dirty_leaf, size); + } F_CLR(btree, WT_BTREE_LSM_PRIMARY | WT_BTREE_NO_EVICTION); } |