diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2017-04-08 00:58:05 +1000 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-04-08 05:28:07 +1000 |
commit | d3ed5e9585a33af75c1c32b65e234bbb97b393b4 (patch) | |
tree | 64a5c2345451fb3b04916455182f11b987f56270 | |
parent | 7a3e2484ec1ced43653cf33f4c68b0ebc8a0ee55 (diff) | |
download | mongo-d3ed5e9585a33af75c1c32b65e234bbb97b393b4.tar.gz |
WT-3265 Allow eviction of recently split pages when tree is locked. (#3372)
(cherry picked from commit: 84e6ac0e67019bba22af87b99b40bb0bc0e21157)
When pages split in WiredTiger, internal pages cannot be evicted
immediately because there is a chance that a reader is still looking at
an index pointing to the page. We check for this when considering pages
for eviction, and assert that we never evict an internal page in an
active generation.
However, if a page splits and then we try to get exclusive access to
the tree (e.g., to verify it), we could fail to evict the tree from
cache even though we have guaranteed exclusive access to it.
Relax the check on internal pages to allow eviction from trees that are
locked exclusive.
-rw-r--r-- | src/include/btree.i | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/include/btree.i b/src/include/btree.i index a4d88d5fda1..1d6fcd6272c 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -1354,8 +1354,13 @@ __wt_page_can_evict( * the original parent page's index, because evicting an internal page * discards its WT_REF array, and a thread traversing the original * parent page index might see a freed WT_REF. + * + * One special case where we know this is safe is if the handle is + * locked exclusive (e.g., when the whole tree is being evicted). In + * that case, no readers can be looking at an old index. */ - if (WT_PAGE_IS_INTERNAL(page) && !__wt_split_obsolete( + if (!F_ISSET(session->dhandle, WT_DHANDLE_EXCLUSIVE) && + WT_PAGE_IS_INTERNAL(page) && !__wt_split_obsolete( session, page->pg_intl_split_gen)) return (false); |