diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-06-11 16:13:57 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-11 06:37:22 +0000 |
commit | 4b8513558193e2d3ce0226d42add321efb4df139 (patch) | |
tree | c0d459a6fe91a4258bd187394a195fa61a96cdf1 | |
parent | 4d5e640ecf3cc68b6ac7f31ef787b7a891f65a27 (diff) | |
download | mongo-4b8513558193e2d3ce0226d42add321efb4df139.tar.gz |
Import wiredtiger: 6c652d1f2f32f841d92b8c29892f7d2c73a90b8a from branch mongodb-5.0
ref: 65035cf84e..6c652d1f2f
for: 5.1.0
WT-7666 Add assertion to check whether duplicate history store inserts are modifies
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/history/hs_rec.c | 30 |
2 files changed, 22 insertions, 10 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 9482f17bc4a..ad08b8d04fd 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": "65035cf84e7090a120d5d0ceb703c6fd2fc9f504" + "commit": "6c652d1f2f32f841d92b8c29892f7d2c73a90b8a" } diff --git a/src/third_party/wiredtiger/src/history/hs_rec.c b/src/third_party/wiredtiger/src/history/hs_rec.c index 43fc87989e4..f96384dfef7 100644 --- a/src/third_party/wiredtiger/src/history/hs_rec.c +++ b/src/third_party/wiredtiger/src/history/hs_rec.c @@ -150,16 +150,28 @@ __hs_insert_record(WT_SESSION_IMPL *session, WT_CURSOR *cursor, WT_BTREE *btree, &upd_type_full_diag, existing_val)); WT_ERR(__wt_compare(session, NULL, existing_val, hs_value, &cmp)); /* - * Same value should not be inserted again unless 1. previous entry is already - * deleted(i.e. the stop timestamp is globally visible), 2. from a different - * transaction 3. with a different timestamp if from the same transaction. + * The same value should not be inserted again unless: + * 1. the previous entry is already deleted (i.e. the stop timestamp is globally + * visible) + * 2. it came from a different transaction + * 3. it came from the same transaction but with a different timestamp */ - if (cmp == 0) - WT_ASSERT(session, - __wt_txn_tw_stop_visible_all(session, &hs_cbt->upd_value->tw) || - tw->start_txn == WT_TXN_NONE || - tw->start_txn != hs_cbt->upd_value->tw.start_txn || - tw->start_ts != hs_cbt->upd_value->tw.start_ts); + if (cmp == 0) { + if (!__wt_txn_tw_stop_visible_all(session, &hs_cbt->upd_value->tw) && + tw->start_txn != WT_TXN_NONE && + tw->start_txn == hs_cbt->upd_value->tw.start_txn && + tw->start_ts == hs_cbt->upd_value->tw.start_ts) { + /* + * If we have issues with duplicate history store records, we want to be able to + * distinguish between modifies and full updates. Since modifies are not + * idempotent, having them inserted multiple times can cause invalid values to + * be read. + */ + WT_ASSERT(session, + type != WT_UPDATE_MODIFY && (uint8_t)upd_type_full_diag != WT_UPDATE_MODIFY); + WT_ASSERT(session, false && "Duplicate values inserted into history store"); + } + } counter = hs_counter + 1; } #else |