summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/dbcommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/dbcommands.cpp')
-rw-r--r--src/mongo/db/commands/dbcommands.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 432c630166d..a25288efa8e 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -1403,6 +1403,22 @@ bool Command::run(OperationContext* txn,
return result;
}
+ if (readConcernArgsStatus.getValue().getLevel() ==
+ repl::ReadConcernLevel::kLinearizableReadConcern) {
+ auto replCoord = repl::ReplicationCoordinator::get(txn);
+ if (!replCoord->isLinearizableReadConcernEnabled()) {
+ Status status(ErrorCodes::LinearizableReadConcernNotEnabled,
+ "Linearizable read concern requested, but server was not started with "
+ "--setParameter enableLinearizableReadConcern=true");
+ inPlaceReplyBob.resetToEmpty();
+ auto result = appendCommandStatus(inPlaceReplyBob, status);
+ inPlaceReplyBob.doneFast();
+ replyBuilder->setMetadata(rpc::makeEmptyMetadata());
+ return result;
+ }
+ }
+
+
Status rcStatus = waitForReadConcern(txn, readConcernArgsStatus.getValue());
if (!rcStatus.isOK()) {
if (rcStatus == ErrorCodes::ExceededTimeLimit) {