summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorPavi Vetriselvan <pvselvan@umich.edu>2018-06-04 16:10:35 -0400
committerPavi Vetriselvan <pvselvan@umich.edu>2018-06-04 16:20:48 -0400
commit95d855d31b949cadf5047da16b5b8a623c4269f5 (patch)
tree8c5b6627112e51b834947f8b37ec30ad80323a02 /src/mongo/db
parent1422b847b1f3da9ce88909bf0e597ea8d1d6b1da (diff)
downloadmongo-95d855d31b949cadf5047da16b5b8a623c4269f5.tar.gz
SERVER-34764 use inMultiDocumentTransaction instead of autocommit val to avoid spurious readConcern error
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/service_entry_point_common.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 1fa3dcdbae1..dc23c99bc0f 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -818,6 +818,7 @@ void execCommandDatabase(OperationContext* opCtx,
}
if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kSnapshotReadConcern) {
+ auto session = OperationContextSession::get(opCtx);
uassert(ErrorCodes::InvalidOptions,
"readConcern level snapshot is only valid in multi-statement transactions",
// With test commands enabled, a read command with readConcern snapshot is
@@ -825,7 +826,7 @@ void execCommandDatabase(OperationContext* opCtx,
(getTestCommandsEnabled() &&
invocation->definition()->getReadWriteType() ==
BasicCommand::ReadWriteType::kRead) ||
- (autocommitVal != boost::none && *autocommitVal == false));
+ (session && session->inMultiDocumentTransaction()));
uassert(ErrorCodes::InvalidOptions,
"readConcern level snapshot requires a session ID",
opCtx->getLogicalSessionId());