diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2018-02-12 05:41:53 -0500 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2018-02-14 02:48:16 -0500 |
commit | e39598ae82e34f33f3ef29fd89801ce6cfb5270b (patch) | |
tree | 06672aa5e658859f5d233bdf53ad05d2392f8d4a /src | |
parent | 8dc33796371e1226bc2a53481e80cf0fd8142371 (diff) | |
download | mongo-e39598ae82e34f33f3ef29fd89801ce6cfb5270b.tar.gz |
SERVER-33286 Provide service context in Command::secondaryAllowed to allow getting interfaces without using global get function.
Diffstat (limited to 'src')
166 files changed, 251 insertions, 248 deletions
diff --git a/src/mongo/client/embedded/service_entry_point_embedded.cpp b/src/mongo/client/embedded/service_entry_point_embedded.cpp index f1a6065c191..817ed5a3008 100644 --- a/src/mongo/client/embedded/service_entry_point_embedded.cpp +++ b/src/mongo/client/embedded/service_entry_point_embedded.cpp @@ -570,7 +570,7 @@ void execCommandDatabase(OperationContext* opCtx, if (!opCtx->getClient()->isInDirectClient() && !MONGO_FAIL_POINT(skipCheckingForNotMasterInCommandDispatch)) { - auto allowed = command->secondaryAllowed(); + auto allowed = command->secondaryAllowed(opCtx->getServiceContext()); bool alwaysAllowed = allowed == Command::AllowedOnSecondary::kAlways; bool couldHaveOptedIn = allowed == Command::AllowedOnSecondary::kOptIn; bool optedIn = diff --git a/src/mongo/db/auth/sasl_commands.cpp b/src/mongo/db/auth/sasl_commands.cpp index 68ca51a83e5..f54fed2842a 100644 --- a/src/mongo/db/auth/sasl_commands.cpp +++ b/src/mongo/db/auth/sasl_commands.cpp @@ -81,7 +81,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool requiresAuth() const override { @@ -107,7 +107,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool requiresAuth() const override { diff --git a/src/mongo/db/command_can_run_here.cpp b/src/mongo/db/command_can_run_here.cpp index 083b200a4a1..12126ae328f 100644 --- a/src/mongo/db/command_can_run_here.cpp +++ b/src/mongo/db/command_can_run_here.cpp @@ -42,7 +42,7 @@ bool commandCanRunHere(OperationContext* opCtx, const std::string& dbname, const return true; // primary: always ok if (!opCtx->writesAreReplicated()) return true; // standalone: always ok - switch (command->secondaryAllowed()) { + switch (command->secondaryAllowed(opCtx->getServiceContext())) { case Command::AllowedOnSecondary::kAlways: return true; case Command::AllowedOnSecondary::kNever: diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index a6e2c24bbb5..8b2f40b05e9 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -267,7 +267,7 @@ public: return false; } - virtual AllowedOnSecondary secondaryAllowed() const = 0; + virtual AllowedOnSecondary secondaryAllowed(ServiceContext*) const = 0; /** * Override and return fales if the command opcounters should not be incremented on diff --git a/src/mongo/db/commands/apply_ops_cmd.cpp b/src/mongo/db/commands/apply_ops_cmd.cpp index 8f34bb2243e..e7dc2a5a6fa 100644 --- a/src/mongo/db/commands/apply_ops_cmd.cpp +++ b/src/mongo/db/commands/apply_ops_cmd.cpp @@ -202,7 +202,7 @@ class ApplyOpsCmd : public BasicCommand { public: ApplyOpsCmd() : BasicCommand("applyOps") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp index a9d39eda35d..121b1cf3aba 100644 --- a/src/mongo/db/commands/authentication_commands.cpp +++ b/src/mongo/db/commands/authentication_commands.cpp @@ -97,7 +97,7 @@ class CmdGetNonce : public BasicCommand { public: CmdGetNonce() : BasicCommand("getnonce"), _random(SecureRandom::create()) {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -259,7 +259,7 @@ CmdAuthenticate cmdAuthenticate; class CmdLogout : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual void addRequiredPrivileges(const std::string& dbname, diff --git a/src/mongo/db/commands/authentication_commands.h b/src/mongo/db/commands/authentication_commands.h index e04237ea91d..c2c74665eeb 100644 --- a/src/mongo/db/commands/authentication_commands.h +++ b/src/mongo/db/commands/authentication_commands.h @@ -40,7 +40,7 @@ class CmdAuthenticate : public BasicCommand { public: static void disableAuthMechanism(std::string authMechanism); - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } std::string help() const override { diff --git a/src/mongo/db/commands/clone.cpp b/src/mongo/db/commands/clone.cpp index e8f305b8b3b..4a2c06f3541 100644 --- a/src/mongo/db/commands/clone.cpp +++ b/src/mongo/db/commands/clone.cpp @@ -56,7 +56,7 @@ class CmdClone : public BasicCommand { public: CmdClone() : BasicCommand("clone") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp index 146aef53fcc..a77d1896459 100644 --- a/src/mongo/db/commands/clone_collection.cpp +++ b/src/mongo/db/commands/clone_collection.cpp @@ -63,7 +63,7 @@ class CmdCloneCollection : public ErrmsgCommandDeprecated { public: CmdCloneCollection() : ErrmsgCommandDeprecated("cloneCollection") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index 6f5929b6aae..d804b9230f5 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -52,7 +52,7 @@ using std::stringstream; class CmdCloneCollectionAsCapped : public ErrmsgCommandDeprecated { public: CmdCloneCollectionAsCapped() : ErrmsgCommandDeprecated("cloneCollectionAsCapped") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -151,7 +151,7 @@ public: class CmdConvertToCapped : public ErrmsgCommandDeprecated { public: CmdConvertToCapped() : ErrmsgCommandDeprecated("convertToCapped") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp index 4426d196e80..3b89886e3fd 100644 --- a/src/mongo/db/commands/compact.cpp +++ b/src/mongo/db/commands/compact.cpp @@ -61,7 +61,7 @@ public: virtual bool adminOnly() const { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool maintenanceMode() const { diff --git a/src/mongo/db/commands/conn_pool_stats.cpp b/src/mongo/db/commands/conn_pool_stats.cpp index d85c484dd22..cfa8def3f02 100644 --- a/src/mongo/db/commands/conn_pool_stats.cpp +++ b/src/mongo/db/commands/conn_pool_stats.cpp @@ -54,7 +54,7 @@ public: return "stats about connections between servers in a replica set or sharded cluster."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -127,7 +127,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/conn_pool_sync.cpp b/src/mongo/db/commands/conn_pool_sync.cpp index 12e279d15fa..31b92913572 100644 --- a/src/mongo/db/commands/conn_pool_sync.cpp +++ b/src/mongo/db/commands/conn_pool_sync.cpp @@ -47,7 +47,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp index 1b0ebef49e9..0d5a3f63980 100644 --- a/src/mongo/db/commands/connection_status.cpp +++ b/src/mongo/db/commands/connection_status.cpp @@ -41,7 +41,7 @@ using std::stringstream; class CmdConnectionStatus : public BasicCommand { public: CmdConnectionStatus() : BasicCommand("connectionStatus") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/copydb.cpp b/src/mongo/db/commands/copydb.cpp index 1681f1883a1..6e476977f87 100644 --- a/src/mongo/db/commands/copydb.cpp +++ b/src/mongo/db/commands/copydb.cpp @@ -95,7 +95,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/copydb_start_commands.cpp b/src/mongo/db/commands/copydb_start_commands.cpp index 1006c04600b..73a878d450b 100644 --- a/src/mongo/db/commands/copydb_start_commands.cpp +++ b/src/mongo/db/commands/copydb_start_commands.cpp @@ -78,7 +78,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp index 61b057fd645..655fdd1a0af 100644 --- a/src/mongo/db/commands/count_cmd.cpp +++ b/src/mongo/db/commands/count_cmd.cpp @@ -67,8 +67,8 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { - if (repl::getGlobalReplicationCoordinator()->getSettings().isSlave()) { + AllowedOnSecondary secondaryAllowed(ServiceContext* serviceContext) const override { + if (repl::ReplicationCoordinator::get(serviceContext)->getSettings().isSlave()) { // ok on --slave setups return Command::AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/cpuload.cpp b/src/mongo/db/commands/cpuload.cpp index 1b388967b32..caa7d3f5ed0 100644 --- a/src/mongo/db/commands/cpuload.cpp +++ b/src/mongo/db/commands/cpuload.cpp @@ -42,7 +42,7 @@ using std::stringstream; class CPULoadCommand : public BasicCommand { public: CPULoadCommand() : BasicCommand("cpuload") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool isWriteCommandForConfigServer() const { diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 81b424e574a..1a7e8f80681 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -216,7 +216,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/current_op_common.h b/src/mongo/db/commands/current_op_common.h index 367fb7f0ba8..9d08c6fcccd 100644 --- a/src/mongo/db/commands/current_op_common.h +++ b/src/mongo/db/commands/current_op_common.h @@ -51,7 +51,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp index e7411fb0962..08b062718d7 100644 --- a/src/mongo/db/commands/dbcheck.cpp +++ b/src/mongo/db/commands/dbcheck.cpp @@ -489,7 +489,7 @@ class DbCheckCmd : public BasicCommand { public: DbCheckCmd() : BasicCommand("dbCheck") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index ad3969c72f5..8be733393d9 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -143,7 +143,7 @@ public: std::string help() const override { return "drop (delete) this database"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -206,7 +206,7 @@ public: class CmdRepairDatabase : public ErrmsgCommandDeprecated { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool maintenanceMode() const { @@ -300,7 +300,7 @@ public: */ class CmdProfile : public ErrmsgCommandDeprecated { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -401,7 +401,7 @@ public: class CmdDrop : public ErrmsgCommandDeprecated { public: CmdDrop() : ErrmsgCommandDeprecated("drop") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool adminOnly() const { @@ -457,7 +457,7 @@ public: class CmdCreate : public BasicCommand { public: CmdCreate() : BasicCommand("create") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool adminOnly() const { @@ -574,7 +574,7 @@ class CmdFileMD5 : public BasicCommand { public: CmdFileMD5() : BasicCommand("filemd5") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -750,7 +750,7 @@ class CmdDatasize : public ErrmsgCommandDeprecated { public: CmdDatasize() : ErrmsgCommandDeprecated("dataSize", "datasize") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -900,7 +900,7 @@ class CollectionStats : public ErrmsgCommandDeprecated { public: CollectionStats() : ErrmsgCommandDeprecated("collStats", "collstats") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -947,7 +947,7 @@ class CollectionModCommand : public BasicCommand { public: CollectionModCommand() : BasicCommand("collMod") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -981,7 +981,7 @@ class DBStats : public ErrmsgCommandDeprecated { public: DBStats() : ErrmsgCommandDeprecated("dbStats", "dbstats") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -1077,7 +1077,7 @@ public: class CmdWhatsMyUri : public BasicCommand { public: CmdWhatsMyUri() : BasicCommand("whatsmyuri") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -1102,7 +1102,7 @@ class AvailableQueryOptions : public BasicCommand { public: AvailableQueryOptions() : BasicCommand("availableQueryOptions", "availablequeryoptions") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index 55d431b63f4..e1db0f7fd08 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -62,7 +62,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index 1a4902b6158..584f9b7c979 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -76,7 +76,7 @@ public: return "{ distinct : 'collection name' , key : 'a.b' , query : {} }"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/db/commands/do_txn_cmd.cpp b/src/mongo/db/commands/do_txn_cmd.cpp index 76b019c1b6f..b72b8ce85b0 100644 --- a/src/mongo/db/commands/do_txn_cmd.cpp +++ b/src/mongo/db/commands/do_txn_cmd.cpp @@ -131,7 +131,7 @@ class DoTxnCmd : public BasicCommand { public: DoTxnCmd() : BasicCommand("doTxn") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/driverHelpers.cpp b/src/mongo/db/commands/driverHelpers.cpp index f6788ce5915..532bc4fed7f 100644 --- a/src/mongo/db/commands/driverHelpers.cpp +++ b/src/mongo/db/commands/driverHelpers.cpp @@ -60,7 +60,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } }; diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp index 8c1b3e84204..2c97f3341bc 100644 --- a/src/mongo/db/commands/drop_indexes.cpp +++ b/src/mongo/db/commands/drop_indexes.cpp @@ -66,7 +66,7 @@ using std::vector; /* "dropIndexes" is now the preferred form - "deleteIndexes" deprecated */ class CmdDropIndexes : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -96,7 +96,7 @@ public: class CmdReIndex : public ErrmsgCommandDeprecated { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; // can reindex on a secondary } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/end_sessions_command.cpp b/src/mongo/db/commands/end_sessions_command.cpp index 032efaf0a67..d3d053b043b 100644 --- a/src/mongo/db/commands/end_sessions_command.cpp +++ b/src/mongo/db/commands/end_sessions_command.cpp @@ -44,7 +44,7 @@ class EndSessionsCommand final : public BasicCommand { public: EndSessionsCommand() : BasicCommand("endSessions") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/db/commands/eval.cpp b/src/mongo/db/commands/eval.cpp index 6d94aa40990..71a6026754b 100644 --- a/src/mongo/db/commands/eval.cpp +++ b/src/mongo/db/commands/eval.cpp @@ -154,7 +154,7 @@ bool dbEval(OperationContext* opCtx, class CmdEval : public ErrmsgCommandDeprecated { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp index a525ba4c0ce..89d43bddd48 100644 --- a/src/mongo/db/commands/explain_cmd.cpp +++ b/src/mongo/db/commands/explain_cmd.cpp @@ -63,7 +63,7 @@ public: /** * Running an explain on a secondary requires explicitly setting slaveOk. */ - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/db/commands/fail_point_cmd.cpp b/src/mongo/db/commands/fail_point_cmd.cpp index 6bef1019d0c..12f58504a76 100644 --- a/src/mongo/db/commands/fail_point_cmd.cpp +++ b/src/mongo/db/commands/fail_point_cmd.cpp @@ -68,7 +68,7 @@ class FaultInjectCmd : public ErrmsgCommandDeprecated { public: FaultInjectCmd() : ErrmsgCommandDeprecated("configureFailPoint") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index be9817a7b59..29b23b34b4a 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -216,7 +216,7 @@ public: "Output is in the \"value\" field\n"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 9c8e0875b64..dcff67f141f 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -69,7 +69,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index bc51b4d3d79..2d98610310a 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -102,7 +102,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool adminOnly() const { @@ -274,7 +274,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/generic.cpp b/src/mongo/db/commands/generic.cpp index 976a6e5f17a..570621bc9dc 100644 --- a/src/mongo/db/commands/generic.cpp +++ b/src/mongo/db/commands/generic.cpp @@ -74,7 +74,7 @@ class CmdBuildInfo : public BasicCommand { public: CmdBuildInfo() : BasicCommand("buildInfo", "buildinfo") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -107,7 +107,7 @@ class PingCommand : public BasicCommand { public: PingCommand() : BasicCommand("ping") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } std::string help() const override { @@ -141,7 +141,7 @@ public: std::string help() const override { return "return build level feature settings"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -173,7 +173,7 @@ class HostInfoCmd : public BasicCommand { public: HostInfoCmd() : BasicCommand("hostInfo") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -224,7 +224,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { @@ -258,7 +258,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool adminOnly() const { @@ -286,10 +286,13 @@ public: for (const auto& c : commands) { BSONObjBuilder temp(b.subobjStart(c->getName())); temp.append("help", c->help()); - temp.append("slaveOk", c->secondaryAllowed() == Command::AllowedOnSecondary::kAlways); + temp.append("slaveOk", + c->secondaryAllowed(opCtx->getServiceContext()) == + Command::AllowedOnSecondary::kAlways); temp.append("adminOnly", c->adminOnly()); // optionally indicates that the command can be forced to run on a slave/secondary - if (c->secondaryAllowed() == Command::AllowedOnSecondary::kOptIn) + if (c->secondaryAllowed(opCtx->getServiceContext()) == + Command::AllowedOnSecondary::kOptIn) temp.append("slaveOverrideOk", true); temp.done(); } @@ -304,7 +307,7 @@ class GetLogCmd : public ErrmsgCommandDeprecated { public: GetLogCmd() : ErrmsgCommandDeprecated("getLog") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -375,7 +378,7 @@ class ClearLogCmd : public BasicCommand { public: ClearLogCmd() : BasicCommand("clearLog") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -436,7 +439,7 @@ public: virtual bool adminOnly() const { return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual void addRequiredPrivileges(const std::string& dbname, diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp index 6001eef5786..51ee3c4c015 100644 --- a/src/mongo/db/commands/geo_near_cmd.cpp +++ b/src/mongo/db/commands/geo_near_cmd.cpp @@ -74,7 +74,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool supportsReadConcern(const std::string& dbName, diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp index 7828b3ecfdd..1957901b12b 100644 --- a/src/mongo/db/commands/get_last_error.cpp +++ b/src/mongo/db/commands/get_last_error.cpp @@ -60,7 +60,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual void addRequiredPrivileges(const std::string& dbname, @@ -90,7 +90,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual void addRequiredPrivileges(const std::string& dbname, @@ -313,7 +313,7 @@ public: std::string help() const override { return "check for errors since last reseterror commandcal"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool requiresAuth() const override { diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index 901eaea3306..8a45fa1ee3e 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -120,7 +120,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp index c9f6d8311b8..547dee36087 100644 --- a/src/mongo/db/commands/group_cmd.cpp +++ b/src/mongo/db/commands/group_cmd.cpp @@ -71,7 +71,7 @@ private: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/db/commands/hashcmd.cpp b/src/mongo/db/commands/hashcmd.cpp index 3339c48e2d1..709b6952e0f 100644 --- a/src/mongo/db/commands/hashcmd.cpp +++ b/src/mongo/db/commands/hashcmd.cpp @@ -56,7 +56,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } // No auth needed because it only works when enabled via command line. diff --git a/src/mongo/db/commands/haystack.cpp b/src/mongo/db/commands/haystack.cpp index c8fa1d279f3..695e8f90a6f 100644 --- a/src/mongo/db/commands/haystack.cpp +++ b/src/mongo/db/commands/haystack.cpp @@ -68,7 +68,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp index 2f2a4fa3863..75bc78be617 100644 --- a/src/mongo/db/commands/index_filter_commands.cpp +++ b/src/mongo/db/commands/index_filter_commands.cpp @@ -129,7 +129,7 @@ bool IndexFilterCommand::supportsWriteConcern(const BSONObj& cmd) const { return false; } -Command::AllowedOnSecondary IndexFilterCommand::secondaryAllowed() const { +Command::AllowedOnSecondary IndexFilterCommand::secondaryAllowed(ServiceContext*) const { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/db/commands/index_filter_commands.h b/src/mongo/db/commands/index_filter_commands.h index d947f198573..5bd2629945e 100644 --- a/src/mongo/db/commands/index_filter_commands.h +++ b/src/mongo/db/commands/index_filter_commands.h @@ -70,7 +70,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override; - AllowedOnSecondary secondaryAllowed() const override; + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override; std::string help() const override; diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp index b274a85e963..f0cb399a73a 100644 --- a/src/mongo/db/commands/isself.cpp +++ b/src/mongo/db/commands/isself.cpp @@ -42,7 +42,7 @@ using std::stringstream; class IsSelfCommand : public BasicCommand { public: IsSelfCommand() : BasicCommand("_isSelf") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp index 583e1a71e44..925695e9b2d 100644 --- a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp +++ b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp @@ -57,7 +57,7 @@ class KillAllSessionsByPatternCommand final : public BasicCommand { public: KillAllSessionsByPatternCommand() : BasicCommand("killAllSessionsByPattern") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/db/commands/kill_all_sessions_command.cpp b/src/mongo/db/commands/kill_all_sessions_command.cpp index 06d5d857fb2..624d3192968 100644 --- a/src/mongo/db/commands/kill_all_sessions_command.cpp +++ b/src/mongo/db/commands/kill_all_sessions_command.cpp @@ -57,7 +57,7 @@ class KillAllSessionsCommand final : public BasicCommand { public: KillAllSessionsCommand() : BasicCommand("killAllSessions") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/db/commands/kill_op.cpp b/src/mongo/db/commands/kill_op.cpp index 61be46cbf9b..e6278064654 100644 --- a/src/mongo/db/commands/kill_op.cpp +++ b/src/mongo/db/commands/kill_op.cpp @@ -55,7 +55,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/kill_sessions_command.cpp b/src/mongo/db/commands/kill_sessions_command.cpp index 3a4e5f08c9f..2afcc1588d4 100644 --- a/src/mongo/db/commands/kill_sessions_command.cpp +++ b/src/mongo/db/commands/kill_sessions_command.cpp @@ -84,7 +84,7 @@ class KillSessionsCommand final : public BasicCommand { public: KillSessionsCommand() : BasicCommand("killSessions") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/db/commands/killcursors_common.h b/src/mongo/db/commands/killcursors_common.h index ce8d8e30141..9816296142e 100644 --- a/src/mongo/db/commands/killcursors_common.h +++ b/src/mongo/db/commands/killcursors_common.h @@ -45,7 +45,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp index fcc11f66297..035ea4c6271 100644 --- a/src/mongo/db/commands/list_collections.cpp +++ b/src/mongo/db/commands/list_collections.cpp @@ -197,7 +197,7 @@ BSONObj buildCollectionBson(OperationContext* opCtx, class CmdListCollections : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } virtual bool adminOnly() const { diff --git a/src/mongo/db/commands/list_databases.cpp b/src/mongo/db/commands/list_databases.cpp index 692a3c49d91..271d5433196 100644 --- a/src/mongo/db/commands/list_databases.cpp +++ b/src/mongo/db/commands/list_databases.cpp @@ -57,7 +57,7 @@ intmax_t dbSize(const string& database); class CmdListDatabases : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kOptIn; } bool adminOnly() const final { diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp index cad5073ffe3..d0e2d40461c 100644 --- a/src/mongo/db/commands/list_indexes.cpp +++ b/src/mongo/db/commands/list_indexes.cpp @@ -76,7 +76,7 @@ namespace { */ class CmdListIndexes : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } virtual bool adminOnly() const { diff --git a/src/mongo/db/commands/lock_info.cpp b/src/mongo/db/commands/lock_info.cpp index 437813b2447..09a993bd0ea 100644 --- a/src/mongo/db/commands/lock_info.cpp +++ b/src/mongo/db/commands/lock_info.cpp @@ -49,7 +49,7 @@ using std::stringstream; */ class CmdLockInfo : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 49e47dcbb2f..adbafea653f 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1351,8 +1351,8 @@ class MapReduceCommand : public ErrmsgCommandDeprecated { public: MapReduceCommand() : ErrmsgCommandDeprecated("mapReduce", "mapreduce") {} - AllowedOnSecondary secondaryAllowed() const override { - if (repl::getGlobalReplicationCoordinator()->getReplicationMode() != + AllowedOnSecondary secondaryAllowed(ServiceContext* serviceContext) const override { + if (repl::ReplicationCoordinator::get(serviceContext)->getReplicationMode() != repl::ReplicationCoordinator::modeReplSet) { return AllowedOnSecondary::kAlways; } @@ -1689,8 +1689,8 @@ public: } MapReduceFinishCommand() : BasicCommand("mapreduce.shardedfinish") {} - AllowedOnSecondary secondaryAllowed() const override { - if (repl::getGlobalReplicationCoordinator()->getReplicationMode() != + AllowedOnSecondary secondaryAllowed(ServiceContext* serviceContext) const override { + if (repl::ReplicationCoordinator::get(serviceContext)->getReplicationMode() != repl::ReplicationCoordinator::modeReplSet) { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index 109a562b2a7..0cc7afac12b 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -87,7 +87,7 @@ class AppendOplogNoteCmd : public BasicCommand { public: AppendOplogNoteCmd() : BasicCommand("appendOplogNote") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index 7df60e020a7..157171627d9 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -57,7 +57,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp index d46bb62cc23..0be2615489b 100644 --- a/src/mongo/db/commands/parameters.cpp +++ b/src/mongo/db/commands/parameters.cpp @@ -67,7 +67,7 @@ void appendParameterNames(std::string* help) { class CmdGet : public ErrmsgCommandDeprecated { public: CmdGet() : ErrmsgCommandDeprecated("getParameter") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool adminOnly() const { @@ -118,7 +118,7 @@ public: class CmdSet : public ErrmsgCommandDeprecated { public: CmdSet() : ErrmsgCommandDeprecated("setParameter") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool adminOnly() const { diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 90a9c5f1852..32ede313ee5 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -57,7 +57,7 @@ public: return Pipeline::aggSupportsWriteConcern(cmd); } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp index db7cb438d79..e5a5c193368 100644 --- a/src/mongo/db/commands/plan_cache_commands.cpp +++ b/src/mongo/db/commands/plan_cache_commands.cpp @@ -124,7 +124,7 @@ bool PlanCacheCommand::supportsWriteConcern(const BSONObj& cmd) const { return false; } -Command::AllowedOnSecondary PlanCacheCommand::secondaryAllowed() const { +Command::AllowedOnSecondary PlanCacheCommand::secondaryAllowed(ServiceContext*) const { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/db/commands/plan_cache_commands.h b/src/mongo/db/commands/plan_cache_commands.h index 993c3714c93..cea93d5704e 100644 --- a/src/mongo/db/commands/plan_cache_commands.h +++ b/src/mongo/db/commands/plan_cache_commands.h @@ -64,7 +64,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override; - AllowedOnSecondary secondaryAllowed() const override; + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override; std::string help() const override; diff --git a/src/mongo/db/commands/reap_logical_session_cache_now.cpp b/src/mongo/db/commands/reap_logical_session_cache_now.cpp index e17d961c4f7..062a5e85294 100644 --- a/src/mongo/db/commands/reap_logical_session_cache_now.cpp +++ b/src/mongo/db/commands/reap_logical_session_cache_now.cpp @@ -44,7 +44,7 @@ class ReapLogicalSessionCacheNowCommand final : public BasicCommand { public: ReapLogicalSessionCacheNowCommand() : BasicCommand("reapLogicalSessionCacheNow") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/refresh_logical_session_cache_now.cpp b/src/mongo/db/commands/refresh_logical_session_cache_now.cpp index 19004e92b61..50d99e16193 100644 --- a/src/mongo/db/commands/refresh_logical_session_cache_now.cpp +++ b/src/mongo/db/commands/refresh_logical_session_cache_now.cpp @@ -45,7 +45,7 @@ class RefreshLogicalSessionCacheNowCommand final : public BasicCommand { public: RefreshLogicalSessionCacheNowCommand() : BasicCommand("refreshLogicalSessionCacheNow") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/refresh_sessions_command.cpp b/src/mongo/db/commands/refresh_sessions_command.cpp index 699f66b2ef3..09882f10fe7 100644 --- a/src/mongo/db/commands/refresh_sessions_command.cpp +++ b/src/mongo/db/commands/refresh_sessions_command.cpp @@ -46,7 +46,7 @@ class RefreshSessionsCommand final : public BasicCommand { public: RefreshSessionsCommand() : BasicCommand("refreshSessions") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/db/commands/refresh_sessions_command_internal.cpp b/src/mongo/db/commands/refresh_sessions_command_internal.cpp index 5cb63de9ee7..8f942feb1c4 100644 --- a/src/mongo/db/commands/refresh_sessions_command_internal.cpp +++ b/src/mongo/db/commands/refresh_sessions_command_internal.cpp @@ -46,7 +46,7 @@ class RefreshSessionsCommandInternal final : public BasicCommand { public: RefreshSessionsCommandInternal() : BasicCommand("refreshSessionsInternal") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/db/commands/rename_collection_cmd.cpp b/src/mongo/db/commands/rename_collection_cmd.cpp index c0946c041fd..62764fe5cb4 100644 --- a/src/mongo/db/commands/rename_collection_cmd.cpp +++ b/src/mongo/db/commands/rename_collection_cmd.cpp @@ -62,7 +62,7 @@ public: virtual bool adminOnly() const { return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp index cc895825d96..4234a0d91d6 100644 --- a/src/mongo/db/commands/repair_cursor.cpp +++ b/src/mongo/db/commands/repair_cursor.cpp @@ -52,7 +52,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/resize_oplog.cpp b/src/mongo/db/commands/resize_oplog.cpp index 1e945fa1371..d82c4321695 100644 --- a/src/mongo/db/commands/resize_oplog.cpp +++ b/src/mongo/db/commands/resize_oplog.cpp @@ -54,7 +54,7 @@ class CmdReplSetResizeOplog : public BasicCommand { public: CmdReplSetResizeOplog() : BasicCommand("replSetResizeOplog") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/restart_catalog_command.cpp b/src/mongo/db/commands/restart_catalog_command.cpp index 66ada18d755..bdcc0eddddb 100644 --- a/src/mongo/db/commands/restart_catalog_command.cpp +++ b/src/mongo/db/commands/restart_catalog_command.cpp @@ -66,7 +66,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp index bb0ac579478..041c4e31ab6 100644 --- a/src/mongo/db/commands/server_status.cpp +++ b/src/mongo/db/commands/server_status.cpp @@ -72,7 +72,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool allowsAfterClusterTime(const BSONObj& cmdObj) const override { diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp index cfce4a4967b..ca26df5dcff 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -69,7 +69,7 @@ public: SetFeatureCompatibilityVersionCommand() : BasicCommand(FeatureCompatibilityVersion::kCommandName) {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/shutdown.h b/src/mongo/db/commands/shutdown.h index ff6e3c99443..3cc492b2649 100644 --- a/src/mongo/db/commands/shutdown.h +++ b/src/mongo/db/commands/shutdown.h @@ -48,7 +48,7 @@ public: bool localHostOnlyIfNoAuth() const override { return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual void addRequiredPrivileges(const std::string& dbname, diff --git a/src/mongo/db/commands/snapshot_management.cpp b/src/mongo/db/commands/snapshot_management.cpp index e6e23fc54dd..2614325b6b1 100644 --- a/src/mongo/db/commands/snapshot_management.cpp +++ b/src/mongo/db/commands/snapshot_management.cpp @@ -44,7 +44,7 @@ class CmdMakeSnapshot final : public BasicCommand { public: CmdMakeSnapshot() : BasicCommand("makeSnapshot") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -92,7 +92,7 @@ class CmdSetCommittedSnapshot final : public BasicCommand { public: CmdSetCommittedSnapshot() : BasicCommand("setCommittedSnapshot") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/start_session_command.cpp b/src/mongo/db/commands/start_session_command.cpp index 433831be3fc..710a01d1fb7 100644 --- a/src/mongo/db/commands/start_session_command.cpp +++ b/src/mongo/db/commands/start_session_command.cpp @@ -51,7 +51,7 @@ class StartSessionCommand final : public BasicCommand { public: StartSessionCommand() : BasicCommand("startSession") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index 380804916e0..fc3f8c467d7 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -62,7 +62,7 @@ public: virtual bool adminOnly() const { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -118,7 +118,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -201,7 +201,7 @@ public: class CapTrunc : public BasicCommand { public: CapTrunc() : BasicCommand("captrunc") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -276,7 +276,7 @@ public: class EmptyCapped : public BasicCommand { public: EmptyCapped() : BasicCommand("emptycapped") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/db/commands/top_command.cpp b/src/mongo/db/commands/top_command.cpp index 484c105b7a2..95643f25916 100644 --- a/src/mongo/db/commands/top_command.cpp +++ b/src/mongo/db/commands/top_command.cpp @@ -46,7 +46,7 @@ class TopCommand : public BasicCommand { public: TopCommand() : BasicCommand("top") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool adminOnly() const { diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp index 0459570129f..bde76e8ceff 100644 --- a/src/mongo/db/commands/touch.cpp +++ b/src/mongo/db/commands/touch.cpp @@ -61,7 +61,7 @@ public: virtual bool adminOnly() const { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool maintenanceMode() const { diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index 4bc7275194b..480a36df544 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -611,7 +611,7 @@ class CmdCreateUser : public BasicCommand { public: CmdCreateUser() : BasicCommand("createUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -758,7 +758,7 @@ class CmdUpdateUser : public BasicCommand { public: CmdUpdateUser() : BasicCommand("updateUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -892,7 +892,7 @@ class CmdDropUser : public BasicCommand { public: CmdDropUser() : BasicCommand("dropUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -959,7 +959,7 @@ class CmdDropAllUsersFromDatabase : public BasicCommand { public: CmdDropAllUsersFromDatabase() : BasicCommand("dropAllUsersFromDatabase") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1015,7 +1015,7 @@ class CmdGrantRolesToUser : public BasicCommand { public: CmdGrantRolesToUser() : BasicCommand("grantRolesToUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1087,7 +1087,7 @@ class CmdRevokeRolesFromUser : public BasicCommand { public: CmdRevokeRolesFromUser() : BasicCommand("revokeRolesFromUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1157,7 +1157,7 @@ public: class CmdUsersInfo : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } @@ -1281,7 +1281,7 @@ class CmdCreateRole : public BasicCommand { public: CmdCreateRole() : BasicCommand("createRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1402,7 +1402,7 @@ class CmdUpdateRole : public BasicCommand { public: CmdUpdateRole() : BasicCommand("updateRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1519,7 +1519,7 @@ class CmdGrantPrivilegesToRole : public BasicCommand { public: CmdGrantPrivilegesToRole() : BasicCommand("grantPrivilegesToRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1629,7 +1629,7 @@ class CmdRevokePrivilegesFromRole : public BasicCommand { public: CmdRevokePrivilegesFromRole() : BasicCommand("revokePrivilegesFromRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1741,7 +1741,7 @@ class CmdGrantRolesToRole : public BasicCommand { public: CmdGrantRolesToRole() : BasicCommand("grantRolesToRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1830,7 +1830,7 @@ class CmdRevokeRolesFromRole : public BasicCommand { public: CmdRevokeRolesFromRole() : BasicCommand("revokeRolesFromRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -1914,7 +1914,7 @@ class CmdDropRole : public BasicCommand { public: CmdDropRole() : BasicCommand("dropRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -2056,7 +2056,7 @@ class CmdDropAllRolesFromDatabase : public BasicCommand { public: CmdDropAllRolesFromDatabase() : BasicCommand("dropAllRolesFromDatabase") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -2187,7 +2187,7 @@ public: class CmdRolesInfo : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } @@ -2272,7 +2272,7 @@ public: class CmdInvalidateUserCache : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -2309,7 +2309,7 @@ public: class CmdGetCacheGeneration : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -2358,7 +2358,7 @@ class CmdMergeAuthzCollections : public BasicCommand { public: CmdMergeAuthzCollections() : BasicCommand("_mergeAuthzCollections") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index 4f9ad0a507d..7e021018029 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -67,7 +67,7 @@ class ValidateCmd : public BasicCommand { public: ValidateCmd() : BasicCommand("validate") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp index 474c4e7e350..428fb40b7e2 100644 --- a/src/mongo/db/commands/write_commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands/write_commands.cpp @@ -198,7 +198,7 @@ class WriteCommand : public Command { public: explicit WriteCommand(StringData name) : Command(name) {} - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp index 596cd6f71c8..92b9908f2a3 100644 --- a/src/mongo/db/exec/stagedebug_cmd.cpp +++ b/src/mongo/db/exec/stagedebug_cmd.cpp @@ -123,7 +123,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } std::string help() const override { diff --git a/src/mongo/db/ftdc/ftdc_commands.cpp b/src/mongo/db/ftdc/ftdc_commands.cpp index 24de1e13625..cd09a75e46f 100644 --- a/src/mongo/db/ftdc/ftdc_commands.cpp +++ b/src/mongo/db/ftdc/ftdc_commands.cpp @@ -57,7 +57,7 @@ public: return "get latest diagnostic data collection snapshot"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp index a427371910a..c5086061412 100644 --- a/src/mongo/db/repl/master_slave.cpp +++ b/src/mongo/db/repl/master_slave.cpp @@ -368,7 +368,7 @@ public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool adminOnly() const { diff --git a/src/mongo/db/repl/repl_set_command.h b/src/mongo/db/repl/repl_set_command.h index 32548addf87..8e0ce47fe09 100644 --- a/src/mongo/db/repl/repl_set_command.h +++ b/src/mongo/db/repl/repl_set_command.h @@ -47,7 +47,7 @@ class ReplSetCommand : public BasicCommand { protected: ReplSetCommand(const char* s) : BasicCommand(s) {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index 076c7e04a7c..91c1251c96f 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -217,7 +217,7 @@ public: bool requiresAuth() const override { return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } std::string help() const override { diff --git a/src/mongo/db/repl/resync.cpp b/src/mongo/db/repl/resync.cpp index debaed421ce..cff397f8589 100644 --- a/src/mongo/db/repl/resync.cpp +++ b/src/mongo/db/repl/resync.cpp @@ -49,7 +49,7 @@ constexpr StringData kWaitFieldName = "wait"_sd; // operator requested resynchronization of replication (on a slave or secondary). {resync: 1} class CmdResync : public ErrmsgCommandDeprecated { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool adminOnly() const { diff --git a/src/mongo/db/s/check_sharding_index_command.cpp b/src/mongo/db/s/check_sharding_index_command.cpp index 0089534af51..dac697a10af 100644 --- a/src/mongo/db/s/check_sharding_index_command.cpp +++ b/src/mongo/db/s/check_sharding_index_command.cpp @@ -67,7 +67,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/cleanup_orphaned_cmd.cpp b/src/mongo/db/s/cleanup_orphaned_cmd.cpp index 7ef5f7b6408..df805c696b6 100644 --- a/src/mongo/db/s/cleanup_orphaned_cmd.cpp +++ b/src/mongo/db/s/cleanup_orphaned_cmd.cpp @@ -164,7 +164,7 @@ class CleanupOrphanedCommand : public ErrmsgCommandDeprecated { public: CleanupOrphanedCommand() : ErrmsgCommandDeprecated("cleanupOrphaned") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_add_shard_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_command.cpp index 7d556199fbb..0b8b39bab93 100644 --- a/src/mongo/db/s/config/configsvr_add_shard_command.cpp +++ b/src/mongo/db/s/config/configsvr_add_shard_command.cpp @@ -65,7 +65,7 @@ public: "directly. Validates and adds a new shard to the cluster."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp index a9dc9828f46..726621d712f 100644 --- a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp +++ b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp @@ -65,7 +65,7 @@ public: "directly. Validates and adds a new zone to the shard."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp index a9c0fc3d313..28119fe682e 100644 --- a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp +++ b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp @@ -91,7 +91,7 @@ public: return "should not be calling this directly"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp index 958a86bb2ee..dec9602587d 100644 --- a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp +++ b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp @@ -50,7 +50,7 @@ public: "directly. Controls the balancer state."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_create_collection_command.cpp b/src/mongo/db/s/config/configsvr_create_collection_command.cpp index 41a87ddd31f..1e733dfda54 100644 --- a/src/mongo/db/s/config/configsvr_create_collection_command.cpp +++ b/src/mongo/db/s/config/configsvr_create_collection_command.cpp @@ -60,7 +60,7 @@ class ConfigSvrCreateCollectionCommand : public BasicCommand { public: ConfigSvrCreateCollectionCommand() : BasicCommand("_configsvrCreateCollection") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_create_database_command.cpp b/src/mongo/db/s/config/configsvr_create_database_command.cpp index 8bcd4017f36..56c429783d9 100644 --- a/src/mongo/db/s/config/configsvr_create_database_command.cpp +++ b/src/mongo/db/s/config/configsvr_create_database_command.cpp @@ -63,7 +63,7 @@ class ConfigSvrCreateDatabaseCommand : public BasicCommand { public: ConfigSvrCreateDatabaseCommand() : BasicCommand("_configsvrCreateDatabase") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_drop_collection_command.cpp b/src/mongo/db/s/config/configsvr_drop_collection_command.cpp index 0c426950824..a4b12e6f78a 100644 --- a/src/mongo/db/s/config/configsvr_drop_collection_command.cpp +++ b/src/mongo/db/s/config/configsvr_drop_collection_command.cpp @@ -58,7 +58,7 @@ class ConfigSvrDropCollectionCommand : public BasicCommand { public: ConfigSvrDropCollectionCommand() : BasicCommand("_configsvrDropCollection") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_drop_database_command.cpp b/src/mongo/db/s/config/configsvr_drop_database_command.cpp index 4ad5e4dad1a..5bc1f6d8b49 100644 --- a/src/mongo/db/s/config/configsvr_drop_database_command.cpp +++ b/src/mongo/db/s/config/configsvr_drop_database_command.cpp @@ -52,7 +52,7 @@ class ConfigSvrDropDatabaseCommand : public BasicCommand { public: ConfigSvrDropDatabaseCommand() : BasicCommand("_configsvrDropDatabase") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_enable_sharding_command.cpp b/src/mongo/db/s/config/configsvr_enable_sharding_command.cpp index 844f642128c..b76a317736d 100644 --- a/src/mongo/db/s/config/configsvr_enable_sharding_command.cpp +++ b/src/mongo/db/s/config/configsvr_enable_sharding_command.cpp @@ -61,7 +61,7 @@ class ConfigSvrEnableShardingCommand : public BasicCommand { public: ConfigSvrEnableShardingCommand() : BasicCommand("_configsvrEnableSharding") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp b/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp index c0c78d284cc..74d11ef2eb5 100644 --- a/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp +++ b/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp @@ -72,7 +72,7 @@ public: "not call directly. Receives, validates, and processes a MergeChunkRequest"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_move_chunk_command.cpp b/src/mongo/db/s/config/configsvr_move_chunk_command.cpp index 09927779459..d2ad3c05399 100644 --- a/src/mongo/db/s/config/configsvr_move_chunk_command.cpp +++ b/src/mongo/db/s/config/configsvr_move_chunk_command.cpp @@ -56,7 +56,7 @@ public: "directly. Requests the balancer to move or rebalance a single chunk."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_move_primary_command.cpp b/src/mongo/db/s/config/configsvr_move_primary_command.cpp index d74dba381ae..4389584d922 100644 --- a/src/mongo/db/s/config/configsvr_move_primary_command.cpp +++ b/src/mongo/db/s/config/configsvr_move_primary_command.cpp @@ -64,7 +64,7 @@ class ConfigSvrMovePrimaryCommand : public BasicCommand { public: ConfigSvrMovePrimaryCommand() : BasicCommand("_configsvrMovePrimary") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_remove_shard_command.cpp b/src/mongo/db/s/config/configsvr_remove_shard_command.cpp index 9c9484fd052..2ce5145b355 100644 --- a/src/mongo/db/s/config/configsvr_remove_shard_command.cpp +++ b/src/mongo/db/s/config/configsvr_remove_shard_command.cpp @@ -62,7 +62,7 @@ public: "directly. Removes a shard from the cluster."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp index 4a2037ae000..b25854b9a14 100644 --- a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp +++ b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp @@ -65,7 +65,7 @@ public: "directly. Validates and removes the shard from the zone."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp index 19db3563b45..1ad8459f3f1 100644 --- a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp +++ b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp @@ -706,7 +706,7 @@ public: return Status::OK(); } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp index d35e974a4a6..fe3a6824087 100644 --- a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp +++ b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp @@ -70,7 +70,7 @@ public: "not call directly. Receives, validates, and processes a SplitChunkRequest."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp index 1c468e2b5cb..579e1518b83 100644 --- a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp +++ b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp @@ -67,7 +67,7 @@ public: "directly. Validates and assigns a new range to a zone."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp b/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp index e99aebb5576..8697e1331b1 100644 --- a/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp +++ b/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp @@ -70,7 +70,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/get_shard_version_command.cpp b/src/mongo/db/s/get_shard_version_command.cpp index 73607a65add..5ccb531efea 100644 --- a/src/mongo/db/s/get_shard_version_command.cpp +++ b/src/mongo/db/s/get_shard_version_command.cpp @@ -58,7 +58,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/merge_chunks_command.cpp b/src/mongo/db/s/merge_chunks_command.cpp index 2c9d8b7db43..9e80c2d2341 100644 --- a/src/mongo/db/s/merge_chunks_command.cpp +++ b/src/mongo/db/s/merge_chunks_command.cpp @@ -333,7 +333,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp index ae29f3775ca..dcf921e37ee 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp @@ -125,7 +125,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -187,7 +187,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -236,7 +236,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp index ac7dd9bc0f1..0defbe9aa31 100644 --- a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp +++ b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp @@ -56,7 +56,7 @@ public: return "internal"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -156,7 +156,7 @@ public: return "internal"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -195,7 +195,7 @@ public: return "internal"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -241,7 +241,7 @@ public: return "internal"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/move_chunk_command.cpp b/src/mongo/db/s/move_chunk_command.cpp index c707bacac6c..37fdf0065f3 100644 --- a/src/mongo/db/s/move_chunk_command.cpp +++ b/src/mongo/db/s/move_chunk_command.cpp @@ -80,7 +80,7 @@ public: return "should not be calling this directly"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/set_shard_version_command.cpp b/src/mongo/db/s/set_shard_version_command.cpp index 529cb952232..ca5fa09c555 100644 --- a/src/mongo/db/s/set_shard_version_command.cpp +++ b/src/mongo/db/s/set_shard_version_command.cpp @@ -70,7 +70,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/s/sharding_state_command.cpp b/src/mongo/db/s/sharding_state_command.cpp index 21c0b5dc864..f22986f7a71 100644 --- a/src/mongo/db/s/sharding_state_command.cpp +++ b/src/mongo/db/s/sharding_state_command.cpp @@ -48,7 +48,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/s/split_chunk_command.cpp b/src/mongo/db/s/split_chunk_command.cpp index 0b463c9b490..f38eae9b314 100644 --- a/src/mongo/db/s/split_chunk_command.cpp +++ b/src/mongo/db/s/split_chunk_command.cpp @@ -68,7 +68,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/split_vector_command.cpp b/src/mongo/db/s/split_vector_command.cpp index 5eefe80a871..313978eef5b 100644 --- a/src/mongo/db/s/split_vector_command.cpp +++ b/src/mongo/db/s/split_vector_command.cpp @@ -49,7 +49,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/db/s/unset_sharding_command.cpp b/src/mongo/db/s/unset_sharding_command.cpp index e2a65b9baec..d1e0927330f 100644 --- a/src/mongo/db/s/unset_sharding_command.cpp +++ b/src/mongo/db/s/unset_sharding_command.cpp @@ -60,7 +60,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index 9dd7f9f8771..a4134a16d42 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -595,7 +595,7 @@ void execCommandDatabase(OperationContext* opCtx, if (!opCtx->getClient()->isInDirectClient() && !MONGO_FAIL_POINT(skipCheckingForNotMasterInCommandDispatch)) { - auto allowed = command->secondaryAllowed(); + auto allowed = command->secondaryAllowed(opCtx->getServiceContext()); bool alwaysAllowed = allowed == Command::AllowedOnSecondary::kAlways; bool couldHaveOptedIn = allowed == Command::AllowedOnSecondary::kOptIn; bool optedIn = diff --git a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp index 90d9b1cbb5e..71ea31abe12 100644 --- a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp +++ b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp @@ -68,7 +68,7 @@ class JournalLatencyTestCmd : public BasicCommand { public: JournalLatencyTestCmd() : BasicCommand("journalLatencyTest") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/s/commands/cluster_add_shard_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_cmd.cpp index 833cc8c7bf2..8a3abf08b81 100644 --- a/src/mongo/s/commands/cluster_add_shard_cmd.cpp +++ b/src/mongo/s/commands/cluster_add_shard_cmd.cpp @@ -47,7 +47,7 @@ class AddShardCmd : public BasicCommand { public: AddShardCmd() : BasicCommand("addShard", "addshard") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp index d4d7939df01..8bd17b2f011 100644 --- a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp +++ b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp @@ -62,7 +62,7 @@ class AddShardToZoneCmd : public BasicCommand { public: AddShardToZoneCmd() : BasicCommand("addShardToZone", "addshardtozone") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_available_query_options_cmd.cpp b/src/mongo/s/commands/cluster_available_query_options_cmd.cpp index f709922b6f2..73e333e9396 100644 --- a/src/mongo/s/commands/cluster_available_query_options_cmd.cpp +++ b/src/mongo/s/commands/cluster_available_query_options_cmd.cpp @@ -39,7 +39,7 @@ class AvailableQueryOptions : public BasicCommand { public: AvailableQueryOptions() : BasicCommand("availableQueryOptions", "availablequeryoptions") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_compact_cmd.cpp b/src/mongo/s/commands/cluster_compact_cmd.cpp index 83ec78e1ece..1dc60eb6665 100644 --- a/src/mongo/s/commands/cluster_compact_cmd.cpp +++ b/src/mongo/s/commands/cluster_compact_cmd.cpp @@ -37,7 +37,7 @@ class CompactCmd : public BasicCommand { public: CompactCmd() : BasicCommand("compact") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_control_balancer_cmd.cpp b/src/mongo/s/commands/cluster_control_balancer_cmd.cpp index 749a69d21bb..b361d2a839d 100644 --- a/src/mongo/s/commands/cluster_control_balancer_cmd.cpp +++ b/src/mongo/s/commands/cluster_control_balancer_cmd.cpp @@ -50,7 +50,7 @@ public: _configsvrCommandName(configsvrCommandName), _authorizationAction(authorizationAction) {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/s/commands/cluster_count_cmd.cpp b/src/mongo/s/commands/cluster_count_cmd.cpp index 1ba8e3d7c1b..794cf1d9fb3 100644 --- a/src/mongo/s/commands/cluster_count_cmd.cpp +++ b/src/mongo/s/commands/cluster_count_cmd.cpp @@ -51,7 +51,7 @@ class ClusterCountCmd : public ErrmsgCommandDeprecated { public: ClusterCountCmd() : ErrmsgCommandDeprecated("count") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_db_stats_cmd.cpp b/src/mongo/s/commands/cluster_db_stats_cmd.cpp index 62fb611df40..60fd362fdb9 100644 --- a/src/mongo/s/commands/cluster_db_stats_cmd.cpp +++ b/src/mongo/s/commands/cluster_db_stats_cmd.cpp @@ -44,7 +44,7 @@ class DBStatsCmd : public ErrmsgCommandDeprecated { public: DBStatsCmd() : ErrmsgCommandDeprecated("dbStats", "dbstats") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/s/commands/cluster_drop_cmd.cpp b/src/mongo/s/commands/cluster_drop_cmd.cpp index 017876f8206..6d4214bd6d8 100644 --- a/src/mongo/s/commands/cluster_drop_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_cmd.cpp @@ -45,7 +45,7 @@ class DropCmd : public BasicCommand { public: DropCmd() : BasicCommand("drop") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_drop_database_cmd.cpp b/src/mongo/s/commands/cluster_drop_database_cmd.cpp index 4ba30e411ca..18d42ba715f 100644 --- a/src/mongo/s/commands/cluster_drop_database_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_database_cmd.cpp @@ -46,7 +46,7 @@ class DropDatabaseCmd : public BasicCommand { public: DropDatabaseCmd() : BasicCommand("dropDatabase") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp index c1ecf49fc56..5ef7ce53a37 100644 --- a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp +++ b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp @@ -48,7 +48,7 @@ class EnableShardingCmd : public ErrmsgCommandDeprecated { public: EnableShardingCmd() : ErrmsgCommandDeprecated("enableSharding", "enablesharding") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_explain_cmd.cpp b/src/mongo/s/commands/cluster_explain_cmd.cpp index 3a6f4d254f2..058beee615c 100644 --- a/src/mongo/s/commands/cluster_explain_cmd.cpp +++ b/src/mongo/s/commands/cluster_explain_cmd.cpp @@ -61,7 +61,7 @@ public: /** * Running an explain on a secondary requires explicitly setting slaveOk. */ - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp index 90c2c2e08c8..8a6799d8264 100644 --- a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp @@ -78,7 +78,7 @@ class FindAndModifyCmd : public BasicCommand { public: FindAndModifyCmd() : BasicCommand("findAndModify", "findandmodify") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp index 4c3b343eba3..65e26656b33 100644 --- a/src/mongo/s/commands/cluster_find_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_cmd.cpp @@ -65,7 +65,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp b/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp index af1bdb31d44..3142fd7f04b 100644 --- a/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp +++ b/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp @@ -39,7 +39,7 @@ class FlushRouterConfigCmd : public BasicCommand { public: FlushRouterConfigCmd() : BasicCommand("flushRouterConfig", "flushrouterconfig") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_fsync_cmd.cpp b/src/mongo/s/commands/cluster_fsync_cmd.cpp index 3dd7ec1a1fc..ecb4297c1d2 100644 --- a/src/mongo/s/commands/cluster_fsync_cmd.cpp +++ b/src/mongo/s/commands/cluster_fsync_cmd.cpp @@ -42,7 +42,7 @@ class FsyncCommand : public ErrmsgCommandDeprecated { public: FsyncCommand() : ErrmsgCommandDeprecated("fsync") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_ftdc_commands.cpp b/src/mongo/s/commands/cluster_ftdc_commands.cpp index 5fd60d315b7..4f21695fb71 100644 --- a/src/mongo/s/commands/cluster_ftdc_commands.cpp +++ b/src/mongo/s/commands/cluster_ftdc_commands.cpp @@ -56,7 +56,7 @@ public: return "get latest diagnostic data collection snapshot"; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_get_last_error_cmd.cpp b/src/mongo/s/commands/cluster_get_last_error_cmd.cpp index d1f927d22fe..f1e00de2930 100644 --- a/src/mongo/s/commands/cluster_get_last_error_cmd.cpp +++ b/src/mongo/s/commands/cluster_get_last_error_cmd.cpp @@ -195,7 +195,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp b/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp index a6ca81416a4..8f2c9e23c0d 100644 --- a/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp +++ b/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp @@ -41,7 +41,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp b/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp index 5703727bb77..8e5d5d6cbf5 100644 --- a/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp +++ b/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp @@ -47,7 +47,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp index 589398e86b6..09ea16218e1 100644 --- a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp +++ b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp @@ -48,7 +48,7 @@ class GetShardVersion : public BasicCommand { public: GetShardVersion() : BasicCommand("getShardVersion", "getshardversion") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_getmore_cmd.cpp b/src/mongo/s/commands/cluster_getmore_cmd.cpp index 111f927a0e6..337e6cab708 100644 --- a/src/mongo/s/commands/cluster_getmore_cmd.cpp +++ b/src/mongo/s/commands/cluster_getmore_cmd.cpp @@ -55,7 +55,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_index_filter_cmd.cpp b/src/mongo/s/commands/cluster_index_filter_cmd.cpp index 6f632610f06..11c327f9900 100644 --- a/src/mongo/s/commands/cluster_index_filter_cmd.cpp +++ b/src/mongo/s/commands/cluster_index_filter_cmd.cpp @@ -61,7 +61,7 @@ public: virtual ~ClusterIndexFilterCmd() {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp b/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp index 13e93a8834e..bed736c152e 100644 --- a/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp +++ b/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp @@ -43,7 +43,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_is_master_cmd.cpp b/src/mongo/s/commands/cluster_is_master_cmd.cpp index 5b172978deb..eaee3701cec 100644 --- a/src/mongo/s/commands/cluster_is_master_cmd.cpp +++ b/src/mongo/s/commands/cluster_is_master_cmd.cpp @@ -54,7 +54,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_kill_op.cpp b/src/mongo/s/commands/cluster_kill_op.cpp index 545dfdddb6f..7f942eb870a 100644 --- a/src/mongo/s/commands/cluster_kill_op.cpp +++ b/src/mongo/s/commands/cluster_kill_op.cpp @@ -60,7 +60,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_list_databases_cmd.cpp b/src/mongo/s/commands/cluster_list_databases_cmd.cpp index d1574504104..8fa0b0e8927 100644 --- a/src/mongo/s/commands/cluster_list_databases_cmd.cpp +++ b/src/mongo/s/commands/cluster_list_databases_cmd.cpp @@ -48,7 +48,7 @@ class ListDatabasesCmd : public BasicCommand { public: ListDatabasesCmd() : BasicCommand("listDatabases", "listdatabases") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_list_shards_cmd.cpp b/src/mongo/s/commands/cluster_list_shards_cmd.cpp index 1611c2b4dd1..75d96fe532d 100644 --- a/src/mongo/s/commands/cluster_list_shards_cmd.cpp +++ b/src/mongo/s/commands/cluster_list_shards_cmd.cpp @@ -47,7 +47,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp index c96ea7be671..694a076563f 100644 --- a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp +++ b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp @@ -150,7 +150,7 @@ class MRCmd : public ErrmsgCommandDeprecated { public: MRCmd() : ErrmsgCommandDeprecated("mapReduce", "mapreduce") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp index a3e8b08f9f4..90ed60ecc17 100644 --- a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp +++ b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp @@ -80,7 +80,7 @@ public: return true; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp index f486432e960..abdbdce37b9 100644 --- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp @@ -55,7 +55,7 @@ class MoveChunkCmd : public ErrmsgCommandDeprecated { public: MoveChunkCmd() : ErrmsgCommandDeprecated("moveChunk", "movechunk") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/s/commands/cluster_move_primary_cmd.cpp b/src/mongo/s/commands/cluster_move_primary_cmd.cpp index dfd7f9c9e6b..7dcc1a6f101 100644 --- a/src/mongo/s/commands/cluster_move_primary_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_primary_cmd.cpp @@ -57,7 +57,7 @@ class MoveDatabasePrimaryCommand : public BasicCommand { public: MoveDatabasePrimaryCommand() : BasicCommand("movePrimary", "moveprimary") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_multicast.cpp b/src/mongo/s/commands/cluster_multicast.cpp index c3059ee7fd8..4f467852064 100644 --- a/src/mongo/s/commands/cluster_multicast.cpp +++ b/src/mongo/s/commands/cluster_multicast.cpp @@ -66,7 +66,7 @@ class MulticastCmd : public BasicCommand { public: MulticastCmd() : BasicCommand("multicast") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } bool adminOnly() const override { diff --git a/src/mongo/s/commands/cluster_netstat_cmd.cpp b/src/mongo/s/commands/cluster_netstat_cmd.cpp index 6f70bcd78ef..5788a64d39f 100644 --- a/src/mongo/s/commands/cluster_netstat_cmd.cpp +++ b/src/mongo/s/commands/cluster_netstat_cmd.cpp @@ -40,7 +40,7 @@ class NetStatCmd : public BasicCommand { public: NetStatCmd() : BasicCommand("netstat") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp index ae5f186ad66..600a0e558c3 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp +++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp @@ -47,7 +47,7 @@ public: "http://dochub.mongodb.org/core/aggregation for more details."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp index a46cbc6ce1f..eeb4ec4d98e 100644 --- a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp +++ b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp @@ -54,7 +54,7 @@ class ClusterPlanCacheCmd : public BasicCommand { public: virtual ~ClusterPlanCacheCmd() {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } diff --git a/src/mongo/s/commands/cluster_profile_cmd.cpp b/src/mongo/s/commands/cluster_profile_cmd.cpp index 457a341e4cd..6e611ca2956 100644 --- a/src/mongo/s/commands/cluster_profile_cmd.cpp +++ b/src/mongo/s/commands/cluster_profile_cmd.cpp @@ -37,7 +37,7 @@ class ProfileCmd : public ErrmsgCommandDeprecated { public: ProfileCmd() : ErrmsgCommandDeprecated("profile") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp index b8f17cb5dfb..513b3b4b512 100644 --- a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp +++ b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp @@ -49,7 +49,7 @@ public: return "remove a shard from the system."; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp index faf1085f72d..5c18b49aaf2 100644 --- a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp +++ b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp @@ -69,7 +69,7 @@ class RemoveShardFromZoneCmd : public BasicCommand { public: RemoveShardFromZoneCmd() : BasicCommand("removeShardFromZone", "removeshardfromzone") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp index c1662319322..94df8971e5a 100644 --- a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp +++ b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp @@ -40,7 +40,7 @@ class CmdReplSetGetStatus : public ErrmsgCommandDeprecated { public: CmdReplSetGetStatus() : ErrmsgCommandDeprecated("replSetGetStatus") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_reset_error_cmd.cpp b/src/mongo/s/commands/cluster_reset_error_cmd.cpp index b1f97c6226d..11da21626da 100644 --- a/src/mongo/s/commands/cluster_reset_error_cmd.cpp +++ b/src/mongo/s/commands/cluster_reset_error_cmd.cpp @@ -49,7 +49,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_restart_catalog_command.cpp b/src/mongo/s/commands/cluster_restart_catalog_command.cpp index 9be27795a6c..0ac96394dd8 100644 --- a/src/mongo/s/commands/cluster_restart_catalog_command.cpp +++ b/src/mongo/s/commands/cluster_restart_catalog_command.cpp @@ -58,7 +58,7 @@ public: return false; } - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp b/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp index a4439e1d6d4..6897d50c498 100644 --- a/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp +++ b/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp @@ -55,7 +55,7 @@ class SetFeatureCompatibilityVersionCmd : public BasicCommand { public: SetFeatureCompatibilityVersionCmd() : BasicCommand("setFeatureCompatibilityVersion") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp index f7ac158045a..bc234e630db 100644 --- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp +++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp @@ -69,7 +69,7 @@ class ShardCollectionCmd : public BasicCommand { public: ShardCollectionCmd() : BasicCommand("shardCollection", "shardcollection") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_split_cmd.cpp b/src/mongo/s/commands/cluster_split_cmd.cpp index ff4d4214fb6..a21ebeb06fb 100644 --- a/src/mongo/s/commands/cluster_split_cmd.cpp +++ b/src/mongo/s/commands/cluster_split_cmd.cpp @@ -88,7 +88,7 @@ class SplitCollectionCmd : public ErrmsgCommandDeprecated { public: SplitCollectionCmd() : ErrmsgCommandDeprecated("split") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp index 5f23b66b74a..a54f01bf99e 100644 --- a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp +++ b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp @@ -72,7 +72,7 @@ class UpdateZoneKeyRangeCmd : public BasicCommand { public: UpdateZoneKeyRangeCmd() : BasicCommand("updateZoneKeyRange", "updatezonekeyRange") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_user_management_commands.cpp b/src/mongo/s/commands/cluster_user_management_commands.cpp index c1bb5ca1425..9d6bf19d73f 100644 --- a/src/mongo/s/commands/cluster_user_management_commands.cpp +++ b/src/mongo/s/commands/cluster_user_management_commands.cpp @@ -65,7 +65,7 @@ class CmdCreateUser : public BasicCommand { public: CmdCreateUser() : BasicCommand("createUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -105,7 +105,7 @@ class CmdUpdateUser : public BasicCommand { public: CmdUpdateUser() : BasicCommand("updateUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -156,7 +156,7 @@ class CmdDropUser : public BasicCommand { public: CmdDropUser() : BasicCommand("dropUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -204,7 +204,7 @@ class CmdDropAllUsersFromDatabase : public BasicCommand { public: CmdDropAllUsersFromDatabase() : BasicCommand("dropAllUsersFromDatabase") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -246,7 +246,7 @@ class CmdGrantRolesToUser : public BasicCommand { public: CmdGrantRolesToUser() : BasicCommand("grantRolesToUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -296,7 +296,7 @@ class CmdRevokeRolesFromUser : public BasicCommand { public: CmdRevokeRolesFromUser() : BasicCommand("revokeRolesFromUser") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -344,7 +344,7 @@ public: class CmdUsersInfo : public BasicCommand { public: - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } @@ -378,7 +378,7 @@ class CmdCreateRole : public BasicCommand { public: CmdCreateRole() : BasicCommand("createRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -414,7 +414,7 @@ class CmdUpdateRole : public BasicCommand { public: CmdUpdateRole() : BasicCommand("updateRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -456,7 +456,7 @@ class CmdGrantPrivilegesToRole : public BasicCommand { public: CmdGrantPrivilegesToRole() : BasicCommand("grantPrivilegesToRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -499,7 +499,7 @@ class CmdRevokePrivilegesFromRole : public BasicCommand { public: CmdRevokePrivilegesFromRole() : BasicCommand("revokePrivilegesFromRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -541,7 +541,7 @@ class CmdGrantRolesToRole : public BasicCommand { public: CmdGrantRolesToRole() : BasicCommand("grantRolesToRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -583,7 +583,7 @@ class CmdRevokeRolesFromRole : public BasicCommand { public: CmdRevokeRolesFromRole() : BasicCommand("revokeRolesFromRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -625,7 +625,7 @@ class CmdDropRole : public BasicCommand { public: CmdDropRole() : BasicCommand("dropRole") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -670,7 +670,7 @@ class CmdDropAllRolesFromDatabase : public BasicCommand { public: CmdDropAllRolesFromDatabase() : BasicCommand("dropAllRolesFromDatabase") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -717,7 +717,7 @@ class CmdRolesInfo : public BasicCommand { public: CmdRolesInfo() : BasicCommand("rolesInfo") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kOptIn; } @@ -749,7 +749,7 @@ class CmdInvalidateUserCache : public BasicCommand { public: CmdInvalidateUserCache() : BasicCommand("invalidateUserCache") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -798,7 +798,7 @@ class CmdMergeAuthzCollections : public BasicCommand { public: CmdMergeAuthzCollections() : BasicCommand("_mergeAuthzCollections") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp b/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp index 5dba5ce10c9..c0092996a8a 100644 --- a/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp +++ b/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp @@ -38,7 +38,7 @@ class WhatsMyUriCmd : public BasicCommand { public: WhatsMyUriCmd() : BasicCommand("whatsmyuri") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp index 667a2790280..9ea306bd545 100644 --- a/src/mongo/s/commands/cluster_write_cmd.cpp +++ b/src/mongo/s/commands/cluster_write_cmd.cpp @@ -139,7 +139,7 @@ class ClusterWriteCmd : public Command { public: virtual ~ClusterWriteCmd() {} - AllowedOnSecondary secondaryAllowed() const final { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kNever; } diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index 8588c95b605..4a2178d0fbe 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -151,7 +151,7 @@ class PublicGridCommand : public BasicCommand { protected: PublicGridCommand(const char* n, const char* oldname = NULL) : BasicCommand(n, oldname) {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } @@ -247,7 +247,7 @@ class DropIndexesCmd : public ErrmsgCommandDeprecated { public: DropIndexesCmd() : ErrmsgCommandDeprecated("dropIndexes", "deleteIndexes") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -301,7 +301,7 @@ class CreateIndexesCmd : public ErrmsgCommandDeprecated { public: CreateIndexesCmd() : ErrmsgCommandDeprecated("createIndexes") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -350,7 +350,7 @@ class ReIndexCmd : public ErrmsgCommandDeprecated { public: ReIndexCmd() : ErrmsgCommandDeprecated("reIndex") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -394,7 +394,7 @@ class CollectionModCmd : public ErrmsgCommandDeprecated { public: CollectionModCmd() : ErrmsgCommandDeprecated("collMod") {} - AllowedOnSecondary secondaryAllowed() const override { + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } |