diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2018-04-19 16:49:51 -0400 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2018-04-23 16:12:48 -0400 |
commit | 916b24d822b0a776ca7c5aaa11cfaafe3b963e93 (patch) | |
tree | b48cb74c480ebcd2886f61a0cc4427a86df091d5 | |
parent | 232479633569eef5577386b49602c6427af88246 (diff) | |
download | mongo-916b24d822b0a776ca7c5aaa11cfaafe3b963e93.tar.gz |
SERVER-34578 remove CommandInvocation::secondaryAllowed
-rw-r--r-- | src/mongo/db/commands.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands.h | 9 | ||||
-rw-r--r-- | src/mongo/db/commands/explain_cmd.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/write_commands/write_commands.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands_test.cpp | 15 | ||||
-rw-r--r-- | src/mongo/db/s/get_database_version_command.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_explain_cmd.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_write_cmd.cpp | 4 |
8 files changed, 7 insertions, 41 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index 276a471d5a0..acedc4dc486 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -395,10 +395,6 @@ private: return _command->supportsWriteConcern(cmdObj()); } - Command::AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return _command->secondaryAllowed(context); - } - bool supportsReadConcern(repl::ReadConcernLevel level) const override { return _command->supportsReadConcern(_dbName, cmdObj(), level); } diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index a1708a1f733..564c1d1ef75 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -280,6 +280,13 @@ public: return false; } + /** + * Note that secondaryAllowed should move to CommandInvocation but cannot because there is + * one place (i.e. 'listCommands') that inappropriately produces the "slaveOk" and + * "slaveOverrideOk" fields for each Command without regard to payload. This is + * inappropriate because for some Commands (e.g. 'aggregate'), these properties depend + * on request payload. See SERVER-34578 for fixing listCommands. + */ virtual AllowedOnSecondary secondaryAllowed(ServiceContext* context) const = 0; /** @@ -512,8 +519,6 @@ public: return true; } - virtual Command::AllowedOnSecondary secondaryAllowed(ServiceContext* context) const = 0; - /** * The command definition that this invocation runs. * Note: nonvirtual. diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp index 0b2ad475968..652d1a8f2ac 100644 --- a/src/mongo/db/commands/explain_cmd.cpp +++ b/src/mongo/db/commands/explain_cmd.cpp @@ -135,10 +135,6 @@ public: return false; } - Command::AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return command()->secondaryAllowed(context); - } - /** * You are authorized to run an explain if you are authorized to run * the command that you are explaining. The auth check is performed recursively diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp index 0a2af2c99d9..f7748b13c87 100644 --- a/src/mongo/db/commands/write_commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands/write_commands.cpp @@ -243,10 +243,6 @@ private: } } - Command::AllowedOnSecondary secondaryAllowed(ServiceContext* context) const final { - return definition()->secondaryAllowed(context); - } - bool supportsReadConcern(repl::ReadConcernLevel level) const final { return level == repl::ReadConcernLevel::kLocalReadConcern || level == repl::ReadConcernLevel::kSnapshotReadConcern; diff --git a/src/mongo/db/commands_test.cpp b/src/mongo/db/commands_test.cpp index 9a7f36cd60a..0dbee80db37 100644 --- a/src/mongo/db/commands_test.cpp +++ b/src/mongo/db/commands_test.cpp @@ -176,10 +176,6 @@ public: return true; } - AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return definition()->secondaryAllowed(context); - } - void doCheckAuthorization(OperationContext*) const override {} /** @@ -223,10 +219,6 @@ public: return true; } - AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return definition()->secondaryAllowed(context); - } - void explain(OperationContext* opCtx, ExplainOptions::Verbosity verbosity, BSONObjBuilder* result) override {} @@ -272,10 +264,6 @@ public: return true; } - AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return definition()->secondaryAllowed(context); - } - void explain(OperationContext* opCtx, ExplainOptions::Verbosity verbosity, BSONObjBuilder* result) override {} @@ -312,9 +300,6 @@ public: bool supportsWriteConcern() const override { return false; } - Command::AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return Base::definition()->secondaryAllowed(context); - } void doCheckAuthorization(OperationContext* opCtx) const override {} const MyCommand* _command() const { diff --git a/src/mongo/db/s/get_database_version_command.cpp b/src/mongo/db/s/get_database_version_command.cpp index dd454c947c4..8d7f3446db6 100644 --- a/src/mongo/db/s/get_database_version_command.cpp +++ b/src/mongo/db/s/get_database_version_command.cpp @@ -57,10 +57,6 @@ public: return false; } - AllowedOnSecondary secondaryAllowed(ServiceContext* srvCtx) const override { - return definition()->secondaryAllowed(srvCtx); - } - // The command parameter happens to be string so it's historically been interpreted // by parseNs as a collection. Continuing to do so here for unexamined compatibility. NamespaceString ns() const override { diff --git a/src/mongo/s/commands/cluster_explain_cmd.cpp b/src/mongo/s/commands/cluster_explain_cmd.cpp index b871c51423f..a909706be4d 100644 --- a/src/mongo/s/commands/cluster_explain_cmd.cpp +++ b/src/mongo/s/commands/cluster_explain_cmd.cpp @@ -121,10 +121,6 @@ private: return false; } - Command::AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return command()->secondaryAllowed(context); - } - /** * You are authorized to run an explain if you are authorized to run * the command that you are explaining. The auth check is performed recursively diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp index 08d5199d7dd..4d22e207362 100644 --- a/src/mongo/s/commands/cluster_write_cmd.cpp +++ b/src/mongo/s/commands/cluster_write_cmd.cpp @@ -345,10 +345,6 @@ private: return true; } - Command::AllowedOnSecondary secondaryAllowed(ServiceContext* context) const override { - return command()->secondaryAllowed(context); - } - void doCheckAuthorization(OperationContext* opCtx) const final { try { doCheckAuthorizationHook(AuthorizationSession::get(opCtx->getClient())); |