summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2021-05-18 11:29:43 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-19 22:46:54 +0000
commit1c2b75b6a916aefaba0ec7b74ca0e914a8bba2d2 (patch)
tree375a1c45870c16b2bbd92b6bd150d00268b0aeb9
parent53f5b636a58d282fb9965e5baf95773d319480f7 (diff)
downloadmongo-1c2b75b6a916aefaba0ec7b74ca0e914a8bba2d2.tar.gz
SERVER-57015: Ensure findAndModify image collection writes are not replicated.
(cherry picked from commit 2cc51d1d39270a8145757debb5578057ef87ff71)
-rw-r--r--src/mongo/db/repl/oplog.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 394269185e5..eeb690ce3ce 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -340,6 +340,8 @@ void writeToImageCollection(OperationContext* opCtx,
request.setUpdates(imageEntry.toBSON());
request.setFromOplogApplication(true);
try {
+ // This code path can also be hit by things such as `applyOps` and tenant migrations.
+ repl::UnreplicatedWritesBlock dontReplicate(opCtx);
::mongo::update(opCtx, autoColl.getDb(), request);
} catch (const ExceptionFor<ErrorCodes::DuplicateKey>&) {
// We can get a duplicate key when two upserts race on inserting a document.