summaryrefslogtreecommitdiff
path: root/src/mongo/db/op_observer_impl.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2022-06-29 10:09:49 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-29 15:04:41 +0000
commit5ac2bc97f4917e7305b3fa257207553e298da932 (patch)
tree1ef780f88e21cfad6a46f1002016e283a18fb2ca /src/mongo/db/op_observer_impl.cpp
parent8304b16f1f4891bd4b36037374b38a0f3f30f5e6 (diff)
downloadmongo-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.cpp11
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,