diff options
author | Pavi Vetriselvan <pvselvan@umich.edu> | 2019-07-02 13:43:26 -0400 |
---|---|---|
committer | Pavi Vetriselvan <pvselvan@umich.edu> | 2019-07-03 15:03:13 -0400 |
commit | 5b0ccad416160e34ba271e5b9188647a80cead04 (patch) | |
tree | 172f3fa88a4f9421ea33e23e2b74a90d177d7f18 /src/mongo/db/repl/sync_tail.cpp | |
parent | 3ed072af4e98b34189b29a4c86287c8d9c72b11a (diff) | |
download | mongo-5b0ccad416160e34ba271e5b9188647a80cead04.tar.gz |
SERVER-41988 ignore prepare conflicts on secondaries
(cherry picked from commit 51f76f553c696ebd6d6bb90a97ab66d8b1510a31)
Diffstat (limited to 'src/mongo/db/repl/sync_tail.cpp')
-rw-r--r-- | src/mongo/db/repl/sync_tail.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 1d4a7e05906..d7d2a75f3c0 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -1028,6 +1028,14 @@ Status multiSyncApply(OperationContext* opCtx, // Explicitly start future read transactions without a timestamp. opCtx->recoveryUnit()->setTimestampReadSource(RecoveryUnit::ReadSource::kNoTimestamp); + // When querying indexes, we return the record matching the key if it exists, or an adjacent + // document. This means that it is possible for us to hit a prepare conflict if we query for an + // incomplete key and an adjacent key is prepared. + // We ignore prepare conflicts on secondaries because they may encounter prepare conflicts that + // did not occur on the primary. + opCtx->recoveryUnit()->setPrepareConflictBehavior( + PrepareConflictBehavior::kIgnoreConflictsAllowWrites); + ApplierHelpers::stableSortByNamespace(ops); // Assume we are recovering if oplog writes are disabled in the options. |