summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src
diff options
context:
space:
mode:
authorSulabh Mahajan <sulabh.mahajan@mongodb.com>2023-04-20 13:00:49 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-20 04:25:47 +0000
commit461cd4e174a601eba682ff307e4995f89a7b753e (patch)
tree50bd7a852391660fc05e0f8b5c1e3e8201f2a5e1 /src/third_party/wiredtiger/src
parent4e7c6e15f515cb5bd1df6a5ac364e344d917890b (diff)
downloadmongo-461cd4e174a601eba682ff307e4995f89a7b753e.tar.gz
Import wiredtiger: 72d5b1ec0afc337fb013fca747d64559ee09173f from branch mongodb-master
ref: 2d736bb019..72d5b1ec0a for: 7.1.0-rc0 WT-10189 Always free updates allocated in RTS dry runs
Diffstat (limited to 'src/third_party/wiredtiger/src')
-rw-r--r--src/third_party/wiredtiger/src/rollback_to_stable/rts_btree.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/third_party/wiredtiger/src/rollback_to_stable/rts_btree.c b/src/third_party/wiredtiger/src/rollback_to_stable/rts_btree.c
index 20663bac2e9..39d199295ae 100644
--- a/src/third_party/wiredtiger/src/rollback_to_stable/rts_btree.c
+++ b/src/third_party/wiredtiger/src/rollback_to_stable/rts_btree.c
@@ -577,11 +577,11 @@ __rts_btree_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_ROW *rip,
/* Finally remove that update from history store. */
if (valid_update_found) {
- /* Avoid freeing the updates while still in use if hs_cursor->remove fails. */
- upd = tombstone = NULL;
-
- if (!dryrun)
+ if (!dryrun) {
+ /* Avoid freeing the updates while still in use if hs_cursor->remove fails. */
+ upd = tombstone = NULL;
WT_ERR(hs_cursor->remove(hs_cursor));
+ }
WT_RTS_STAT_CONN_DATA_INCR(session, txn_rts_hs_removed);
WT_RTS_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_rts);
}
@@ -599,10 +599,12 @@ err:
__wt_scr_free(session, &key_string);
if (hs_cursor != NULL)
WT_TRET(hs_cursor->close(hs_cursor));
- if (dryrun) {
- WT_ASSERT(session, !valid_update_found || upd == NULL);
+ if (dryrun)
+ /*
+ * Dry runs don't modify the database so any upd structure allocated by this function is not
+ * in use and must be cleaned up.
+ */
__wt_free_update_list(session, &upd);
- }
return (ret);
}