diff options
Diffstat (limited to 'src/mongo/db/dbcommands.cpp')
-rw-r--r-- | src/mongo/db/dbcommands.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index ecf5b9b7cb0..9b5a6c3c6c8 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -1461,6 +1461,7 @@ bool Command::run(OperationContext* txn, replyBuilder->setMetadata(rpc::makeEmptyMetadata()); return result; } + if (!supportsReadConcern()) { // Only return an error if a non-nullish readConcern was parsed, but do not process // readConcern regardless. @@ -1497,11 +1498,11 @@ bool Command::run(OperationContext* txn, return result; } } + if ((replCoord->getReplicationMode() == repl::ReplicationCoordinator::Mode::modeReplSet || testingSnapshotBehaviorInIsolation) && - (readConcernArgs.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern || - readConcernArgs.getLevel() == repl::ReadConcernLevel::kLinearizableReadConcern)) { + readConcernArgs.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern) { // ReadConcern Majority is not supported in ProtocolVersion 0. if (!testingSnapshotBehaviorInIsolation && !replCoord->isV1ElectionProtocol()) { auto result = appendCommandStatus( @@ -1538,15 +1539,6 @@ bool Command::run(OperationContext* txn, } } } - - if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kLinearizableReadConcern) { - uassert(ErrorCodes::FailedToParse, - "afterOpTime not compatible with read concern level linearizable", - readConcernArgs.getOpTime().isNull()); - uassert(ErrorCodes::NotMaster, - "cannot satisfy linearizable read concern on non-primary node", - replCoord->getMemberState().primary()); - } } // run expects non-const bsonobj @@ -1559,7 +1551,6 @@ bool Command::run(OperationContext* txn, StatusWith<WriteConcernOptions> wcResult = extractWriteConcern(txn, cmd, db, this->supportsWriteConcern(cmd)); - if (!wcResult.isOK()) { auto result = appendCommandStatus(inPlaceReplyBob, wcResult.getStatus()); inPlaceReplyBob.doneFast(); |