diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/dbcommands.cpp | 15 | ||||
-rw-r--r-- | src/mongo/db/repl/read_concern_args.cpp | 10 |
2 files changed, 7 insertions, 18 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(); diff --git a/src/mongo/db/repl/read_concern_args.cpp b/src/mongo/db/repl/read_concern_args.cpp index c0af213fe56..79c9d7b65b4 100644 --- a/src/mongo/db/repl/read_concern_args.cpp +++ b/src/mongo/db/repl/read_concern_args.cpp @@ -112,17 +112,15 @@ Status ReadConcernArgs::initialize(const BSONElement& readConcernElem) { if (!readCommittedStatus.isOK()) { return readCommittedStatus; } + if (levelString == kLocalReadConcernStr) { _level = ReadConcernLevel::kLocalReadConcern; } else if (levelString == kMajorityReadConcernStr) { _level = ReadConcernLevel::kMajorityReadConcern; - } else if (levelString == kLinearizableReadConcernStr) { - _level = ReadConcernLevel::kLinearizableReadConcern; } else { - return Status( - ErrorCodes::FailedToParse, - str::stream() << kReadConcernFieldName << '.' << kLevelFieldName - << " must be either 'local', 'majority' or 'linearizable'"); + return Status(ErrorCodes::FailedToParse, + str::stream() << kReadConcernFieldName << '.' << kLevelFieldName + << " must be either 'local' or 'majority'"); } } else { return Status(ErrorCodes::InvalidOptions, |