summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/strategy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/commands/strategy.cpp')
-rw-r--r--src/mongo/s/commands/strategy.cpp41
1 files changed, 10 insertions, 31 deletions
diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp
index 55081a9a04b..4ff6bdfe3e9 100644
--- a/src/mongo/s/commands/strategy.cpp
+++ b/src/mongo/s/commands/strategy.cpp
@@ -257,38 +257,7 @@ void execCommandClient(OperationContext* opCtx,
}
auto& readConcernArgs = repl::ReadConcernArgs::get(opCtx);
-
if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kSnapshotReadConcern) {
- // TODO SERVER-33708.
- if (!invocation->supportsReadConcern(readConcernArgs.getLevel())) {
- auto body = result->getBodyBuilder();
- CommandHelpers::appendCommandStatusNoThrow(
- body,
- Status(ErrorCodes::InvalidOptions,
- str::stream()
- << "read concern snapshot is not supported on mongos for the command "
- << c->getName()));
- return;
- }
-
- if (!opCtx->getTxnNumber()) {
- auto body = result->getBodyBuilder();
- CommandHelpers::appendCommandStatusNoThrow(
- body,
- Status(ErrorCodes::InvalidOptions,
- "read concern snapshot is supported only in a transaction"));
- return;
- }
-
- if (readConcernArgs.getArgsAtClusterTime()) {
- auto body = result->getBodyBuilder();
- CommandHelpers::appendCommandStatusNoThrow(
- body,
- Status(ErrorCodes::InvalidOptions,
- "read concern snapshot is not supported with atClusterTime on mongos"));
- return;
- }
-
uassert(ErrorCodes::InvalidOptions,
"read concern snapshot is only supported in a multi-statement transaction",
TransactionRouter::get(opCtx));
@@ -399,6 +368,16 @@ void runCommand(OperationContext* opCtx,
return;
}
+ if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kSnapshotReadConcern) {
+ uassert(ErrorCodes::InvalidOptions,
+ str::stream() << "read concern snapshot is not supported on mongos for the command "
+ << commandName,
+ invocation->supportsReadConcern(readConcernArgs.getLevel()));
+ uassert(ErrorCodes::InvalidOptions,
+ "read concern snapshot is not supported with atClusterTime on mongos",
+ !readConcernArgs.getArgsAtClusterTime());
+ }
+
boost::optional<ScopedRouterSession> scopedSession;
auto osi =
initializeOperationSessionInfo(opCtx, request.body, command->requiresAuth(), true, true);