summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2015-11-03 14:01:29 +1100
committerAlex Gorrod <alexander.gorrod@mongodb.com>2015-11-03 14:01:29 +1100
commit438f455407f2c47ff68fbbe7efa707b5f0c54712 (patch)
tree02dc9da5652ea2c2429c7d5e995c9bf0d62cadd3
parenta3019fcc09f00dd104efb675dd3df4bc564e08bb (diff)
parent423cb8827a88dd2d4ec68a46e237d8710fb9cf3a (diff)
downloadmongo-438f455407f2c47ff68fbbe7efa707b5f0c54712.tar.gz
Merge pull request #2285 from wiredtiger/WT-2195
WT-2195 Fix a hang after giving up on a reverse split.
-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);
}