Validate that level:snaphsot is only specified in a context of transaction and session.
Implementaion
The check can be done in the mongos common command execution path:
https://github.com/mongodb/mongo/blob/r3.7.2/src/mongo/s/commands/strategy.cpp#L206
// TODO: find out if there is a transaction info passed in the command.
bool isInTransaction = true;
if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kSnapshotReadConcern &&
!isInTransaction) {
CommandHelpers::appendCommandStatus(
result,
Status(ErrorCodes::InvalidOptions,
"read concern snapshot is supported only in a transaction"));
return;
}
Test
Integration test that validates the error when no transaction Id is provided.
- is duplicated by
-
SERVER-32266 Test readConcern level:snapshot on mongos
-
- Closed
-