summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-11-03 13:38:43 +1100
committerMichael Cahill <michael.cahill@mongodb.com>2015-11-03 13:38:43 +1100
commit423cb8827a88dd2d4ec68a46e237d8710fb9cf3a (patch)
tree02dc9da5652ea2c2429c7d5e995c9bf0d62cadd3 /src
parenta3019fcc09f00dd104efb675dd3df4bc564e08bb (diff)
downloadmongo-423cb8827a88dd2d4ec68a46e237d8710fb9cf3a.tar.gz
WT-2195 Fix a hang after giving up on a reverse split.
Diffstat (limited to 'src')
-rw-r--r--src/btree/bt_split.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c
index 2145d6ac014..c0c739d68ad 100644
--- a/src/btree/bt_split.c
+++ b/src/btree/bt_split.c
@@ -1031,10 +1031,13 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
/*
* If the entire (sub)tree is empty, give up: we can't leave an empty
- * internal page.
+ * internal page. Mark it to be evicted soon and clean up any
+ * references that have changed state.
*/
- if (result_entries == 0)
- return (0);
+ if (result_entries == 0) {
+ __wt_page_evict_soon(parent);
+ goto err;
+ }
/*
* Allocate and initialize a new page index array for the parent, then
@@ -1226,6 +1229,12 @@ err: /*
next_ref->state = WT_REF_DELETED;
}
+ /* If we gave up on a reverse split, unlock the child. */
+ if (ref_new == NULL) {
+ WT_ASSERT(session, ref->state == WT_REF_LOCKED);
+ ref->state = WT_REF_DELETED;
+ }
+
__wt_free_ref_index(session, NULL, alloc_index, false);
}