summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage
diff options
context:
space:
mode:
authorLingzhi Deng <lingzhi.deng@mongodb.com>2020-03-31 12:27:58 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-08 18:26:45 +0000
commit66a0bfe5c1afa5c73d2ce74ebe3eeef26703cb38 (patch)
tree6327f6247dd4c5126310d4cc950ab729c8c1f599 /src/mongo/db/storage
parentbd95eb4bdee9f3fe4abf74bbe23687f12fbefb10 (diff)
downloadmongo-66a0bfe5c1afa5c73d2ce74ebe3eeef26703cb38.tar.gz
SERVER-46818: Do untimestamped writes in idemptency tests
(cherry picked from commit 53f344385322f7e9a93779e4a515167e766182cc)
Diffstat (limited to 'src/mongo/db/storage')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
index 52eae581d8b..951e4a9405c 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
@@ -54,6 +54,8 @@ MONGO_FAIL_POINT_DEFINE(WTAlwaysNotifyPrepareConflictWaiters);
logv2::LogSeverity kSlowTransactionSeverity = logv2::LogSeverity::Debug(1);
+MONGO_FAIL_POINT_DEFINE(doUntimestampedWritesForIdempotencyTests);
+
} // namespace
using Section = WiredTigerOperationStats::Section;
@@ -354,7 +356,9 @@ void WiredTigerRecoveryUnit::_txnClose(bool commit) {
// read timestamp.
invariant(_readAtTimestamp.isNull() || _commitTimestamp >= _readAtTimestamp);
- conf << "commit_timestamp=" << integerToHex(_commitTimestamp.asULL()) << ",";
+ if (MONGO_likely(!doUntimestampedWritesForIdempotencyTests.shouldFail())) {
+ conf << "commit_timestamp=" << integerToHex(_commitTimestamp.asULL()) << ",";
+ }
_isTimestamped = true;
}
@@ -655,6 +659,11 @@ Status WiredTigerRecoveryUnit::setTimestamp(Timestamp timestamp) {
// Starts the WT transaction associated with this session.
getSession();
+ if (MONGO_unlikely(doUntimestampedWritesForIdempotencyTests.shouldFail())) {
+ _isTimestamped = true;
+ return Status::OK();
+ }
+
const std::string conf = "commit_timestamp=" + integerToHex(timestamp.asULL());
auto rc = session->timestamp_transaction(session, conf.c_str());
if (rc == 0) {