summaryrefslogtreecommitdiff
path: root/src/mongo
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:41:13 -0400
commit65f608a4b17440d75ece209e209401e1d74ad638 (patch)
treeb2fc6a4d1dcadae41ac5e1ba52eb605c730d8c2b /src/mongo
parente6b6a2231ae7f05c3c0f6fc1a0ce111792436e58 (diff)
downloadmongo-65f608a4b17440d75ece209e209401e1d74ad638.tar.gz
SERVER-41861 Simplify the concurrency between timestamp_transaction and commit_transaction in WiredTigerRecoveryUnit::_txnClose()
Diffstat (limited to 'src/mongo')
-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 33f1548411c..40b916222ff 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
@@ -333,19 +333,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);