summaryrefslogtreecommitdiff
path: root/src/mongo/db/read_concern.cpp
diff options
context:
space:
mode:
authorSamy Lanka <samy.lanka@mongodb.com>2018-08-30 19:33:18 -0400
committerSamy Lanka <samy.lanka@mongodb.com>2018-09-05 14:10:18 -0400
commit92c166d289478bb3d40cdb08d8c7e41f083dd66d (patch)
tree7edb55a9d5def3a943e4158e0d5d659a40473778 /src/mongo/db/read_concern.cpp
parentd9b5ba2d1710d7f52536ab9c53c3a68329f61b90 (diff)
downloadmongo-92c166d289478bb3d40cdb08d8c7e41f083dd66d.tar.gz
SERVER-36382 Only snapshot, lineariable and afterClusterTime reads block on prepare conflicts
Diffstat (limited to 'src/mongo/db/read_concern.cpp')
-rw-r--r--src/mongo/db/read_concern.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/read_concern.cpp b/src/mongo/db/read_concern.cpp
index cb8df144d25..53372e23878 100644
--- a/src/mongo/db/read_concern.cpp
+++ b/src/mongo/db/read_concern.cpp
@@ -334,7 +334,12 @@ Status waitForReadConcern(OperationContext* opCtx,
LOG(debugLevel) << "Using 'committed' snapshot: " << CurOp::get(opCtx)->opDescription();
}
- if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kAvailableReadConcern) {
+ // Only snapshot, linearizable and afterClusterTime reads should block on prepared transactions.
+ // We don't ignore prepare conflicts if we are in a direct client in case this overrides
+ // behavior set by a higher-level operation.
+ if (readConcernArgs.getLevel() != repl::ReadConcernLevel::kSnapshotReadConcern &&
+ readConcernArgs.getLevel() != repl::ReadConcernLevel::kLinearizableReadConcern &&
+ !afterClusterTime && !atClusterTime && !opCtx->getClient()->isInDirectClient()) {
opCtx->recoveryUnit()->setIgnorePrepared(true);
}