summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/SConscript2
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_s.cpp18
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job.cpp4
-rw-r--r--src/mongo/db/cloner.h2
-rw-r--r--src/mongo/db/commands/clone.cpp4
-rw-r--r--src/mongo/db/commands/conn_pool_stats.cpp2
-rw-r--r--src/mongo/db/instance.cpp2
-rw-r--r--src/mongo/db/mongod_options.cpp2
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.cpp1
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.h1
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_test.cpp1
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp1
-rw-r--r--src/mongo/db/s/SConscript4
-rw-r--r--src/mongo/db/s/collection_metadata_test.cpp10
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_command.cpp4
-rw-r--r--src/mongo/db/s/merge_chunks_command.cpp6
-rw-r--r--src/mongo/db/s/metadata_loader.cpp16
-rw-r--r--src/mongo/db/s/metadata_loader.h8
-rw-r--r--src/mongo/db/s/metadata_loader_test.cpp26
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp54
-rw-r--r--src/mongo/db/s/move_chunk_command.cpp3
-rw-r--r--src/mongo/db/s/move_timing_helper.cpp2
-rw-r--r--src/mongo/db/s/sharding_state.cpp6
-rw-r--r--src/mongo/db/s/sharding_state_recovery.cpp8
-rw-r--r--src/mongo/db/s/sharding_state_test.cpp4
-rw-r--r--src/mongo/db/s/split_chunk_command.cpp9
-rw-r--r--src/mongo/db/server_options.h2
27 files changed, 98 insertions, 104 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 9e53d26a224..8f4c088c26b 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -696,7 +696,7 @@ serveronlyLibdeps = [
"$BUILD_DIR/mongo/client/parallel",
"$BUILD_DIR/mongo/db/bson/dotted_path_support",
"$BUILD_DIR/mongo/executor/network_interface_factory",
- "$BUILD_DIR/mongo/s/catalog/replset/catalog_manager_replica_set",
+ "$BUILD_DIR/mongo/s/catalog/replset/sharding_catalog_client_impl",
"$BUILD_DIR/mongo/s/client/sharding_connection_hook",
"$BUILD_DIR/mongo/s/coreshard",
"$BUILD_DIR/mongo/s/serveronly",
diff --git a/src/mongo/db/auth/authz_manager_external_state_s.cpp b/src/mongo/db/auth/authz_manager_external_state_s.cpp
index 4bdb2648688..500cc85c70a 100644
--- a/src/mongo/db/auth/authz_manager_external_state_s.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_s.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/auth/user_name.h"
#include "mongo/db/jsobj.h"
#include "mongo/rpc/get_status_from_command_result.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/grid.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/mongoutils/str.h"
@@ -69,7 +69,7 @@ Status AuthzManagerExternalStateMongos::getStoredAuthorizationVersion(OperationC
// that runs this command
BSONObj getParameterCmd = BSON("getParameter" << 1 << authSchemaVersionServerParameter << 1);
BSONObjBuilder builder;
- const bool ok = grid.catalogManager(txn)->runUserManagementReadCommand(
+ const bool ok = grid.catalogClient(txn)->runUserManagementReadCommand(
txn, "admin", getParameterCmd, &builder);
BSONObj cmdResult = builder.obj();
if (!ok) {
@@ -98,8 +98,8 @@ Status AuthzManagerExternalStateMongos::getUserDescription(OperationContext* txn
<< "showCredentials"
<< true);
BSONObjBuilder builder;
- const bool ok = grid.catalogManager(txn)->runUserManagementReadCommand(
- txn, "admin", usersInfoCmd, &builder);
+ const bool ok =
+ grid.catalogClient(txn)->runUserManagementReadCommand(txn, "admin", usersInfoCmd, &builder);
BSONObj cmdResult = builder.obj();
if (!ok) {
return getStatusFromCommandResult(cmdResult);
@@ -133,8 +133,8 @@ Status AuthzManagerExternalStateMongos::getRoleDescription(OperationContext* txn
<< "showPrivileges"
<< showPrivileges);
BSONObjBuilder builder;
- const bool ok = grid.catalogManager(txn)->runUserManagementReadCommand(
- txn, "admin", rolesInfoCmd, &builder);
+ const bool ok =
+ grid.catalogClient(txn)->runUserManagementReadCommand(txn, "admin", rolesInfoCmd, &builder);
BSONObj cmdResult = builder.obj();
if (!ok) {
return getStatusFromCommandResult(cmdResult);
@@ -166,7 +166,7 @@ Status AuthzManagerExternalStateMongos::getRoleDescriptionsForDB(OperationContex
<< showBuiltinRoles);
BSONObjBuilder builder;
const bool ok =
- grid.catalogManager(txn)->runUserManagementReadCommand(txn, dbname, rolesInfoCmd, &builder);
+ grid.catalogClient(txn)->runUserManagementReadCommand(txn, dbname, rolesInfoCmd, &builder);
BSONObj cmdResult = builder.obj();
if (!ok) {
return getStatusFromCommandResult(cmdResult);
@@ -180,7 +180,7 @@ Status AuthzManagerExternalStateMongos::getRoleDescriptionsForDB(OperationContex
bool AuthzManagerExternalStateMongos::hasAnyPrivilegeDocuments(OperationContext* txn) {
BSONObj usersInfoCmd = BSON("usersInfo" << 1);
BSONObjBuilder userBuilder;
- bool ok = grid.catalogManager(txn)->runUserManagementReadCommand(
+ bool ok = grid.catalogClient(txn)->runUserManagementReadCommand(
txn, "admin", usersInfoCmd, &userBuilder);
if (!ok) {
// If we were unable to complete the query,
@@ -198,7 +198,7 @@ bool AuthzManagerExternalStateMongos::hasAnyPrivilegeDocuments(OperationContext*
BSONObj rolesInfoCmd = BSON("rolesInfo" << 1);
BSONObjBuilder roleBuilder;
- ok = grid.catalogManager(txn)->runUserManagementReadCommand(
+ ok = grid.catalogClient(txn)->runUserManagementReadCommand(
txn, "admin", rolesInfoCmd, &roleBuilder);
if (!ok) {
return true;
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp
index 5f58d956c5c..29283c7ed91 100644
--- a/src/mongo/db/auth/user_cache_invalidator_job.cpp
+++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/server_parameters.h"
#include "mongo/rpc/get_status_from_command_result.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/grid.h"
#include "mongo/stdx/mutex.h"
#include "mongo/util/background.h"
@@ -93,7 +93,7 @@ public:
StatusWith<OID> getCurrentCacheGeneration(OperationContext* txn) {
try {
BSONObjBuilder result;
- const bool ok = grid.catalogManager(txn)->runUserManagementReadCommand(
+ const bool ok = grid.catalogClient(txn)->runUserManagementReadCommand(
txn, "admin", BSON("_getUserCacheGeneration" << 1), &result);
if (!ok) {
return getStatusFromCommandResult(result.obj());
diff --git a/src/mongo/db/cloner.h b/src/mongo/db/cloner.h
index 7f1629fafde..f6576575610 100644
--- a/src/mongo/db/cloner.h
+++ b/src/mongo/db/cloner.h
@@ -35,7 +35,6 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/client/dbclientinterface.h"
-#include "mongo/s/catalog/catalog_manager.h"
namespace mongo {
@@ -119,6 +118,7 @@ private:
* holding a distributed lock (such as movePrimary). Indicates that we need to
* be periodically checking to see if the catalog manager has swapped and fail
* if it has so that we don't block the mongos that initiated the command.
+ * TODO: This can be removed now - it was only used during 3.0->3.2 upgrade.
* createCollections - When 'true', will fetch a list of collections from the remote and create
* them. When 'false', assumes collections have already been created ahead of time.
*/
diff --git a/src/mongo/db/commands/clone.cpp b/src/mongo/db/commands/clone.cpp
index ddb251bc4c9..5ad425a0780 100644
--- a/src/mongo/db/commands/clone.cpp
+++ b/src/mongo/db/commands/clone.cpp
@@ -107,8 +107,8 @@ public:
opts.checkForCatalogChange = cmdObj["_checkForCatalogChange"].trueValue();
if (opts.checkForCatalogChange) {
- auto catalogManager = grid.catalogManager(txn);
- if (!catalogManager) {
+ auto catalogClient = grid.catalogClient(txn);
+ if (!catalogClient) {
return appendCommandStatus(
result,
Status(ErrorCodes::NotYetInitialized,
diff --git a/src/mongo/db/commands/conn_pool_stats.cpp b/src/mongo/db/commands/conn_pool_stats.cpp
index 3444ef1c50a..15bbe103ce1 100644
--- a/src/mongo/db/commands/conn_pool_stats.cpp
+++ b/src/mongo/db/commands/conn_pool_stats.cpp
@@ -90,7 +90,7 @@ public:
auto grid = Grid::get(txn);
if (grid->shardRegistry()) {
grid->getExecutorPool()->appendConnectionStats(&stats);
- grid->catalogManager(txn)->appendConnectionStats(&stats);
+ grid->catalogClient(txn)->appendConnectionStats(&stats);
}
// Output to a BSON object.
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index bae59911976..3961beae740 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -83,8 +83,6 @@
#include "mongo/rpc/legacy_request_builder.h"
#include "mongo/rpc/metadata.h"
#include "mongo/rpc/request_interface.h"
-#include "mongo/s/catalog/catalog_manager.h"
-#include "mongo/s/grid.h"
#include "mongo/s/stale_exception.h" // for SendStaleConfigException
#include "mongo/scripting/engine.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 32f88c57d51..2d2db93a737 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/logger/console_appender.h"
#include "mongo/logger/message_event_utf8_encoder.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/ssl_options.h"
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp
index 8d1ed0e9992..708ef8de639 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl.cpp
@@ -48,7 +48,6 @@
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/rslog.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
-#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/util/hex.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/repl/topology_coordinator_impl.h b/src/mongo/db/repl/topology_coordinator_impl.h
index fefebd6d9db..76a820aeba0 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.h
+++ b/src/mongo/db/repl/topology_coordinator_impl.h
@@ -40,7 +40,6 @@
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/topology_coordinator.h"
#include "mongo/db/server_options.h"
-#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/util/time_support.h"
namespace mongo {
diff --git a/src/mongo/db/repl/topology_coordinator_impl_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
index 94fbfb96b58..ada5a794c9c 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
@@ -41,7 +41,6 @@
#include "mongo/db/server_options.h"
#include "mongo/logger/logger.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
-#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/net/hostandport.h"
diff --git a/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
index 925e8a364ae..4a25ff9d2fc 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
@@ -42,7 +42,6 @@
#include "mongo/db/server_options.h"
#include "mongo/logger/logger.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
-#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/net/hostandport.h"
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index c4342750cef..86ff456bec2 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -158,7 +158,7 @@ env.CppUnitTest(
'$BUILD_DIR/mongo/db/serveronly',
'$BUILD_DIR/mongo/executor/network_test_env',
'$BUILD_DIR/mongo/executor/thread_pool_task_executor_test_fixture',
- '$BUILD_DIR/mongo/s/catalog/catalog_manager_mock',
+ '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_mock',
'$BUILD_DIR/mongo/s/coreshard',
'$BUILD_DIR/mongo/util/clock_source_mock',
'$BUILD_DIR/mongo/util/net/message_port_mock',
@@ -177,7 +177,7 @@ env.CppUnitTest(
'$BUILD_DIR/mongo/db/serveronly',
'$BUILD_DIR/mongo/executor/network_test_env',
'$BUILD_DIR/mongo/executor/thread_pool_task_executor_test_fixture',
- '$BUILD_DIR/mongo/s/catalog/catalog_manager_mock',
+ '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_mock',
'$BUILD_DIR/mongo/s/coreshard',
'$BUILD_DIR/mongo/util/clock_source_mock',
'$BUILD_DIR/mongo/util/net/message_port_mock',
diff --git a/src/mongo/db/s/collection_metadata_test.cpp b/src/mongo/db/s/collection_metadata_test.cpp
index b6861350ed8..1b2f604a2dd 100644
--- a/src/mongo/db/s/collection_metadata_test.cpp
+++ b/src/mongo/db/s/collection_metadata_test.cpp
@@ -77,7 +77,7 @@ protected:
auto future = launchAsync([this] {
MetadataLoader loader;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -345,7 +345,7 @@ protected:
auto future = launchAsync([this] {
MetadataLoader loader;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -601,7 +601,7 @@ protected:
auto future = launchAsync([this] {
MetadataLoader loader;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -677,7 +677,7 @@ protected:
auto future = launchAsync([this] {
MetadataLoader loader;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -891,7 +891,7 @@ protected:
auto future = launchAsync([this] {
MetadataLoader loader;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
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 27031c5a4e9..4378ae22c20 100644
--- a/src/mongo/db/s/config/configsvr_add_shard_command.cpp
+++ b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
@@ -38,7 +38,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/add_shard_request_type.h"
@@ -119,7 +119,7 @@ public:
parsedRequest.hasMaxSize() ? parsedRequest.getMaxSize()
: kMaxSizeMBDefault);
- StatusWith<string> addShardResult = grid.catalogManager(txn)->addShard(
+ StatusWith<string> addShardResult = grid.catalogClient(txn)->addShard(
txn,
parsedRequest.hasName() ? &parsedRequest.getName() : nullptr,
parsedRequest.getConnString(),
diff --git a/src/mongo/db/s/merge_chunks_command.cpp b/src/mongo/db/s/merge_chunks_command.cpp
index 612bf92616c..4f37d969bf9 100644
--- a/src/mongo/db/s/merge_chunks_command.cpp
+++ b/src/mongo/db/s/merge_chunks_command.cpp
@@ -144,7 +144,7 @@ Status runApplyOpsCmd(OperationContext* txn,
BSONArray preCond = buildOpPrecond(firstChunk.getNS(), firstChunk.getShard(), currShardVersion);
- return grid.catalogManager(txn)->applyChunkOpsDeprecated(
+ return grid.catalogClient(txn)->applyChunkOpsDeprecated(
txn, updatesB.arr(), preCond, firstChunk.getNS(), newMergedVersion);
}
@@ -157,7 +157,7 @@ bool mergeChunks(OperationContext* txn,
// Get the distributed lock
const string whyMessage = stream() << "merging chunks in " << nss.ns() << " from " << minKey
<< " to " << maxKey;
- auto scopedDistLock = grid.catalogManager(txn)->distLock(
+ auto scopedDistLock = grid.catalogClient(txn)->distLock(
txn, nss.ns(), whyMessage, DistLockManager::kSingleLockAttemptTimeout);
if (!scopedDistLock.isOK()) {
@@ -344,7 +344,7 @@ bool mergeChunks(OperationContext* txn,
BSONObj mergeLogEntry = buildMergeLogEntry(chunksToMerge, shardVersion, mergeVersion);
- grid.catalogManager(txn)->logChange(txn, "merge", nss.ns(), mergeLogEntry);
+ grid.catalogClient(txn)->logChange(txn, "merge", nss.ns(), mergeLogEntry);
return true;
}
diff --git a/src/mongo/db/s/metadata_loader.cpp b/src/mongo/db/s/metadata_loader.cpp
index e4d41dad429..f57fc35a2df 100644
--- a/src/mongo/db/s/metadata_loader.cpp
+++ b/src/mongo/db/s/metadata_loader.cpp
@@ -35,7 +35,7 @@
#include <vector>
#include "mongo/db/s/collection_metadata.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/chunk_diff.h"
@@ -93,25 +93,25 @@ MetadataLoader::MetadataLoader() = default;
MetadataLoader::~MetadataLoader() = default;
Status MetadataLoader::makeCollectionMetadata(OperationContext* txn,
- CatalogManager* catalogManager,
+ ShardingCatalogClient* catalogClient,
const string& ns,
const string& shard,
const CollectionMetadata* oldMetadata,
CollectionMetadata* metadata) const {
- Status status = _initCollection(txn, catalogManager, ns, shard, metadata);
+ Status status = _initCollection(txn, catalogClient, ns, shard, metadata);
if (!status.isOK() || metadata->getKeyPattern().isEmpty()) {
return status;
}
- return initChunks(txn, catalogManager, ns, shard, oldMetadata, metadata);
+ return initChunks(txn, catalogClient, ns, shard, oldMetadata, metadata);
}
Status MetadataLoader::_initCollection(OperationContext* txn,
- CatalogManager* catalogManager,
+ ShardingCatalogClient* catalogClient,
const string& ns,
const string& shard,
CollectionMetadata* metadata) const {
- auto coll = catalogManager->getCollection(txn, ns);
+ auto coll = catalogClient->getCollection(txn, ns);
if (!coll.isOK()) {
return coll.getStatus();
}
@@ -132,7 +132,7 @@ Status MetadataLoader::_initCollection(OperationContext* txn,
}
Status MetadataLoader::initChunks(OperationContext* txn,
- CatalogManager* catalogManager,
+ ShardingCatalogClient* catalogClient,
const string& ns,
const string& shard,
const CollectionMetadata* oldMetadata,
@@ -179,7 +179,7 @@ Status MetadataLoader::initChunks(OperationContext* txn,
try {
std::vector<ChunkType> chunks;
const auto diffQuery = differ.configDiffQuery();
- Status status = catalogManager->getChunks(
+ Status status = catalogClient->getChunks(
txn, diffQuery.query, diffQuery.sort, boost::none, &chunks, nullptr);
if (!status.isOK()) {
if (status == ErrorCodes::HostUnreachable) {
diff --git a/src/mongo/db/s/metadata_loader.h b/src/mongo/db/s/metadata_loader.h
index ef7048f2fc6..bcaae5f4b9f 100644
--- a/src/mongo/db/s/metadata_loader.h
+++ b/src/mongo/db/s/metadata_loader.h
@@ -36,7 +36,7 @@
namespace mongo {
-class CatalogManager;
+class ShardingCatalogClient;
class CollectionMetadata;
class CollectionType;
class DBClientCursor;
@@ -91,7 +91,7 @@ public:
* @return RemoteChangeDetected if the data loaded was modified by another operation
*/
Status makeCollectionMetadata(OperationContext* txn,
- CatalogManager* catalogManager,
+ ShardingCatalogClient* catalogClient,
const std::string& ns,
const std::string& shard,
const CollectionMetadata* oldMetadata,
@@ -134,7 +134,7 @@ private:
*
*/
Status _initCollection(OperationContext* txn,
- CatalogManager* catalogManager,
+ ShardingCatalogClient* catalogClient,
const std::string& ns,
const std::string& shard,
CollectionMetadata* metadata) const;
@@ -153,7 +153,7 @@ private:
* TODO: @return FailedToParse
*/
Status initChunks(OperationContext* txn,
- CatalogManager* catalogManager,
+ ShardingCatalogClient* catalogClient,
const std::string& ns,
const std::string& shard,
const CollectionMetadata* oldMetadata,
diff --git a/src/mongo/db/s/metadata_loader_test.cpp b/src/mongo/db/s/metadata_loader_test.cpp
index 67ea0317db0..a3d50228c86 100644
--- a/src/mongo/db/s/metadata_loader_test.cpp
+++ b/src/mongo/db/s/metadata_loader_test.cpp
@@ -115,7 +115,7 @@ protected:
auto future = launchAsync([this, ns, shardName, metadata] {
auto status = loader().makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
ns,
shardName,
NULL, /* no old metadata */
@@ -160,7 +160,7 @@ TEST_F(MetadataLoaderFixture, DroppedColl) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -176,7 +176,7 @@ TEST_F(MetadataLoaderFixture, EmptyColl) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -193,7 +193,7 @@ TEST_F(MetadataLoaderFixture, BadColl) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -221,7 +221,7 @@ TEST_F(MetadataLoaderFixture, BadChunk) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -248,7 +248,7 @@ TEST_F(MetadataLoaderFixture, NoChunksIsDropped) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -286,7 +286,7 @@ TEST_F(MetadataLoaderFixture, CheckNumChunk) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -311,7 +311,7 @@ TEST_F(MetadataLoaderFixture, SingleChunkCheckNumChunk) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -331,7 +331,7 @@ TEST_F(MetadataLoaderFixture, SingleChunkGetNext) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -351,7 +351,7 @@ TEST_F(MetadataLoaderFixture, SingleChunkGetShardKey) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -371,7 +371,7 @@ TEST_F(MetadataLoaderFixture, SingleChunkGetMaxCollVersion) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -389,7 +389,7 @@ TEST_F(MetadataLoaderFixture, SingleChunkGetMaxShardVersion) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
@@ -407,7 +407,7 @@ TEST_F(MetadataLoaderFixture, NoChunks) {
MetadataLoader loader;
CollectionMetadata metadata;
auto status = loader.makeCollectionMetadata(operationContext(),
- catalogManager(),
+ catalogClient(),
"test.foo",
"shard0000",
NULL, /* no old metadata */
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index 51af102018f..10cbb678c7f 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/s/sharding_state_recovery.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/grid.h"
#include "mongo/s/shard_key_pattern.h"
@@ -187,14 +187,14 @@ Status MigrationSourceManager::startClone(OperationContext* txn) {
invariant(_state == kCreated);
auto scopedGuard = MakeGuard([&] { cleanupOnError(txn); });
- grid.catalogManager(txn)->logChange(
- txn,
- "moveChunk.start",
- _args.getNss().ns(),
- BSON("min" << _args.getMinKey() << "max" << _args.getMaxKey() << "from"
- << _args.getFromShardId()
- << "to"
- << _args.getToShardId()));
+ grid.catalogClient(txn)->logChange(txn,
+ "moveChunk.start",
+ _args.getNss().ns(),
+ BSON("min" << _args.getMinKey() << "max" << _args.getMaxKey()
+ << "from"
+ << _args.getFromShardId()
+ << "to"
+ << _args.getToShardId()));
_cloneDriver = stdx::make_unique<MigrationChunkClonerSourceLegacy>(
_args, _committedMetadata->getKeyPattern());
@@ -388,7 +388,7 @@ Status MigrationSourceManager::commitDonateChunk(OperationContext* txn) {
MONGO_FAIL_POINT_PAUSE_WHILE_SET(hangBeforeCommitMigration);
- Status applyOpsStatus = grid.catalogManager(txn)->applyChunkOpsDeprecated(
+ Status applyOpsStatus = grid.catalogClient(txn)->applyChunkOpsDeprecated(
txn, updates.arr(), preCond.arr(), _args.getNss().ns(), nextVersion);
if (MONGO_FAIL_POINT(failCommitMigrationCommand)) {
@@ -419,7 +419,7 @@ Status MigrationSourceManager::commitDonateChunk(OperationContext* txn) {
// Need to get the latest optime in case the refresh request goes to a secondary --
// otherwise the read won't wait for the write that applyChunkOpsDeprecated may have done.
- Status status = grid.catalogManager(txn)->logChange(
+ Status status = grid.catalogClient(txn)->logChange(
txn,
"moveChunk.validating",
_args.getNss().ns(),
@@ -492,14 +492,14 @@ Status MigrationSourceManager::commitDonateChunk(OperationContext* txn) {
scopedGuard.Dismiss();
_cleanup(txn);
- grid.catalogManager(txn)->logChange(
- txn,
- "moveChunk.commit",
- _args.getNss().ns(),
- BSON("min" << _args.getMinKey() << "max" << _args.getMaxKey() << "from"
- << _args.getFromShardId()
- << "to"
- << _args.getToShardId()));
+ grid.catalogClient(txn)->logChange(txn,
+ "moveChunk.commit",
+ _args.getNss().ns(),
+ BSON("min" << _args.getMinKey() << "max" << _args.getMaxKey()
+ << "from"
+ << _args.getFromShardId()
+ << "to"
+ << _args.getToShardId()));
return Status::OK();
}
@@ -509,14 +509,14 @@ void MigrationSourceManager::cleanupOnError(OperationContext* txn) {
return;
}
- grid.catalogManager(txn)->logChange(
- txn,
- "moveChunk.error",
- _args.getNss().ns(),
- BSON("min" << _args.getMinKey() << "max" << _args.getMaxKey() << "from"
- << _args.getFromShardId()
- << "to"
- << _args.getToShardId()));
+ grid.catalogClient(txn)->logChange(txn,
+ "moveChunk.error",
+ _args.getNss().ns(),
+ BSON("min" << _args.getMinKey() << "max" << _args.getMaxKey()
+ << "from"
+ << _args.getFromShardId()
+ << "to"
+ << _args.getToShardId()));
_cleanup(txn);
}
diff --git a/src/mongo/db/s/move_chunk_command.cpp b/src/mongo/db/s/move_chunk_command.cpp
index 51637a6efee..12ed1cbd6f7 100644
--- a/src/mongo/db/s/move_chunk_command.cpp
+++ b/src/mongo/db/s/move_chunk_command.cpp
@@ -66,7 +66,8 @@ DistLockManager::ScopedDistLock acquireCollectionDistLock(OperationContext* txn,
<< ChunkRange(args.getMinKey(), args.getMaxKey()).toString()
<< " in "
<< args.getNss().ns());
- auto distLockStatus = grid.catalogManager(txn)->distLock(txn, args.getNss().ns(), whyMessage);
+ auto distLockStatus =
+ Grid::get(txn)->catalogClient(txn)->distLock(txn, args.getNss().ns(), whyMessage);
if (!distLockStatus.isOK()) {
const string msg = str::stream()
<< "Could not acquire collection lock for " << args.getNss().ns()
diff --git a/src/mongo/db/s/move_timing_helper.cpp b/src/mongo/db/s/move_timing_helper.cpp
index 4ff91d6e658..3e4d1507dbc 100644
--- a/src/mongo/db/s/move_timing_helper.cpp
+++ b/src/mongo/db/s/move_timing_helper.cpp
@@ -82,7 +82,7 @@ MoveTimingHelper::~MoveTimingHelper() {
_b.append("errmsg", *_cmdErrmsg);
}
- grid.catalogManager(_txn)->logChange(
+ grid.catalogClient(_txn)->logChange(
_txn, str::stream() << "moveChunk." << _where, _ns, _b.obj());
} catch (const std::exception& e) {
warning() << "couldn't record timing for moveChunk '" << _where << "': " << e.what();
diff --git a/src/mongo/db/s/sharding_state.cpp b/src/mongo/db/s/sharding_state.cpp
index 124629899c4..715fd1ffa02 100644
--- a/src/mongo/db/s/sharding_state.cpp
+++ b/src/mongo/db/s/sharding_state.cpp
@@ -52,7 +52,7 @@
#include "mongo/db/s/type_shard_identity.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/rpc/metadata/config_server_metadata.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/chunk_version.h"
#include "mongo/s/client/shard_registry.h"
@@ -211,7 +211,7 @@ void ShardingState::shutDown(OperationContext* txn) {
if (_getInitializationState() == InitializationState::kInitialized) {
grid.getExecutorPool()->shutdownAndJoin();
- grid.catalogManager(txn)->shutDown(txn);
+ grid.catalogClient(txn)->shutDown(txn);
}
}
@@ -698,7 +698,7 @@ Status ShardingState::_refreshMetadata(OperationContext* txn,
{
Status status = mdLoader.makeCollectionMetadata(txn,
- grid.catalogManager(txn),
+ grid.catalogClient(txn),
ns,
getShardName(),
fullReload ? nullptr : beforeMetadata.get(),
diff --git a/src/mongo/db/s/sharding_state_recovery.cpp b/src/mongo/db/s/sharding_state_recovery.cpp
index d076b995f53..5980556a2ba 100644
--- a/src/mongo/db/s/sharding_state_recovery.cpp
+++ b/src/mongo/db/s/sharding_state_recovery.cpp
@@ -294,10 +294,10 @@ Status ShardingStateRecovery::recover(OperationContext* txn) {
// Need to fetch the latest uptime from the config server, so do a logging write
Status status =
- grid.catalogManager(txn)->logChange(txn,
- "Sharding minOpTime recovery",
- NamespaceString::kConfigCollectionNamespace.ns(),
- recoveryDocBSON);
+ grid.catalogClient(txn)->logChange(txn,
+ "Sharding minOpTime recovery",
+ NamespaceString::kConfigCollectionNamespace.ns(),
+ recoveryDocBSON);
if (!status.isOK())
return status;
diff --git a/src/mongo/db/s/sharding_state_test.cpp b/src/mongo/db/s/sharding_state_test.cpp
index ba8a456f51e..83b885163cb 100644
--- a/src/mongo/db/s/sharding_state_test.cpp
+++ b/src/mongo/db/s/sharding_state_test.cpp
@@ -46,7 +46,7 @@
#include "mongo/executor/thread_pool_task_executor_test_fixture.h"
#include "mongo/s/balancer/balancer_configuration.h"
#include "mongo/s/catalog/catalog_cache.h"
-#include "mongo/s/catalog/catalog_manager_mock.h"
+#include "mongo/s/catalog/sharding_catalog_client_mock.h"
#include "mongo/s/client/shard_factory.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/client/shard_remote.h"
@@ -110,7 +110,7 @@ void initGrid(OperationContext* txn, const ConnectionString& configConnString) {
auto shardRegistry(stdx::make_unique<ShardRegistry>(std::move(shardFactory), configConnString));
grid.init(
- stdx::make_unique<CatalogManagerMock>(),
+ stdx::make_unique<ShardingCatalogClientMock>(),
stdx::make_unique<CatalogCache>(),
std::move(shardRegistry),
stdx::make_unique<ClusterCursorManager>(txn->getServiceContext()->getPreciseClockSource()),
diff --git a/src/mongo/db/s/split_chunk_command.cpp b/src/mongo/db/s/split_chunk_command.cpp
index 58018441072..0ff327db442 100644
--- a/src/mongo/db/s/split_chunk_command.cpp
+++ b/src/mongo/db/s/split_chunk_command.cpp
@@ -222,7 +222,7 @@ public:
const string whyMessage(str::stream() << "splitting chunk [" << min << ", " << max
<< ") in "
<< nss.toString());
- auto scopedDistLock = grid.catalogManager(txn)->distLock(
+ auto scopedDistLock = grid.catalogClient(txn)->distLock(
txn, nss.ns(), whyMessage, DistLockManager::kSingleLockAttemptTimeout);
if (!scopedDistLock.isOK()) {
errmsg = str::stream() << "could not acquire collection lock for " << nss.toString()
@@ -401,7 +401,7 @@ public:
// 4. apply the batch of updates to remote and local metadata
//
- Status applyOpsStatus = grid.catalogManager(txn)->applyChunkOpsDeprecated(
+ Status applyOpsStatus = grid.catalogClient(txn)->applyChunkOpsDeprecated(
txn, updates.arr(), preCond.arr(), nss.ns(), nextChunkVersion);
if (!applyOpsStatus.isOK()) {
return appendCommandStatus(result, applyOpsStatus);
@@ -441,7 +441,7 @@ public:
appendShortVersion(logDetail.subobjStart("left"), *newChunks[0]);
appendShortVersion(logDetail.subobjStart("right"), *newChunks[1]);
- grid.catalogManager(txn)->logChange(txn, "split", nss.ns(), logDetail.obj());
+ grid.catalogClient(txn)->logChange(txn, "split", nss.ns(), logDetail.obj());
} else {
BSONObj beforeDetailObj = logDetail.obj();
BSONObj firstDetailObj = beforeDetailObj.getOwned();
@@ -454,8 +454,7 @@ public:
chunkDetail.append("of", newChunksSize);
appendShortVersion(chunkDetail.subobjStart("chunk"), *newChunks[i]);
- grid.catalogManager(txn)->logChange(
- txn, "multi-split", nss.ns(), chunkDetail.obj());
+ grid.catalogClient(txn)->logChange(txn, "multi-split", nss.ns(), chunkDetail.obj());
}
}
diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h
index ec692649967..886b7bb0dd1 100644
--- a/src/mongo/db/server_options.h
+++ b/src/mongo/db/server_options.h
@@ -29,7 +29,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/platform/process_id.h"
-#include "mongo/s/catalog/catalog_manager.h"
+#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/util/net/listen.h" // For DEFAULT_MAX_CONN
namespace mongo {