summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kangas <matt.kangas@mongodb.com>2015-01-14 12:23:13 -0500
committerMatt Kangas <matt.kangas@mongodb.com>2015-01-14 12:23:13 -0500
commite9ea48278ef98f6c51a4722108026e2f31ca201e (patch)
treed2bcfb905ea61c2a762cd6af5a77ee5c6954d058
parentb9a65ff0c5cef00d73dfc36956a2a86aceaf969c (diff)
downloadmongo-e9ea48278ef98f6c51a4722108026e2f31ca201e.tar.gz
Import wiredtiger-wiredtiger-mongodb-2.8-rc5-0-g866fbc1.tar.gz from wiredtiger branch mongodb-2.8
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_split.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c
index 70d0758dede..ca7f2266f2a 100644
--- a/src/third_party/wiredtiger/src/btree/bt_split.c
+++ b/src/third_party/wiredtiger/src/btree/bt_split.c
@@ -912,24 +912,8 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF **ref_new,
*/
ref_new[j] = NULL;
}
- else if (next_ref->state == WT_REF_SPLIT) {
- /*
- * We're discarding a deleted reference.
- * Free any resources it holds.
- */
- if (parent->type == WT_PAGE_ROW_INT) {
- WT_TRET(__split_ovfl_key_cleanup(
- session, parent, next_ref));
- ikey = __wt_ref_key_instantiated(next_ref);
- if (ikey != NULL)
- WT_TRET(__split_safe_free(session, 0,
- ikey,
- sizeof(WT_IKEY) + ikey->size));
- }
-
- WT_TRET(__split_safe_free(
- session, 0, next_ref, sizeof(WT_REF)));
- } else
+ else if (next_ref->state != WT_REF_SPLIT)
+ /* Skip refs we have marked for deletion. */
*alloc_refp++ = next_ref;
}
@@ -966,6 +950,33 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, WT_REF **ref_new,
complete = 1;
/*
+ * Now that the new page is in place it's OK to free any deleted
+ * refs we encountered modulo the regular safe free semantics.
+ */
+ for (i = 0; i < parent_entries; ++i) {
+ next_ref = pindex->index[i];
+ /* If we set the ref to split to mark it for delete */
+ if (next_ref != ref && next_ref->state == WT_REF_SPLIT) {
+ /*
+ * We're discarding a deleted reference.
+ * Free any resources it holds.
+ */
+ if (parent->type == WT_PAGE_ROW_INT) {
+ WT_TRET(__split_ovfl_key_cleanup(
+ session, parent, next_ref));
+ ikey = __wt_ref_key_instantiated(next_ref);
+ if (ikey != NULL)
+ WT_TRET(__split_safe_free(session, 0,
+ ikey,
+ sizeof(WT_IKEY) + ikey->size));
+ }
+
+ WT_TRET(__split_safe_free(
+ session, 0, next_ref, sizeof(WT_REF)));
+ }
+ }
+
+ /*
* We can't free the previous page index, there may be threads using it.
* Add it to the session discard list, to be freed when it's safe.
*/