diff options
author | Benety Goh <benety@mongodb.com> | 2022-06-29 10:09:49 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-29 15:04:41 +0000 |
commit | 5ac2bc97f4917e7305b3fa257207553e298da932 (patch) | |
tree | 1ef780f88e21cfad6a46f1002016e283a18fb2ca /src/mongo/db/op_observer_impl.cpp | |
parent | 8304b16f1f4891bd4b36037374b38a0f3f30f5e6 (diff) | |
download | mongo-5ac2bc97f4917e7305b3fa257207553e298da932.tar.gz |
SERVER-67281 move BatchedWriteContext logic out of WriteUnitOfWork into OpObserver onBatchedWrite*() handlers
Diffstat (limited to 'src/mongo/db/op_observer_impl.cpp')
-rw-r--r-- | src/mongo/db/op_observer_impl.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp index b815696fed7..f390ef71980 100644 --- a/src/mongo/db/op_observer_impl.cpp +++ b/src/mongo/db/op_observer_impl.cpp @@ -2083,7 +2083,10 @@ void OpObserverImpl::onUnpreparedTransactionCommit(OperationContext* opCtx, shardObserveTransactionPrepareOrUnpreparedCommit(opCtx, *statements, commitOpTime); } -void OpObserverImpl::onBatchedWriteStart(OperationContext* opCtx) {} +void OpObserverImpl::onBatchedWriteStart(OperationContext* opCtx) { + auto& batchedWriteContext = BatchedWriteContext::get(opCtx); + batchedWriteContext.setWritesAreBatched(true); +} void OpObserverImpl::onBatchedWriteCommit(OperationContext* opCtx) { if (repl::ReplicationCoordinator::get(opCtx)->getReplicationMode() != @@ -2127,7 +2130,11 @@ void OpObserverImpl::onBatchedWriteCommit(OperationContext* opCtx) { wallClockTime); } -void OpObserverImpl::onBatchedWriteAbort(OperationContext* opCtx) {} +void OpObserverImpl::onBatchedWriteAbort(OperationContext* opCtx) { + auto& batchedWriteContext = BatchedWriteContext::get(opCtx); + batchedWriteContext.clearBatchedOperations(opCtx); + batchedWriteContext.setWritesAreBatched(false); +} void OpObserverImpl::onPreparedTransactionCommit( OperationContext* opCtx, |