diff options
author | Misha Tyulenev <misha@mongodb.com> | 2017-10-26 18:34:38 -0400 |
---|---|---|
committer | Misha Tyulenev <misha@mongodb.com> | 2017-10-26 18:37:04 -0400 |
commit | 54f044558c0845adcc6b51c2351e8382a3e9bbd7 (patch) | |
tree | 298fe9462d1e77ae5eec6d5672bb047fb5441577 /src/mongo/db/read_concern.cpp | |
parent | 260fd0c76599520d9d733874753a94a2db763538 (diff) | |
download | mongo-54f044558c0845adcc6b51c2351e8382a3e9bbd7.tar.gz |
SERVER-31613 disallow afterClusterTime on some commands
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()) { |