diff options
author | Luke Chen <luke.chen@mongodb.com> | 2020-06-23 19:29:14 +1000 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2020-06-23 19:44:32 +1000 |
commit | 187fde098980d2735e4150833d8a515c4c7d1545 (patch) | |
tree | a053d56f1ecb306131bfa4aaa58eb7326f66ba31 /src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c | |
parent | be486f8f49efcc706a53a072cb5527e1200a49cf (diff) | |
download | mongo-187fde098980d2735e4150833d8a515c4c7d1545.tar.gz |
Import wiredtiger: 5e6daf7d42727e3d86b2603c20852d1426dee55f from branch mongodb-4.4
ref: 5199f7f394..5e6daf7d42
for: 4.4.0-rc11
WT-6457 Restore static testing that zero-length row-store values are never written
WT-6464 Fix memory leak in __rollback_row_add_update
Diffstat (limited to 'src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c')
-rw-r--r-- | src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c index 9be945bb6c3..afc3508e577 100644 --- a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c +++ b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c @@ -94,9 +94,10 @@ __rollback_row_add_update(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, { WT_DECL_RET; WT_PAGE_MODIFY *mod; - WT_UPDATE *old_upd, **upd_entry; + WT_UPDATE *last_upd, *old_upd, **upd_entry; size_t upd_size; + last_upd = NULL; /* If we don't yet have a modify structure, we'll need one. */ WT_RET(__wt_page_modify_init(session, page)); mod = page->modify; @@ -108,9 +109,13 @@ __rollback_row_add_update(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, upd_entry = &mod->mod_row_update[WT_ROW_SLOT(page, rip)]; upd_size = __wt_update_list_memsize(upd); + /* If there are existing updates, append them after the new updates. */ + for (last_upd = upd; last_upd->next != NULL; last_upd = last_upd->next) + ; + last_upd->next = *upd_entry; + /* - * If it's a full update list, we're trying to instantiate the row. Otherwise, it's just a - * single update that we'd like to append to the update list. + * We can either put a tombstone plus an update or a single update on the update chain. * * Set the "old" entry to the second update in the list so that the serialization function * succeeds in swapping the first update into place. @@ -131,7 +136,12 @@ __rollback_row_add_update(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, */ WT_ERR(__wt_update_serial(session, NULL, page, upd_entry, &upd, upd_size, true)); + if (0) { err: + if (last_upd != NULL) + last_upd->next = NULL; + } + return (ret); } |