summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlison Felizzi <alison.felizzi@mongodb.com>2021-11-04 05:00:44 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-04 05:26:46 +0000
commitbbc304eb5a01909c1536e083105c7b6b97dec55a (patch)
tree211623ee5a79d58a46fff03a1d045241d10cb1ed
parentbf94b216ccaf4b485f392c535e3b753578d679d6 (diff)
downloadmongo-bbc304eb5a01909c1536e083105c7b6b97dec55a.tar.gz
Import wiredtiger: 4a4a0259eca4e9b7cdebc4512145b7ca17c2e742 from branch mongodb-master
ref: d6bd5d1ffd..4a4a0259ec for: 5.2.0 WT-8114 Revert allow setting the prepare timestamp smaller than or equal to the latest active read timestamp with roundup prepare config
-rw-r--r--src/third_party/wiredtiger/dist/api_data.py5
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/docs/transactions.dox9
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in11
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_timestamp.c14
-rw-r--r--src/third_party/wiredtiger/test/suite/test_prepare06.py20
6 files changed, 21 insertions, 40 deletions
diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py
index 75d5a6dbe40..5eb4ceaebf1 100644
--- a/src/third_party/wiredtiger/dist/api_data.py
+++ b/src/third_party/wiredtiger/dist/api_data.py
@@ -1728,11 +1728,10 @@ methods = {
applicable only for prepared transactions. Indicates if the prepare
timestamp and the commit timestamp of this transaction can be
rounded up. If the prepare timestamp is less than the oldest
- timestamp, the prepare timestamp will be rounded to the oldest
+ timestamp, the prepare timestamp will be rounded to the oldest
timestamp. If the commit timestamp is less than the prepare
timestamp, the commit timestamp will be rounded up to the prepare
- timestamp. Allows setting the prepared timestamp smaller than or equal
- to the latest active read timestamp''', type='boolean'),
+ timestamp''', type='boolean'),
Config('read', 'false', r'''
if the read timestamp is less than the oldest timestamp, the
read timestamp will be rounded up to the oldest timestamp''',
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 6a48130188b..eb5aac2219c 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-master",
- "commit": "d6bd5d1ffd1f9fa4cb3be94f0d29d18544a07827"
+ "commit": "4a4a0259eca4e9b7cdebc4512145b7ca17c2e742"
}
diff --git a/src/third_party/wiredtiger/src/docs/transactions.dox b/src/third_party/wiredtiger/src/docs/transactions.dox
index 3c1233b0400..c594b6b15c9 100644
--- a/src/third_party/wiredtiger/src/docs/transactions.dox
+++ b/src/third_party/wiredtiger/src/docs/transactions.dox
@@ -246,15 +246,6 @@ For example, for the timestamp values <code>prepare_timestamp=100,
timestamp is rounded up to the new prepare timestamp as
<code>commit_timestamp=200</code>.
-Configuring <code>roundup_timestamps=(prepared=true)</code> also allows setting
-the prepared timestamps smaller than or equal to the latest active read timestamps.
-Use this feature carefully as it may break repeated read. For example, consider a
-transaction with a read timestamp set to 30 and a key that has a value with
-timestamp 20. Before a prepared transaction (in another thread), reading the key
-returns the value. Now a prepared transaction elsewhere in the system sets a prepared
-timestamp at 30. The reader, trying to do a repeat read of the key, gets return a
-prepared conflict error instead of the value.
-
Configuring <code>roundup_timestamps=(read=true)</code> causes the read
timestamp to be rounded up to the oldest timestamp, if the read timestamp is
greater than the oldest timestamp no change will be made.
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index 2bbebb4c5ce..576c10b53ae 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -1695,12 +1695,11 @@ struct __wt_session {
* and the commit timestamp of this transaction can be rounded up. If the prepare timestamp
* is less than the oldest timestamp\, the prepare timestamp will be rounded to the oldest
* timestamp. If the commit timestamp is less than the prepare timestamp\, the commit
- * timestamp will be rounded up to the prepare timestamp. Allows setting the prepared
- * timestamp smaller than or equal to the latest active read timestamp., a boolean flag;
- * default \c false.}
- * @config{&nbsp;&nbsp;&nbsp;&nbsp;read, if the read timestamp is less
- * than the oldest timestamp\, the read timestamp will be rounded up to the oldest
- * timestamp., a boolean flag; default \c false.}
+ * timestamp will be rounded up to the prepare timestamp., a boolean flag; default \c
+ * false.}
+ * @config{&nbsp;&nbsp;&nbsp;&nbsp;read, if the read timestamp is less than the
+ * oldest timestamp\, the read timestamp will be rounded up to the oldest timestamp., a
+ * boolean flag; default \c false.}
* @config{ ),,}
* @config{sync, whether to sync log records when the transaction commits\, inherited from
* ::wiredtiger_open \c transaction_sync., a boolean flag; default empty.}
diff --git a/src/third_party/wiredtiger/src/txn/txn_timestamp.c b/src/third_party/wiredtiger/src/txn/txn_timestamp.c
index c138f23fe57..784c2cacfed 100644
--- a/src/third_party/wiredtiger/src/txn/txn_timestamp.c
+++ b/src/third_party/wiredtiger/src/txn/txn_timestamp.c
@@ -715,19 +715,7 @@ __wt_txn_set_prepare_timestamp(WT_SESSION_IMPL *session, wt_timestamp_t prepare_
WT_RET_MSG(session, EINVAL,
"commit timestamp should not have been set before the prepare timestamp");
- /*
- * Allows setting the prepared timestamp smaller than or equal to the latest active read
- * timestamp. This feature is necessary to find the largest key in the table even if that
- * key has been deleted. Set this flag cautiously as it breaks repeated reads.
- */
-#ifdef HAVE_DIAGNOSTIC
- if (!F_ISSET(txn, WT_TXN_TS_ROUND_PREPARED))
- WT_RET(__txn_assert_after_reads(session, "prepare", prepare_ts));
- else
- WT_RET(__wt_msg(session,
- "Skip checking prepare timestamp %s against the latest active read timestamp.",
- __wt_timestamp_to_string(prepare_ts, ts_string[0])));
-#endif
+ WT_RET(__txn_assert_after_reads(session, "prepare", prepare_ts));
/*
* Check whether the prepare timestamp is less than the oldest timestamp.
diff --git a/src/third_party/wiredtiger/test/suite/test_prepare06.py b/src/third_party/wiredtiger/test/suite/test_prepare06.py
index de9a7475817..b4e65f183b0 100644
--- a/src/third_party/wiredtiger/test/suite/test_prepare06.py
+++ b/src/third_party/wiredtiger/test/suite/test_prepare06.py
@@ -90,18 +90,24 @@ class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
s_reader = self.conn.open_session()
s_reader.begin_transaction('read_timestamp=' + self.timestamp_str(40))
- # It is legal to set the prepare timestamp earlier than an active
- # read timestamp with roundup_timestamps settings. This is only
+ # It is illegal to set the prepare timestamp as earlier than an active
+ # read timestamp even with roundup_timestamps settings. This is only
# checked in diagnostic builds.
if wiredtiger.diagnostic_build():
self.session.begin_transaction('roundup_timestamps=(prepared=true)')
- self.assertEqual(self.session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(10)), 0)
+ self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
+ lambda: self.session.prepare_transaction(
+ 'prepare_timestamp=' + self.timestamp_str(10)),
+ "/must be greater than the latest active read timestamp/")
self.session.rollback_transaction()
- # It is legal to set the prepare timestamp the same as an active read
- # timestamp with roundup_timestamps settings.
+ # It is illegal to set the prepare timestamp the same as an active read
+ # timestamp even with roundup_timestamps settings.
self.session.begin_transaction('roundup_timestamps=(prepared=true)')
- self.assertEqual(self.session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(40)), 0)
+ self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
+ lambda: self.session.prepare_transaction(
+ 'prepare_timestamp=' + self.timestamp_str(40)),
+ "/must be greater than the latest active read timestamp/")
self.session.rollback_transaction()
'''
@@ -138,7 +144,5 @@ class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
s_reader.commit_transaction()
- self.ignoreStdoutPatternIfExists("Skip checking prepare timestamp")
-
if __name__ == '__main__':
wttest.run()