diff options
Diffstat (limited to 'src/mongo/db/read_concern.cpp')
-rw-r--r-- | src/mongo/db/read_concern.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/read_concern.cpp b/src/mongo/db/read_concern.cpp index f5f36e46ea3..38cb66eb22f 100644 --- a/src/mongo/db/read_concern.cpp +++ b/src/mongo/db/read_concern.cpp @@ -181,7 +181,9 @@ Status makeNoopWriteIfNeeded(OperationContext* opCtx, LogicalTime clusterTime) { } } // namespace -Status waitForReadConcern(OperationContext* opCtx, const repl::ReadConcernArgs& readConcernArgs) { +Status waitForReadConcern(OperationContext* opCtx, + const repl::ReadConcernArgs& readConcernArgs, + bool allowAfterClusterTime) { repl::ReplicationCoordinator* const replCoord = repl::ReplicationCoordinator::get(opCtx); invariant(replCoord); @@ -213,6 +215,10 @@ Status waitForReadConcern(OperationContext* opCtx, const repl::ReadConcernArgs& auto afterClusterTime = readConcernArgs.getArgsClusterTime(); if (afterClusterTime) { + if (!allowAfterClusterTime) { + return {ErrorCodes::InvalidOptions, "afterClusterTime is not allowed for this command"}; + } + if ((serverGlobalParams.featureCompatibility.getVersion() != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) && ShardingState::get(opCtx)->enabled()) { |