summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2021-12-21 17:27:18 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-21 07:28:21 +0000
commitcfb41e57fd76f9543b52897d0d19aefb734575d4 (patch)
tree7eebf91c132b597f9cfcb74f7dd1982329c9cca0
parent697541870b707043e525c5ad7f1793a72e7d9995 (diff)
downloadmongo-cfb41e57fd76f9543b52897d0d19aefb734575d4.tar.gz
Import wiredtiger: d0655fdab45eae43c0dfe06f9c39d7332f51f31a from branch mongodb-5.2
ref: b576623d79..d0655fdab4 for: 5.2.0-rc2 WT-8547 Turn off MongoDB timestamp informational messages in standalone builds
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/lang/python/wiredtiger.i13
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_timestamp.c13
-rw-r--r--src/third_party/wiredtiger/test/suite/test_timestamp09.py27
-rw-r--r--src/third_party/wiredtiger/test/suite/test_timestamp21.py51
5 files changed, 75 insertions, 31 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index e00d56bf350..deeb9d4a35c 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.2",
- "commit": "b576623d796ae3a1f0da97f3a83e14633bf99f06"
+ "commit": "d0655fdab45eae43c0dfe06f9c39d7332f51f31a"
}
diff --git a/src/third_party/wiredtiger/lang/python/wiredtiger.i b/src/third_party/wiredtiger/lang/python/wiredtiger.i
index 5d221c6863b..c77a2effda4 100644
--- a/src/third_party/wiredtiger/lang/python/wiredtiger.i
+++ b/src/third_party/wiredtiger/lang/python/wiredtiger.i
@@ -601,6 +601,7 @@ COMPARE_NOTFOUND_OK(__wt_cursor::_search_near)
%exception wiredtiger_strerror;
%exception wiredtiger_version;
%exception diagnostic_build;
+%exception standalone_build;
/* WT_CURSOR customization. */
/* First, replace the varargs get / set methods with Python equivalents. */
@@ -1130,9 +1131,19 @@ int diagnostic_build() {
#endif
}
%}
-
int diagnostic_build();
+%{
+int standalone_build() {
+#ifdef WT_STANDALONE_BUILD
+ return 1;
+#else
+ return 0;
+#endif
+}
+%}
+int standalone_build();
+
/* Remove / rename parts of the C API that we don't want in Python. */
%immutable __wt_cursor::session;
%immutable __wt_cursor::uri;
diff --git a/src/third_party/wiredtiger/src/txn/txn_timestamp.c b/src/third_party/wiredtiger/src/txn/txn_timestamp.c
index 1529191a034..8b0d68774d1 100644
--- a/src/third_party/wiredtiger/src/txn/txn_timestamp.c
+++ b/src/third_party/wiredtiger/src/txn/txn_timestamp.c
@@ -757,12 +757,11 @@ __wt_txn_set_read_timestamp(WT_SESSION_IMPL *session, wt_timestamp_t read_ts)
WT_TXN_SHARED *txn_shared;
wt_timestamp_t ts_oldest;
char ts_string[2][WT_TS_INT_STRING_SIZE];
- bool did_roundup_to_oldest, use_pinned_ts;
+ bool did_roundup_to_oldest;
txn = session->txn;
txn_global = &S2C(session)->txn_global;
txn_shared = WT_SESSION_TXN_SHARED(session);
- use_pinned_ts = false;
WT_RET(__wt_txn_context_prepare_check(session));
@@ -784,7 +783,6 @@ __wt_txn_set_read_timestamp(WT_SESSION_IMPL *session, wt_timestamp_t read_ts)
__wt_readlock(session, &txn_global->rwlock);
if (F_ISSET(txn, WT_TXN_TS_READ_BEFORE_OLDEST)) {
- use_pinned_ts = true;
/* Set a flag on the transaction to prevent re-acquiring the read lock. */
F_SET(txn, WT_TXN_TS_ALREADY_LOCKED);
ret = __wt_txn_get_pinned_timestamp(session, &ts_oldest, txn->flags);
@@ -804,17 +802,22 @@ __wt_txn_set_read_timestamp(WT_SESSION_IMPL *session, wt_timestamp_t read_ts)
} else {
__wt_readunlock(session, &txn_global->rwlock);
+#if !defined(WT_STANDALONE_BUILD)
/*
* In some cases, MongoDB sets a read timestamp older than the oldest timestamp, relying
* on WiredTiger's concurrency to detect and fail the set. In other cases it's a bug and
* MongoDB wants error context to make it easier to find those problems. Don't output an
* error message because that logs a MongoDB error, use an informational message to
- * provide the context instead.
+ * provide the context instead. Don't output this message for standalone builds, it's
+ * too noisy for applications that don't track the read timestamp against the oldest
+ * timestamp and simply expect the set to fail.
*/
__wt_verbose_notice(session, WT_VERB_TIMESTAMP,
"read timestamp %s less than the %s timestamp %s",
- __wt_timestamp_to_string(read_ts, ts_string[0]), use_pinned_ts ? "pinned" : "oldest",
+ __wt_timestamp_to_string(read_ts, ts_string[0]),
+ F_ISSET(txn, WT_TXN_TS_READ_BEFORE_OLDEST) ? "pinned" : "oldest",
__wt_timestamp_to_string(ts_oldest, ts_string[1]));
+#endif
return (EINVAL);
}
} else
diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp09.py b/src/third_party/wiredtiger/test/suite/test_timestamp09.py
index 2188b919c43..05aa86e9398 100644
--- a/src/third_party/wiredtiger/test/suite/test_timestamp09.py
+++ b/src/third_party/wiredtiger/test/suite/test_timestamp09.py
@@ -156,12 +156,17 @@ class test_timestamp09(wttest.WiredTigerTestCase, suite_subprocess):
self.session.commit_transaction(
'commit_timestamp=' + self.timestamp_str(7))
- # Read timestamp >= Oldest timestamp
+ # Read timestamp >= oldest timestamp
self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(7) +
',stable_timestamp=' + self.timestamp_str(7))
- with self.expectedStdoutPattern('less than the oldest timestamp'):
- self.assertRaisesException(wiredtiger.WiredTigerError,
- lambda: self.session.begin_transaction('read_timestamp=' + self.timestamp_str(6)))
+ if wiredtiger.standalone_build():
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ self.session.begin_transaction('read_timestamp=' + self.timestamp_str(6)))
+ else:
+ # This is a MongoDB message, not written in standalone builds.
+ with self.expectedStdoutPattern('less than the oldest timestamp'):
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ self.session.begin_transaction('read_timestamp=' + self.timestamp_str(6)))
# c[8] is not visible at read_timestamp < 8
self.session.begin_transaction('read_timestamp=' + self.timestamp_str(7))
@@ -180,11 +185,15 @@ class test_timestamp09(wttest.WiredTigerTestCase, suite_subprocess):
self.session.commit_transaction()
# We can move the oldest timestamp backwards with "force"
- self.conn.set_timestamp(
- 'oldest_timestamp=' + self.timestamp_str(5) + ',force')
- with self.expectedStdoutPattern('less than the oldest timestamp'):
- self.assertRaisesException(wiredtiger.WiredTigerError,
- lambda: self.session.begin_transaction('read_timestamp=' + self.timestamp_str(4)))
+ self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(5) + ',force')
+ if wiredtiger.standalone_build():
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ self.session.begin_transaction('read_timestamp=' + self.timestamp_str(4)))
+ else:
+ # This is a MongoDB message, not written in standalone builds.
+ with self.expectedStdoutPattern('less than the oldest timestamp'):
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ self.session.begin_transaction('read_timestamp=' + self.timestamp_str(4)))
self.session.begin_transaction('read_timestamp=' + self.timestamp_str(6))
self.assertTimestampsEqual(
self.conn.query_timestamp('get=oldest_reader'), self.timestamp_str(6))
diff --git a/src/third_party/wiredtiger/test/suite/test_timestamp21.py b/src/third_party/wiredtiger/test/suite/test_timestamp21.py
index 6d553a36246..59f16c4d7a9 100644
--- a/src/third_party/wiredtiger/test/suite/test_timestamp21.py
+++ b/src/third_party/wiredtiger/test/suite/test_timestamp21.py
@@ -57,15 +57,22 @@ class test_timestamp21(wttest.WiredTigerTestCase):
'read_timestamp=' + self.timestamp_str(6) + ',read_before_oldest=true'), 0)
session2.rollback_transaction()
- # Begin a transaction with a read timestamp of 6 and no additional config.
- with self.expectedStdoutPattern('less than the oldest timestamp'):
- self.assertRaisesException(wiredtiger.WiredTigerError, lambda: session2.begin_transaction(
- 'read_timestamp=' + self.timestamp_str(6)))
+ # Begin a transaction with a read timestamp of 6 and no additional config. Check for
+ # informational message output when a read timestamp is older than the oldest timestamp.
+ if wiredtiger.standalone_build():
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ session2.begin_transaction('read_timestamp=' + self.timestamp_str(6)))
+ else:
+ # This is a MongoDB message, not written in standalone builds.
+ with self.expectedStdoutPattern('less than the oldest timestamp'):
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ session2.begin_transaction('read_timestamp=' + self.timestamp_str(6)))
# Begin a transaction with the config specified but no read timestamp.
session2.begin_transaction('read_before_oldest=true')
# Set a read timestamp behind the oldest timestamp.
- self.assertEqual(session2.timestamp_transaction('read_timestamp=' + self.timestamp_str(5)), 0)
+ self.assertEqual(
+ session2.timestamp_transaction('read_timestamp=' + self.timestamp_str(5)), 0)
session2.rollback_transaction()
# Begin a transaction with a read timestamp of 5 and read_before_oldest specified.
@@ -73,17 +80,31 @@ class test_timestamp21(wttest.WiredTigerTestCase):
'read_timestamp=' + self.timestamp_str(5) + ',read_before_oldest=true'), 0)
session2.rollback_transaction()
- # Begin a transaction with a read timestamp of 4 and read_before_oldest specified. We get a
- # different std out message in this scenario.
- with self.expectedStdoutPattern('less than the pinned timestamp'):
- self.assertRaisesException(wiredtiger.WiredTigerError, lambda: session2.begin_transaction(
- 'read_timestamp=' + self.timestamp_str(4) + ',read_before_oldest=true'))
+ # Begin a transaction with a read timestamp of 4 and read_before_oldest specified.
+ # We get a different stdout message in this scenario.
+ if wiredtiger.standalone_build():
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ session2.begin_transaction('read_timestamp=' +\
+ self.timestamp_str(4) + ',read_before_oldest=true'))
+ else:
+ # This is a MongoDB message, not written in standalone builds.
+ with self.expectedStdoutPattern('less than the pinned timestamp'):
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ session2.begin_transaction('read_timestamp=' +\
+ self.timestamp_str(4) + ',read_before_oldest=true'))
- # Begin a transaction with a read timestamp of 6 and read_before_oldest off, this will have
- # the same behaviour as not specifying it.
- with self.expectedStdoutPattern('less than the oldest timestamp'):
- self.assertRaisesException(wiredtiger.WiredTigerError, lambda: session2.begin_transaction(
- 'read_timestamp=' + self.timestamp_str(6) + ',read_before_oldest=false'))
+ # Begin a transaction with a read timestamp of 6 and read_before_oldest off, this will
+ # have the same behaviour as not specifying it.
+ if wiredtiger.standalone_build():
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ session2.begin_transaction('read_timestamp=' +\
+ self.timestamp_str(6) + ',read_before_oldest=false'))
+ else:
+ # This is a MongoDB message, not written in standalone builds.
+ with self.expectedStdoutPattern('less than the oldest timestamp'):
+ self.assertRaisesException(wiredtiger.WiredTigerError, lambda:
+ session2.begin_transaction('read_timestamp=' +\
+ self.timestamp_str(6) + ',read_before_oldest=false'))
# Expect an error when we use roundup timestamps alongside allow read timestamp before
# oldest.