summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorSamy Lanka <samy.lanka@mongodb.com>2021-05-12 04:05:56 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-20 21:14:11 +0000
commit7f901206919def001d0128a2907601a1ff2143b7 (patch)
treefb383e4fae1cd1fe7d973125d31c8cec1a8fb4b8 /src/mongo/db/commands
parentfe0042206cc3ea6a0792a956a876d5793a1c67c2 (diff)
downloadmongo-7f901206919def001d0128a2907601a1ff2143b7.tar.gz
SERVER-56488 Change the default read concern to always be local
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/count_cmd.cpp3
-rw-r--r--src/mongo/db/commands/dbhash.cpp3
-rw-r--r--src/mongo/db/commands/distinct.cpp3
-rw-r--r--src/mongo/db/commands/find_cmd.cpp3
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp3
-rw-r--r--src/mongo/db/commands/killcursors_common.h5
-rw-r--r--src/mongo/db/commands/map_reduce_command_base.h3
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp4
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp4
-rw-r--r--src/mongo/db/commands/txn_cmds.cpp3
10 files changed, 22 insertions, 12 deletions
diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp
index c53ffb44608..2d4769c5f86 100644
--- a/src/mongo/db/commands/count_cmd.cpp
+++ b/src/mongo/db/commands/count_cmd.cpp
@@ -97,7 +97,8 @@ public:
}
ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj,
- repl::ReadConcernLevel level) const override {
+ repl::ReadConcernLevel level,
+ bool isImplicitDefault) const override {
static const Status kSnapshotNotSupported{ErrorCodes::InvalidOptions,
"read concern snapshot not supported"};
return {{level == repl::ReadConcernLevel::kSnapshotReadConcern, kSnapshotNotSupported},
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 6ba7a8638dc..a17c4bc77c0 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -88,7 +88,8 @@ public:
}
ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj,
- repl::ReadConcernLevel level) const final {
+ repl::ReadConcernLevel level,
+ bool isImplicitDefault) const final {
static const Status kReadConcernNotSupported{ErrorCodes::InvalidOptions,
"read concern not supported"};
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index 2c01df647bc..6c9dba828d3 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -95,7 +95,8 @@ public:
}
ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj,
- repl::ReadConcernLevel level) const override {
+ repl::ReadConcernLevel level,
+ bool isImplicitDefault) const override {
return ReadConcernSupportResult::allSupportedAndDefaultPermitted();
}
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index 669f133fab5..00d5f57c803 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -198,7 +198,8 @@ public:
return false;
}
- ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const final {
+ ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level,
+ bool isImplicitDefault) const final {
return ReadConcernSupportResult::allSupportedAndDefaultPermitted();
}
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index b2b407c65d6..88eb60eb201 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -277,7 +277,8 @@ public:
return false;
}
- ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const override {
+ ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level,
+ bool isImplicitDefault) const override {
return kSupportsReadConcernResult;
}
diff --git a/src/mongo/db/commands/killcursors_common.h b/src/mongo/db/commands/killcursors_common.h
index 4d906b66777..06ee9c9335d 100644
--- a/src/mongo/db/commands/killcursors_common.h
+++ b/src/mongo/db/commands/killcursors_common.h
@@ -74,11 +74,12 @@ public:
return false;
}
- ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const final {
+ ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level,
+ bool isImplicitDefault) const final {
if constexpr (Impl::supportsReadConcern) {
return ReadConcernSupportResult::allSupportedAndDefaultPermitted();
} else {
- return KCV1Gen::InvocationBaseGen::supportsReadConcern(level);
+ return KCV1Gen::InvocationBaseGen::supportsReadConcern(level, isImplicitDefault);
}
}
diff --git a/src/mongo/db/commands/map_reduce_command_base.h b/src/mongo/db/commands/map_reduce_command_base.h
index bcc0870dfe5..f3806c40766 100644
--- a/src/mongo/db/commands/map_reduce_command_base.h
+++ b/src/mongo/db/commands/map_reduce_command_base.h
@@ -51,7 +51,8 @@ public:
* the aggregate command.
*/
virtual ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj,
- repl::ReadConcernLevel level) const {
+ repl::ReadConcernLevel level,
+ bool isImplicitDefault) const {
static const Status kReadConcernNotSupported{ErrorCodes::InvalidOptions,
"read concern not supported"};
static const Status kDefaultReadConcernNotPermitted{ErrorCodes::InvalidOptions,
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index beed004686e..c3772f5af11 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -121,9 +121,11 @@ public:
return true;
}
- ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const override {
+ ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level,
+ bool isImplicitDefault) const override {
return _liteParsedPipeline.supportsReadConcern(
level,
+ isImplicitDefault,
_aggregationRequest.getExplain(),
serverGlobalParams.enableMajorityReadConcern);
}
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 74874ee9e93..0c7b25d8520 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -472,8 +472,8 @@ boost::intrusive_ptr<ExpressionContext> makeExpressionContext(
*/
void _adjustChangeStreamReadConcern(OperationContext* opCtx) {
repl::ReadConcernArgs& readConcernArgs = repl::ReadConcernArgs::get(opCtx);
- // There is already a read concern level set. Do nothing.
- if (readConcernArgs.hasLevel()) {
+ // There is already a non-default read concern level set. Do nothing.
+ if (readConcernArgs.hasLevel() && !readConcernArgs.getProvenance().isImplicitDefault()) {
return;
}
// We upconvert an empty read concern to 'majority'.
diff --git a/src/mongo/db/commands/txn_cmds.cpp b/src/mongo/db/commands/txn_cmds.cpp
index 9287537a5e2..9cac96afe54 100644
--- a/src/mongo/db/commands/txn_cmds.cpp
+++ b/src/mongo/db/commands/txn_cmds.cpp
@@ -185,7 +185,8 @@ public:
return true;
}
- ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level) const final {
+ ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level,
+ bool isImplicitDefault) const final {
// abortTransaction commences running inside a transaction (even though the transaction
// will be ended by the time it completes). Therefore it needs to accept any
// readConcern which is valid within a transaction. However it is not appropriate to