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-06-03 13:35:53 +0000
commit413af9c82279f4d6dbf802534674789cbcefae59 (patch)
treeeb82fce0040b8beadd472e7ae3f0f7fca92fa1c8
parent873c94200f93532bf730564ba34874413ede3cd0 (diff)
downloadmongo-413af9c82279f4d6dbf802534674789cbcefae59.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 0655ab3a2b1..c4db859b2d5 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -288,6 +288,8 @@ void writeToImageCollection(OperationContext* opCtx,
request.setUpdateModification(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.