From 713831d52eff7169d58ae3bf1b0fff735fdae305 Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Fri, 26 Jul 2019 11:19:23 -0400 Subject: SERVER-41861 Simplify the concurrency between timestamp_transaction and commit_transaction in WiredTigerRecoveryUnit::_txnClose() (cherry picked from commit 65f608a4b17440d75ece209e209401e1d74ad638) --- src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp index 88f04c71b58..79126850f5c 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp @@ -383,19 +383,21 @@ void WiredTigerRecoveryUnit::_txnClose(bool commit) { int wtRet; if (commit) { + StringBuilder conf; if (!_commitTimestamp.isNull()) { // There is currently no scenario where it is intentional to commit before the current // read timestamp. invariant(_readAtTimestamp.isNull() || _commitTimestamp >= _readAtTimestamp); - const std::string conf = "commit_timestamp=" + integerToHex(_commitTimestamp.asULL()); - invariantWTOK(s->timestamp_transaction(s, conf.c_str())); + conf << "commit_timestamp=" << integerToHex(_commitTimestamp.asULL()) << ","; _isTimestamped = true; } - const std::string conf = _durableTimestamp.isNull() ? "" : "durable_timestamp=" + - integerToHex(_durableTimestamp.asULL()); - wtRet = s->commit_transaction(s, conf.c_str()); + if (!_durableTimestamp.isNull()) { + conf << "durable_timestamp=" << integerToHex(_durableTimestamp.asULL()); + } + + wtRet = s->commit_transaction(s, conf.str().c_str()); LOG(3) << "WT commit_transaction for snapshot id " << _mySnapshotId; } else { wtRet = s->rollback_transaction(s, nullptr); -- cgit v1.2.1