summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2020-10-20 22:12:53 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-26 16:38:32 +0000
commit0c09bf00d7fdadc80215f7cd4829271c2e6a0dc8 (patch)
tree8aa874228884509b62849d59e8b0b7c4267e62db /src/mongo/s
parent051ad2e47f7ce1f5b76d89b65515c23777791919 (diff)
downloadmongo-0c09bf00d7fdadc80215f7cd4829271c2e6a0dc8.tar.gz
SERVER-50508 Rename ConnectionType::MASTER to ConnectionType::kStandalone
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/client/shard_registry.cpp10
-rw-r--r--src/mongo/s/client/sharding_connection_hook.cpp4
-rw-r--r--src/mongo/s/mongos_main.cpp6
-rw-r--r--src/mongo/s/mongos_options.cpp3
-rw-r--r--src/mongo/s/query/cluster_find.cpp2
-rw-r--r--src/mongo/s/request_types/add_shard_request_type.cpp4
-rw-r--r--src/mongo/s/sharding_router_test_fixture.cpp4
7 files changed, 17 insertions, 16 deletions
diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp
index b19f5d7d77b..4bb4e11a2c0 100644
--- a/src/mongo/s/client/shard_registry.cpp
+++ b/src/mongo/s/client/shard_registry.cpp
@@ -383,8 +383,8 @@ void ShardRegistry::_removeReplicaSet(const std::string& setName) {
void ShardRegistry::updateReplSetHosts(const ConnectionString& givenConnString,
ConnectionStringUpdateType updateType) {
- invariant(givenConnString.type() == ConnectionString::SET ||
- givenConnString.type() == ConnectionString::CUSTOM); // For dbtests
+ invariant(givenConnString.type() == ConnectionString::ConnectionType::kReplicaSet ||
+ givenConnString.type() == ConnectionString::ConnectionType::kCustom); // For dbtests
auto setName = givenConnString.getSetName();
@@ -830,10 +830,10 @@ void ShardRegistryData::_addShard(std::shared_ptr<Shard> shard) {
"Adding new shard to shard registry",
"shardId"_attr = shard->getId(),
"shardConnectionString"_attr = connString);
- if (connString.type() == ConnectionString::SET) {
+ if (connString.type() == ConnectionString::ConnectionType::kReplicaSet) {
_rsLookup[connString.getSetName()] = shard;
- } else if (connString.type() == ConnectionString::CUSTOM) {
- // CUSTOM connection strings (ie "$dummy:10000) become DBDirectClient connections which
+ } else if (connString.type() == ConnectionString::ConnectionType::kCustom) {
+ // kCustom connection strings (ie "$dummy:10000) become DBDirectClient connections which
// always return "localhost" as their response to getServerAddress(). This is just for
// making dbtest work.
_shardIdLookup[ShardId("localhost")] = shard;
diff --git a/src/mongo/s/client/sharding_connection_hook.cpp b/src/mongo/s/client/sharding_connection_hook.cpp
index 3d153a8012b..0a7374a240e 100644
--- a/src/mongo/s/client/sharding_connection_hook.cpp
+++ b/src/mongo/s/client/sharding_connection_hook.cpp
@@ -49,7 +49,7 @@ ShardingConnectionHook::ShardingConnectionHook(std::unique_ptr<rpc::EgressMetada
: _egressHook(std::move(egressHook)) {}
void ShardingConnectionHook::onCreate(DBClientBase* conn) {
- if (conn->type() == ConnectionString::INVALID) {
+ if (conn->type() == ConnectionString::ConnectionType::kInvalid) {
uasserted(ErrorCodes::BadValue, str::stream() << "Unrecognized connection string.");
}
@@ -72,7 +72,7 @@ void ShardingConnectionHook::onCreate(DBClientBase* conn) {
});
- if (conn->type() == ConnectionString::MASTER) {
+ if (conn->type() == ConnectionString::ConnectionType::kStandalone) {
BSONObj isMasterResponse;
if (!conn->runCommand("admin", BSON("ismaster" << 1), isMasterResponse)) {
uassertStatusOK(getStatusFromCommandResult(isMasterResponse));
diff --git a/src/mongo/s/mongos_main.cpp b/src/mongo/s/mongos_main.cpp
index 4dfdc0414b1..e3475550b8e 100644
--- a/src/mongo/s/mongos_main.cpp
+++ b/src/mongo/s/mongos_main.cpp
@@ -416,8 +416,8 @@ Status initializeSharding(OperationContext* opCtx) {
};
ShardFactory::BuildersMap buildersMap{
- {ConnectionString::SET, std::move(setBuilder)},
- {ConnectionString::MASTER, std::move(masterBuilder)},
+ {ConnectionString::ConnectionType::kReplicaSet, std::move(setBuilder)},
+ {ConnectionString::ConnectionType::kStandalone, std::move(masterBuilder)},
};
auto shardFactory =
@@ -439,7 +439,7 @@ Status initializeSharding(OperationContext* opCtx) {
catCache->invalidateEntriesThatReferenceShard(removedShard);
}};
- if (mongosGlobalParams.configdbs.type() == ConnectionString::INVALID) {
+ if (!mongosGlobalParams.configdbs) {
return {ErrorCodes::BadValue, "Unrecognized connection string."};
}
diff --git a/src/mongo/s/mongos_options.cpp b/src/mongo/s/mongos_options.cpp
index 4205b63954a..2ab56d4e191 100644
--- a/src/mongo/s/mongos_options.cpp
+++ b/src/mongo/s/mongos_options.cpp
@@ -137,7 +137,8 @@ Status storeMongosOptions(const moe::Environment& params) {
return configdbConnectionString.getStatus();
}
- if (configdbConnectionString.getValue().type() != ConnectionString::SET) {
+ if (configdbConnectionString.getValue().type() !=
+ ConnectionString::ConnectionType::kReplicaSet) {
return Status(ErrorCodes::BadValue,
str::stream() << "configdb supports only replica set connection string");
}
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp
index 395f8080acd..cc81dd0df0c 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -196,7 +196,7 @@ std::vector<std::pair<ShardId, BSONObj>> constructRequestsForShards(
std::vector<std::pair<ShardId, BSONObj>> requests;
for (const auto& shardId : shardIds) {
const auto shard = uassertStatusOK(shardRegistry->getShard(opCtx, shardId));
- invariant(!shard->isConfig() || shard->getConnString().type() != ConnectionString::INVALID);
+ invariant(!shard->isConfig() || shard->getConnString());
BSONObjBuilder cmdBuilder;
qrToForward->asFindCommand(&cmdBuilder);
diff --git a/src/mongo/s/request_types/add_shard_request_type.cpp b/src/mongo/s/request_types/add_shard_request_type.cpp
index 95ce8b0c8bb..7afaba2874c 100644
--- a/src/mongo/s/request_types/add_shard_request_type.cpp
+++ b/src/mongo/s/request_types/add_shard_request_type.cpp
@@ -88,8 +88,8 @@ StatusWith<AddShardRequest> AddShardRequest::parseInternalFields(const BSONObj&
}
ConnectionString connString = std::move(swConnString.getValue());
- if (connString.type() != ConnectionString::MASTER &&
- connString.type() != ConnectionString::SET) {
+ if (connString.type() != ConnectionString::ConnectionType::kStandalone &&
+ connString.type() != ConnectionString::ConnectionType::kReplicaSet) {
return {ErrorCodes::FailedToParse,
stream() << "Invalid connection string " << connString.toString()};
}
diff --git a/src/mongo/s/sharding_router_test_fixture.cpp b/src/mongo/s/sharding_router_test_fixture.cpp
index db4a4a3bb29..084a376c59a 100644
--- a/src/mongo/s/sharding_router_test_fixture.cpp
+++ b/src/mongo/s/sharding_router_test_fixture.cpp
@@ -157,8 +157,8 @@ ShardingTestFixture::ShardingTestFixture()
};
ShardFactory::BuildersMap buildersMap{
- {ConnectionString::SET, std::move(setBuilder)},
- {ConnectionString::MASTER, std::move(masterBuilder)},
+ {ConnectionString::ConnectionType::kReplicaSet, std::move(setBuilder)},
+ {ConnectionString::ConnectionType::kStandalone, std::move(masterBuilder)},
};
auto shardFactory =