summaryrefslogtreecommitdiff
path: root/src/mongo/db/read_concern.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2018-05-23 15:05:13 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2018-05-30 10:15:03 -0400
commit16d96f4ef0a11543b2035e58867840a410afdff1 (patch)
treeb7ee8527710a42b41dc23cfffa482115ac65cfb7 /src/mongo/db/read_concern.cpp
parentd98cdcb350d4b17a0f4c57f31535388bff351cbf (diff)
downloadmongo-16d96f4ef0a11543b2035e58867840a410afdff1.tar.gz
SERVER-34348 Add causally consistent core_txns passthrough
Diffstat (limited to 'src/mongo/db/read_concern.cpp')
-rw-r--r--src/mongo/db/read_concern.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/read_concern.cpp b/src/mongo/db/read_concern.cpp
index b604b883cab..c5fade9dcb1 100644
--- a/src/mongo/db/read_concern.cpp
+++ b/src/mongo/db/read_concern.cpp
@@ -205,10 +205,18 @@ Status makeNoopWriteIfNeeded(OperationContext* opCtx, LogicalTime clusterTime) {
Status waitForReadConcern(OperationContext* opCtx,
const repl::ReadConcernArgs& readConcernArgs,
bool allowAfterClusterTime) {
+ // If we are in a direct client within a transaction, then we may be holding locks, so it is
+ // illegal to wait for read concern. This is fine, since the outer operation should have handled
+ // waiting for read concern.
+ auto session = OperationContextSession::get(opCtx);
+ if (opCtx->getClient()->isInDirectClient() && session &&
+ session->inMultiDocumentTransaction()) {
+ return Status::OK();
+ }
+
repl::ReplicationCoordinator* const replCoord = repl::ReplicationCoordinator::get(opCtx);
invariant(replCoord);
- auto session = OperationContextSession::get(opCtx);
// Currently speculative read concern is used only for transactions and snapshot reads. However,
// speculative read concern is not yet supported with atClusterTime.
//