diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-27 21:59:40 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-27 21:59:40 +1100 |
commit | 6c65c86bb9da9925c007ea469ac7cd30e175bbd7 (patch) | |
tree | cc746df946f8eba3cacf4e7cc9aaeac91acd2423 /src | |
parent | 4aa7ba0d855136af6ff0dbef7f5716604b702af7 (diff) | |
download | mongo-6c65c86bb9da9925c007ea469ac7cd30e175bbd7.tar.gz |
WT-2244 Don't wait for transactions after splits.
Now that we split before pages become completely full, and we can block splits
outright with a flag, don't use transaction visibilty to block subsequent
splits. This had the effect of limiting each page to a single split during
long-running transactions including checkpoints.
Diffstat (limited to 'src')
-rw-r--r-- | src/btree/bt_read.c | 2 | ||||
-rw-r--r-- | src/btree/bt_split.c | 18 | ||||
-rw-r--r-- | src/evict/evict_file.c | 2 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 2 | ||||
-rw-r--r-- | src/evict/evict_page.c | 2 | ||||
-rw-r--r-- | src/include/btmem.h | 12 | ||||
-rw-r--r-- | src/include/btree.i | 25 |
7 files changed, 8 insertions, 55 deletions
diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index bea6c9cedec..12caf433fd0 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -331,7 +331,7 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref) __wt_txn_update_oldest(session, false); /* If eviction cannot succeed, don't try. */ - return (__wt_page_can_evict(session, ref, true, NULL)); + return (__wt_page_can_evict(session, ref, NULL)); } /* diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index 3e49d177ca6..d7987f79d41 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -409,18 +409,9 @@ __split_ref_move_final( WT_DECL_RET; WT_PAGE *child; WT_REF *ref, *child_ref; - uint64_t txn_new_id; uint32_t i; /* - * When creating new internal pages as part of a split, we set a field - * in those pages modify structure to prevent them from being evicted - * until all threads are known to have exited the index of the page that - * previously "owned" the WT_REF. Set that field to a safe value. - */ - txn_new_id = __wt_txn_id_alloc(session, false); - - /* * The WT_REF structures moved to newly allocated child pages reference * the wrong parent page and we have to fix that up. The problem is * revealed when a thread of control searches for the child page's @@ -471,8 +462,6 @@ __split_ref_move_final( if (child_ref->home != child) { child_ref->home = child; child_ref->pindex_hint = 0; - - child->modify->mod_split_txn = txn_new_id; } } WT_INTL_FOREACH_END; WT_LEAVE_PAGE_INDEX(session); @@ -1828,13 +1817,6 @@ __split_insert(WT_SESSION_IMPL *session, WT_REF *ref) #endif /* - * Save the transaction ID when the split happened. Application - * threads will not try to forcibly evict the page again until - * all concurrent transactions commit. - */ - page->modify->inmem_split_txn = __wt_txn_id_alloc(session, false); - - /* * Update the page accounting. * * XXX diff --git a/src/evict/evict_file.c b/src/evict/evict_file.c index 9937390d19a..2b2117ad9fd 100644 --- a/src/evict/evict_file.c +++ b/src/evict/evict_file.c @@ -84,7 +84,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop) */ WT_ASSERT(session, F_ISSET(session->dhandle, WT_DHANDLE_DEAD) || - __wt_page_can_evict(session, ref, false, NULL)); + __wt_page_can_evict(session, ref, NULL)); __wt_evict_page_clean_update(session, ref, true); break; WT_ILLEGAL_VALUE_ERR(session); diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index d7e34e95850..306362de57f 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -1254,7 +1254,7 @@ __evict_walk_file(WT_SESSION_IMPL *session, u_int *slotp) page->read_gen = __wt_cache_read_gen_new(session); fast: /* If the page can't be evicted, give up. */ - if (!__wt_page_can_evict(session, ref, true, &would_split)) + if (!__wt_page_can_evict(session, ref, &would_split)) continue; /* diff --git a/src/evict/evict_page.c b/src/evict/evict_page.c index f0d97c7f2c8..26ea9117fae 100644 --- a/src/evict/evict_page.c +++ b/src/evict/evict_page.c @@ -434,7 +434,7 @@ __evict_review( if (modified) __wt_txn_update_oldest(session, true); - if (!__wt_page_can_evict(session, ref, false, inmem_splitp)) + if (!__wt_page_can_evict(session, ref, inmem_splitp)) return (EBUSY); /* diff --git a/src/include/btmem.h b/src/include/btmem.h index b6c16f36ce5..6ee74c61a38 100644 --- a/src/include/btmem.h +++ b/src/include/btmem.h @@ -201,9 +201,6 @@ struct __wt_page_modify { /* The first unwritten transaction ID (approximate). */ uint64_t first_dirty_txn; - /* In-memory split transaction ID. */ - uint64_t inmem_split_txn; - /* Avoid checking for obsolete updates during checkpoints. */ uint64_t obsolete_check_txn; @@ -303,17 +300,8 @@ struct __wt_page_modify { * so they can be discarded when no longer needed. */ WT_PAGE *root_split; /* Linked list of root split pages */ - - /* - * When we deepen the tree, newly created internal pages cannot - * be evicted until all threads have exited the original page - * index structure. We set a transaction value during the split - * that's checked during eviction. - */ - uint64_t split_txn; /* Split eviction transaction value */ } intl; #define mod_root_split u2.intl.root_split -#define mod_split_txn u2.intl.split_txn struct { /* * Appended items to column-stores: there is only a single one diff --git a/src/include/btree.i b/src/include/btree.i index 2d2b4e521c5..2e8de5d5535 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -1041,13 +1041,11 @@ __wt_page_can_split(WT_SESSION_IMPL *session, WT_PAGE *page) * Check whether a page can be evicted. */ static inline bool -__wt_page_can_evict(WT_SESSION_IMPL *session, - WT_REF *ref, bool check_splits, bool *inmem_splitp) +__wt_page_can_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool *inmem_splitp) { WT_BTREE *btree; WT_PAGE *page; WT_PAGE_MODIFY *mod; - WT_TXN_GLOBAL *txn_global; if (inmem_splitp != NULL) *inmem_splitp = false; @@ -1104,25 +1102,10 @@ __wt_page_can_evict(WT_SESSION_IMPL *session, * a transaction value, we can evict the created page as soon as that * transaction value is globally visible. */ - if (check_splits && WT_PAGE_IS_INTERNAL(page) && - (F_ISSET_ATOMIC(page, WT_PAGE_SPLIT_BLOCK) || - !__wt_txn_visible_all(session, mod->mod_split_txn))) + if (WT_PAGE_IS_INTERNAL(page) && + F_ISSET_ATOMIC(page, WT_PAGE_SPLIT_BLOCK)) return (false); - /* - * If the page was recently split in-memory, don't evict it immediately: - * we want to give application threads that are appending a chance to - * move to the new leaf page created by the split. - * - * Note the check here is similar to __wt_txn_visible_all, but ignores - * the checkpoint's transaction. - */ - if (check_splits) { - txn_global = &S2C(session)->txn_global; - if (WT_TXNID_LE(txn_global->oldest_id, mod->inmem_split_txn)) - return (false); - } - return (true); } @@ -1216,7 +1199,7 @@ __wt_page_release(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags) LF_ISSET(WT_READ_NO_EVICT) || F_ISSET(session, WT_SESSION_NO_EVICTION) || F_ISSET(btree, WT_BTREE_NO_EVICTION) || - !__wt_page_can_evict(session, ref, true, NULL)) + !__wt_page_can_evict(session, ref, NULL)) return (__wt_hazard_clear(session, page)); WT_RET_BUSY_OK(__wt_page_release_evict(session, ref)); |