summaryrefslogtreecommitdiff
path: root/src/btree/bt_split.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-10-30 22:18:27 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2015-11-24 05:05:46 +0000
commit7b1398a1a6ee6bd4e0624c38c5311e896a42cbfc (patch)
tree36e6c275513a99a0c3701f6f0f16d4c90dab04aa /src/btree/bt_split.c
parent155ad1a5f86affdd9bdba17787c7bb801308a2ca (diff)
downloadmongo-7b1398a1a6ee6bd4e0624c38c5311e896a42cbfc.tar.gz
Merge pull request #2278 from wiredtiger/SERVER-21027-fix
SERVER-21027 Don't leave empty internal pages in the tree (cherry picked from commit ba931c1)
Diffstat (limited to 'src/btree/bt_split.c')
-rw-r--r--src/btree/bt_split.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c
index 82a4dac226f..d2861e5237e 100644
--- a/src/btree/bt_split.c
+++ b/src/btree/bt_split.c
@@ -960,17 +960,11 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
result_entries = (parent_entries + new_entries) - deleted_entries;
/*
- * If the entire (sub)tree is empty, leave the first ref in place,
- * deleted.
+ * If the entire (sub)tree is empty, give up: we can't leave an empty
+ * internal page.
*/
- if (result_entries == 0) {
- next_ref = pindex->index[0];
- WT_ASSERT(session, next_ref->state == WT_REF_SPLIT ||
- (next_ref == ref && ref->state == WT_REF_LOCKED));
- next_ref->state = WT_REF_DELETED;
- --deleted_entries;
- result_entries = 1;
- }
+ if (result_entries == 0)
+ return (0);
/*
* Allocate and initialize a new page index array for the parent, then
@@ -1016,6 +1010,9 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
*alloc_refp++ = next_ref;
}
+ /* Check that we filled in all the entries. */
+ WT_ASSERT(session, alloc_refp - alloc_index->index == result_entries);
+
/*
* Update the parent page's index: this update makes the split visible
* to threads descending the tree.