summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-07-26 11:19:23 -0400
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-07-26 12:44:52 -0400
commit713831d52eff7169d58ae3bf1b0fff735fdae305 (patch)
tree1b3280570b09aaa83bf3bc27991486c8323b6ab2 /src/mongo/db
parentfc5b2b8fef78ab18d9560bce3015802e54dfb248 (diff)
downloadmongo-713831d52eff7169d58ae3bf1b0fff735fdae305.tar.gz
SERVER-41861 Simplify the concurrency between timestamp_transaction and commit_transaction in WiredTigerRecoveryUnit::_txnClose()
(cherry picked from commit 65f608a4b17440d75ece209e209401e1d74ad638)
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp12
1 files 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);