diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-26 11:19:23 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-26 12:41:13 -0400 |
commit | 65f608a4b17440d75ece209e209401e1d74ad638 (patch) | |
tree | b2fc6a4d1dcadae41ac5e1ba52eb605c730d8c2b /src/mongo | |
parent | e6b6a2231ae7f05c3c0f6fc1a0ce111792436e58 (diff) | |
download | mongo-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.cpp | 12 |
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); |