summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2018-10-04 00:45:16 -0400
committerJack Mulrow <jack.mulrow@mongodb.com>2018-10-09 09:39:08 -0400
commitf2254e26b9c7bdd94e4e6613ef5a20302ecc855e (patch)
tree9f6a456281d21f15d9eeb67f0a37650826d510e0 /src/mongo/s/commands
parentd2d7dbadcc008a484218321666aae44b75964787 (diff)
downloadmongo-f2254e26b9c7bdd94e4e6613ef5a20302ecc855e.tar.gz
SERVER-37223 Place readConcernArgs on opCtx for subsequent statements in sharded transactions
Diffstat (limited to 'src/mongo/s/commands')
-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);