summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_add_shard_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/commands/cluster_add_shard_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_add_shard_cmd.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/mongo/s/commands/cluster_add_shard_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_cmd.cpp
index df13a652f37..39225a4b854 100644
--- a/src/mongo/s/commands/cluster_add_shard_cmd.cpp
+++ b/src/mongo/s/commands/cluster_add_shard_cmd.cpp
@@ -30,13 +30,7 @@
#include "mongo/platform/basic.h"
-#include <vector>
-
-#include "mongo/bson/util/bson_extract.h"
-#include "mongo/db/audit.h"
#include "mongo/db/commands.h"
-#include "mongo/s/catalog/sharding_catalog_client.h"
-#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/add_shard_request_type.h"
@@ -44,9 +38,6 @@
#include "mongo/util/scopeguard.h"
namespace mongo {
-
-using std::string;
-
namespace {
const ReadPreferenceSetting kPrimaryOnlyReadPreference{ReadPreference::PrimaryOnly};
@@ -60,11 +51,11 @@ public:
return AllowedOnSecondary::kAlways;
}
- virtual bool adminOnly() const {
+ bool adminOnly() const override {
return true;
}
- virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
+ bool supportsWriteConcern(const BSONObj& cmd) const override {
return true;
}
@@ -72,18 +63,18 @@ public:
return "add a new shard to the system";
}
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) {
+ void addRequiredPrivileges(const std::string& dbname,
+ const BSONObj& cmdObj,
+ std::vector<Privilege>* out) override {
ActionSet actions;
actions.addAction(ActionType::addShard);
out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
}
- virtual bool run(OperationContext* opCtx,
- const std::string& dbname,
- const BSONObj& cmdObj,
- BSONObjBuilder& result) {
+ bool run(OperationContext* opCtx,
+ const std::string& dbname,
+ const BSONObj& cmdObj,
+ BSONObjBuilder& result) override {
auto parsedRequest = uassertStatusOK(AddShardRequest::parseFromMongosCommand(cmdObj));
// Force a reload of this node's shard list cache at the end of this command.
@@ -106,7 +97,7 @@ public:
return true;
}
-} addShard;
+} addShardCmd;
} // namespace
} // namespace mongo