diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-10-30 16:00:59 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-10-30 16:00:59 +1100 |
commit | 6c4abfc641fc5dded5f938bd0208e75cb9877f74 (patch) | |
tree | 3eacf20b77380d8cded6b24e94ce28c309fdb54e /src | |
parent | 63e7e056393313634d35ab04cb69503923ec6ac0 (diff) | |
download | mongo-6c4abfc641fc5dded5f938bd0208e75cb9877f74.tar.gz |
SERVER-21027 Don't leave empty internal pages in the tree.
Diffstat (limited to 'src')
-rw-r--r-- | src/btree/bt_split.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index 8f24f44eaba..5baae4aaae3 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -1030,17 +1030,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 @@ -1086,6 +1080,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); + /* * Confirm the parent page's index hasn't moved then update it, which * makes the split visible to threads descending the tree. |