summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-08-08 11:53:54 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-08 02:21:40 +0000
commite87964d1a9bfd1d2946988cb009a14a561036798 (patch)
tree5ad47f002e900081e19849dd1e8ae5a35fd2aad6
parentb02dbf2c7011dfd8fca95d870d69b4f0f9af699a (diff)
downloadmongo-e87964d1a9bfd1d2946988cb009a14a561036798.tar.gz
Import wiredtiger: e9be21e8a09085cbfa3a5eca74f9279b3329f42e from branch mongodb-5.0
ref: 399edaeb4c..e9be21e8a0 for: 5.0.11 WT-9004 Free the onpage tombstone after update restore eviction (#7717)
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_split.c23
2 files changed, 17 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 82cc50b973c..117ff7898af 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-5.0",
- "commit": "399edaeb4cd9265746de06b4bc59dd3b047d8106"
+ "commit": "e9be21e8a09085cbfa3a5eca74f9279b3329f42e"
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c
index 107f99b7285..05bac9aabe8 100644
--- a/src/third_party/wiredtiger/src/btree/bt_split.c
+++ b/src/third_party/wiredtiger/src/btree/bt_split.c
@@ -1555,6 +1555,7 @@ static void
__split_multi_inmem_final(WT_SESSION_IMPL *session, WT_PAGE *orig, WT_MULTI *multi)
{
WT_SAVE_UPD *supd;
+ WT_UPDATE **tmp;
uint32_t i, slot;
/* If we have saved updates, we must have decided to restore them to the new page. */
@@ -1578,10 +1579,18 @@ __split_multi_inmem_final(WT_SESSION_IMPL *session, WT_PAGE *orig, WT_MULTI *mul
} else
supd->ins->upd = NULL;
- /* Free the updates written to the data store and the history store. */
+ /*
+ * Free the updates written to the data store and the history store when there exists an
+ * onpage value. It is possible that there can be an onpage tombstone without an onpage
+ * value when the tombstone is globally visible. Do not free them here as it is possible
+ * that the globally visible tombstone is already freed as part of update obsolete check.
+ */
if (supd->onpage_upd != NULL && !F_ISSET(S2C(session), WT_CONN_IN_MEMORY) &&
- orig->type != WT_PAGE_COL_FIX)
- __wt_free_update_list(session, &supd->onpage_upd);
+ orig->type != WT_PAGE_COL_FIX) {
+ tmp = supd->onpage_tombstone != NULL ? &supd->onpage_tombstone : &supd->onpage_upd;
+ __wt_free_update_list(session, tmp);
+ supd->onpage_tombstone = supd->onpage_upd = NULL;
+ }
}
}
@@ -1594,7 +1603,7 @@ static void
__split_multi_inmem_fail(WT_SESSION_IMPL *session, WT_PAGE *orig, WT_MULTI *multi, WT_REF *ref)
{
WT_SAVE_UPD *supd;
- WT_UPDATE *upd;
+ WT_UPDATE *upd, *tmp;
uint32_t i, slot;
if (!F_ISSET(S2C(session), WT_CONN_IN_MEMORY) && orig->type != WT_PAGE_COL_FIX)
@@ -1615,11 +1624,11 @@ __split_multi_inmem_fail(WT_SESSION_IMPL *session, WT_PAGE *orig, WT_MULTI *mult
upd = supd->ins->upd;
WT_ASSERT(session, upd != NULL);
-
- for (; upd->next != NULL && upd->next != supd->onpage_upd; upd = upd->next)
+ tmp = supd->onpage_tombstone != NULL ? supd->onpage_tombstone : supd->onpage_upd;
+ for (; upd->next != NULL && upd->next != tmp; upd = upd->next)
;
if (upd->next == NULL)
- upd->next = supd->onpage_upd;
+ upd->next = tmp;
}
/*