summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-07-08 16:30:50 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-08 06:57:12 +0000
commit39a29e865f7b6dfe472e278d50c1e438eb77a2bf (patch)
tree0087124f205bf628054e34683d70c1030dd3cb46
parent670405fd859397cff33d398dbee6c736db45ffe2 (diff)
downloadmongo-39a29e865f7b6dfe472e278d50c1e438eb77a2bf.tar.gz
Import wiredtiger: 63d11d0a30481536258b0696caa9434edecc0360 from branch mongodb-5.0
ref: ccb6525c8d..63d11d0a30 for: 5.0.10 WT-9249 Compare and fix the start durable timestamp if it is greater than ooo timestamp
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/cursor/cur_hs.c7
-rw-r--r--src/third_party/wiredtiger/src/history/hs_rec.c3
-rwxr-xr-xsrc/third_party/wiredtiger/test/suite/test_rollback_to_stable26.py37
4 files changed, 31 insertions, 18 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 334d0e67426..eb4996538a8 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": "ccb6525c8d166c87fefa9ab87d6db9270ac1fc46"
+ "commit": "63d11d0a30481536258b0696caa9434edecc0360"
}
diff --git a/src/third_party/wiredtiger/src/cursor/cur_hs.c b/src/third_party/wiredtiger/src/cursor/cur_hs.c
index 00d419915ac..7cc2de8873f 100644
--- a/src/third_party/wiredtiger/src/cursor/cur_hs.c
+++ b/src/third_party/wiredtiger/src/cursor/cur_hs.c
@@ -910,6 +910,10 @@ __curhs_insert(WT_CURSOR *cursor)
hs_tombstone->durable_ts = hs_cursor->time_window.durable_stop_ts;
hs_tombstone->txnid = hs_cursor->time_window.stop_txn;
+ WT_ASSERT(session,
+ hs_tombstone->start_ts >= hs_upd->start_ts &&
+ hs_tombstone->durable_ts >= hs_upd->durable_ts);
+
hs_tombstone->next = hs_upd;
hs_upd = hs_tombstone;
}
@@ -1047,6 +1051,9 @@ __curhs_update(WT_CURSOR *cursor)
hs_upd->durable_ts = hs_cursor->time_window.durable_start_ts;
hs_upd->txnid = hs_cursor->time_window.start_txn;
+ WT_ASSERT(session,
+ hs_tombstone->start_ts >= hs_upd->start_ts && hs_tombstone->durable_ts >= hs_upd->durable_ts);
+
/* Connect the tombstone to the update. */
hs_tombstone->next = hs_upd;
diff --git a/src/third_party/wiredtiger/src/history/hs_rec.c b/src/third_party/wiredtiger/src/history/hs_rec.c
index 37739540282..0325b0ef9eb 100644
--- a/src/third_party/wiredtiger/src/history/hs_rec.c
+++ b/src/third_party/wiredtiger/src/history/hs_rec.c
@@ -1011,7 +1011,8 @@ __hs_delete_reinsert_from_pos(WT_SESSION_IMPL *session, WT_CURSOR *hs_cursor, ui
* Use the original start time window's timestamps if it isn't out of order with respect
* to the new update.
*/
- if (hs_cbt->upd_value->tw.start_ts >= ts)
+ if (hs_cbt->upd_value->tw.start_ts >= ts ||
+ hs_cbt->upd_value->tw.durable_start_ts >= ts)
hs_insert_tw.start_ts = hs_insert_tw.durable_start_ts = ooo_tombstone ? ts : ts - 1;
else {
hs_insert_tw.start_ts = hs_cbt->upd_value->tw.start_ts;
diff --git a/src/third_party/wiredtiger/test/suite/test_rollback_to_stable26.py b/src/third_party/wiredtiger/test/suite/test_rollback_to_stable26.py
index d9cc9b9a5fa..8a223a435d5 100755
--- a/src/third_party/wiredtiger/test/suite/test_rollback_to_stable26.py
+++ b/src/third_party/wiredtiger/test/suite/test_rollback_to_stable26.py
@@ -50,12 +50,17 @@ class test_rollback_to_stable26(test_rollback_to_stable_base):
('hs_remove', dict(hs_remove=True))
]
+ prepare_values = [
+ ('no_prepare', dict(prepare=False)),
+ ('prepare', dict(prepare=True))
+ ]
+
prepare_remove_values = [
('no_prepare_remove', dict(prepare_remove=False)),
('prepare_remove', dict(prepare_remove=True))
]
- scenarios = make_scenarios(key_format_values, hs_remove_values, prepare_remove_values)
+ scenarios = make_scenarios(key_format_values, hs_remove_values, prepare_values, prepare_remove_values)
def conn_config(self):
config = 'cache_size=10MB,statistics=(all),timing_stress_for_test=[history_store_checkpoint_delay]'
@@ -91,11 +96,11 @@ class test_rollback_to_stable26(test_rollback_to_stable_base):
value_d = "ddddd" * 100
value_e = "eeeee" * 100
- self.large_updates(uri, value_a, ds, nrows, False, 20)
- self.large_updates(uri, value_b, ds, nrows, False, 30)
+ self.large_updates(uri, value_a, ds, nrows, self.prepare, 20)
+ self.large_updates(uri, value_b, ds, nrows, self.prepare, 30)
if self.hs_remove:
- self.large_removes(uri, ds, nrows, False, 40)
+ self.large_removes(uri, ds, nrows, self.prepare, 40)
prepare_session = self.conn.open_session()
prepare_session.begin_transaction()
@@ -109,8 +114,8 @@ class test_rollback_to_stable26(test_rollback_to_stable_base):
prepare_session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(50))
# Verify data is visible and correct.
- self.check(value_a, uri, nrows, 20)
- self.check(value_b, uri, nrows, 30)
+ self.check(value_a, uri, nrows, 21 if self.prepare else 20)
+ self.check(value_b, uri, nrows, 31 if self.prepare else 30)
self.evict_cursor(uri, nrows)
@@ -129,12 +134,12 @@ class test_rollback_to_stable26(test_rollback_to_stable_base):
done.set()
ckpt.join()
- self.large_updates(uri, value_d, ds, nrows, False, 60)
+ self.large_updates(uri, value_d, ds, nrows, self.prepare, 60)
# Check that the correct data.
- self.check(value_a, uri, nrows, 20)
- self.check(value_b, uri, nrows, 30)
- self.check(value_d, uri, nrows, 60)
+ self.check(value_a, uri, nrows, 21 if self.prepare else 20)
+ self.check(value_b, uri, nrows, 31 if self.prepare else 30)
+ self.check(value_d, uri, nrows, 61 if self.prepare else 60)
# Simulate a server crash and restart.
simulate_crash_restart(self, ".", "RESTART")
@@ -150,17 +155,17 @@ class test_rollback_to_stable26(test_rollback_to_stable_base):
self.assertEqual(hs_removed, nrows)
# Check that the correct data.
- self.check(value_a, uri, nrows, 20)
- self.check(value_b, uri, nrows, 30)
+ self.check(value_a, uri, nrows, 21 if self.prepare else 20)
+ self.check(value_b, uri, nrows, 31 if self.prepare else 30)
- self.large_updates(uri, value_e, ds, nrows, False, 60)
+ self.large_updates(uri, value_e, ds, nrows, self.prepare, 70)
self.evict_cursor(uri, nrows)
# Check that the correct data.
- self.check(value_a, uri, nrows, 20)
- self.check(value_b, uri, nrows, 30)
- self.check(value_e, uri, nrows, 60)
+ self.check(value_a, uri, nrows, 21 if self.prepare else 20)
+ self.check(value_b, uri, nrows, 31 if self.prepare else 30)
+ self.check(value_e, uri, nrows, 71 if self.prepare else 70)
if __name__ == '__main__':
wttest.run()