summaryrefslogtreecommitdiff
path: root/src/mongo/db/op_observer/op_observer_impl.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2023-01-13 15:04:21 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-13 20:56:30 +0000
commit6ad7e5338b5068f65e19a565335880310df8a897 (patch)
treef21a5302c885bc64c7978ca1e97ef05649010037 /src/mongo/db/op_observer/op_observer_impl.cpp
parent31ee375d0956894889f39426ca56d9add25d0acb (diff)
downloadmongo-6ad7e5338b5068f65e19a565335880310df8a897.tar.gz
SERVER-70903 relax multi timestamp constraint for large batched writes spanning multiple entries
Diffstat (limited to 'src/mongo/db/op_observer/op_observer_impl.cpp')
-rw-r--r--src/mongo/db/op_observer/op_observer_impl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/op_observer/op_observer_impl.cpp b/src/mongo/db/op_observer/op_observer_impl.cpp
index d146d71b335..6503e3f7b34 100644
--- a/src/mongo/db/op_observer/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer/op_observer_impl.cpp
@@ -1867,6 +1867,14 @@ void OpObserverImpl::onBatchedWriteCommit(OperationContext* opCtx) {
uassert(ErrorCodes::TransactionTooLarge,
"batched writes must generate a single applyOps entry",
applyOpsOplogSlotAndOperationAssignment.applyOpsEntries.size() == 1);
+ } else if (applyOpsOplogSlotAndOperationAssignment.applyOpsEntries.size() > 1) {
+ // Batched writes spanning multiple oplog entries create/reserve multiple oplog entries in
+ // the same WriteUnitOfWork. Because of this, such batched writes will set multiple
+ // timestamps, violating the multi timestamp constraint. It's safe to ignore the multi
+ // timestamp constraints here.
+ // TODO(SERVER-72723): implement rollback logic for batched writes spanning multiple
+ // entries.
+ opCtx->recoveryUnit()->ignoreAllMultiTimestampConstraints();
}
// Storage transaction commit is the last place inside a transaction that can throw an