diff options
author | Judah Schvimer <judah@mongodb.com> | 2019-01-09 13:20:56 -0500 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2019-01-10 09:45:38 -0500 |
commit | fcfe516250e2172d2fe6c9dab006b13d9d8140d7 (patch) | |
tree | 66a39ee5986d7e50ac4eae7ddbec760bcbbbc1a4 /src | |
parent | e62142e3dabbb333fe43dd799491dc6147756a15 (diff) | |
download | mongo-fcfe516250e2172d2fe6c9dab006b13d9d8140d7.tar.gz |
SERVER-36825 Wrap SideTransaction oplog entry writes in write conflict retry loops
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/op_observer_impl.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp index a8d7d6ddec1..34709f9bc19 100644 --- a/src/mongo/db/op_observer_impl.cpp +++ b/src/mongo/db/op_observer_impl.cpp @@ -1,4 +1,3 @@ - /** * Copyright (C) 2018-present MongoDB, Inc. * @@ -1028,12 +1027,16 @@ void OpObserverImpl::onTransactionPrepare(OperationContext* opCtx, const OplogSl { TransactionParticipant::SideTransactionBlock sideTxn(opCtx); - // Writes to the oplog only require a Global intent lock. - Lock::GlobalLock globalLock(opCtx, MODE_IX); + writeConflictRetry( + opCtx, "onTransactionPrepare", NamespaceString::kRsOplogNamespace.ns(), [&] { + + // Writes to the oplog only require a Global intent lock. + Lock::GlobalLock globalLock(opCtx, MODE_IX); - WriteUnitOfWork wuow(opCtx); - logApplyOpsForTransaction(opCtx, stmts, prepareOpTime); - wuow.commit(); + WriteUnitOfWork wuow(opCtx); + logApplyOpsForTransaction(opCtx, stmts, prepareOpTime); + wuow.commit(); + }); } } |