diff options
author | nehakhatri5 <30581300+nehakhatri5@users.noreply.github.com> | 2017-11-10 12:10:56 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2017-11-10 12:10:56 +1100 |
commit | 752120f592b40afc10eac4e6ca0951681cfcb132 (patch) | |
tree | 5dca8da4757dc70a0af3e8c12f5fd91fda5cb706 | |
parent | d51a7e3731c5650a85d1570a2b797d7c388ab195 (diff) | |
download | mongo-752120f592b40afc10eac4e6ca0951681cfcb132.tar.gz |
WT-3710 Get page-level lock to ensure single threaded page-split (#3784)
When a page split is in progress it is possible to get another split on this page through its child in another thread. Acquire a page lock on the page undergoing the split to prevent concurrent split on same page.
-rw-r--r-- | src/btree/bt_split.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index dc699a6b23b..91b53dcba96 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -345,6 +345,9 @@ __split_ref_prepare( * ascend into the created children, but eventually fail as that parent * page won't yet know about the created children pages. That's OK, we * spin there until the parent's page index is updated. + * + * Lock the newly created page to ensure it doesn't split until all + * child pages have been updated. */ for (i = skip_first ? 1 : 0; i < pindex->entries; ++i) { ref = pindex->index[i]; @@ -352,10 +355,12 @@ __split_ref_prepare( /* Switch the WT_REF's to their new page. */ j = 0; + WT_PAGE_LOCK(session, child); WT_INTL_FOREACH_BEGIN(session, child, child_ref) { child_ref->home = child; child_ref->pindex_hint = j++; } WT_INTL_FOREACH_END; + WT_PAGE_UNLOCK(session, child); #ifdef HAVE_DIAGNOSTIC WT_WITH_PAGE_INDEX(session, |