summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-02-03 09:42:54 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-02-06 07:33:21 -0500
commit0851ee0434ba5352561a204f368a062d660c8882 (patch)
tree1b16836f9db4bc134df768a4f4a1e23a0c8f0b30 /src/mongo
parentd7c127cb2c98eab7ca9ea0ef8405126e675ed5d7 (diff)
downloadmongo-0851ee0434ba5352561a204f368a062d660c8882.tar.gz
SERVER-29908 Move sharding_catalog_manager and tests under db/s/config
Also get rid of sharding_catalog_test_fixture since it doesn't provide much value.
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/SConscript4
-rw-r--r--src/mongo/db/commands/SConscript2
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp2
-rw-r--r--src/mongo/db/db.cpp2
-rw-r--r--src/mongo/db/repl/SConscript2
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp2
-rw-r--r--src/mongo/db/s/SConscript52
-rw-r--r--src/mongo/db/s/collection_sharding_state.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_create_database_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_drop_collection_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_drop_database_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_enable_sharding_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_merge_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_move_primary_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_remove_shard_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_shard_collection_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_split_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager.cpp (renamed from src/mongo/s/catalog/sharding_catalog_manager.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager.h (renamed from src/mongo/s/catalog/sharding_catalog_manager.h)0
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_add_shard_to_zone_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_add_shard_to_zone_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_assign_key_range_to_zone_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_assign_key_range_to_zone_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp (renamed from src/mongo/s/catalog/sharding_catalog_manager_chunk_operations.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp (renamed from src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_commit_chunk_migration_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_config_initialization_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_config_initialization_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_create_database_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_create_database_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp (renamed from src/mongo/s/catalog/sharding_catalog_manager_database_operations.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_drop_coll_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_drop_coll_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_enable_sharding_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_enable_sharding_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_merge_chunks_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_merge_chunks_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_remove_shard_from_zone_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_remove_shard_from_zone_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_remove_shard_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_remove_shard_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_shard_collection_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp (renamed from src/mongo/s/catalog/sharding_catalog_manager_shard_operations.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_split_chunk_test.cpp (renamed from src/mongo/s/catalog/sharding_catalog_split_chunk_test.cpp)2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_zone_operations.cpp (renamed from src/mongo/s/catalog/sharding_catalog_manager_zone_operations.cpp)2
-rw-r--r--src/mongo/db/s/sharding_initialization_mongod.cpp1
-rw-r--r--src/mongo/s/SConscript30
-rw-r--r--src/mongo/s/catalog/SConscript118
-rw-r--r--src/mongo/s/catalog/sharding_catalog_log_change_test.cpp6
-rw-r--r--src/mongo/s/catalog/sharding_catalog_test.cpp4
-rw-r--r--src/mongo/s/catalog/sharding_catalog_test_fixture.cpp54
-rw-r--r--src/mongo/s/catalog/sharding_catalog_test_fixture.h52
-rw-r--r--src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp6
-rw-r--r--src/mongo/s/catalog_cache_refresh_test.cpp46
-rw-r--r--src/mongo/s/catalog_cache_test_fixture.cpp12
-rw-r--r--src/mongo/s/catalog_cache_test_fixture.h6
-rw-r--r--src/mongo/s/config_server_test_fixture.cpp2
-rw-r--r--src/mongo/s/server.cpp223
-rw-r--r--src/mongo/s/server.h44
-rw-r--r--src/mongo/s/shard_server_test_fixture.cpp8
-rw-r--r--src/mongo/s/shard_server_test_fixture.h2
-rw-r--r--src/mongo/s/sharding_test_fixture.cpp9
-rw-r--r--src/mongo/s/sharding_test_fixture.h6
60 files changed, 295 insertions, 468 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 99615ec8b02..0c6f230519c 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -299,8 +299,8 @@ env.Library(
'db/ftdc/ftdc_mongod',
'db/index_d',
'db/initialize_snmp',
- 'db/kill_sessions_local',
'db/keys_collection_client_direct',
+ 'db/kill_sessions_local',
'db/logical_session_cache_factory_mongod',
'db/mongodandmongos',
'db/op_observer_d',
@@ -311,6 +311,7 @@ env.Library(
'db/repl/storage_interface_impl',
'db/repl/topology_coordinator',
'db/s/balancer',
+ 'db/s/sharding_catalog_manager',
'db/serveronly',
'db/service_context_d',
'db/startup_warnings_mongod',
@@ -319,7 +320,6 @@ env.Library(
'executor/network_interface_factory',
'mongod_options_init',
'rpc/rpc',
- 's/catalog/sharding_catalog_manager',
's/commands/shared_cluster_commands',
'transport/service_entry_point',
'transport/transport_layer_manager',
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 378e475dc44..7d889b66c5c 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -226,11 +226,11 @@ env.Library(
'$BUILD_DIR/mongo/db/repl/oplog',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
'$BUILD_DIR/mongo/db/rw_concern_d',
+ '$BUILD_DIR/mongo/db/s/sharding_catalog_manager',
'$BUILD_DIR/mongo/db/server_options_core',
'$BUILD_DIR/mongo/db/stats/serveronly_stats',
'$BUILD_DIR/mongo/db/storage/mmap_v1/storage_mmapv1',
'$BUILD_DIR/mongo/db/views/views_mongod',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_manager',
'$BUILD_DIR/mongo/s/client/parallel',
'core',
'current_op_common',
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 b4f58018eaa..ba82f10cc54 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -40,10 +40,10 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/replication_coordinator_global.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/server_options.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/s/catalog/sharding_catalog_client_impl.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/util/exit.h"
#include "mongo/util/fail_point_service.h"
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 19ffd88d700..19aef3e230c 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -106,6 +106,7 @@
#include "mongo/db/repl/storage_interface_impl.h"
#include "mongo/db/repl/topology_coordinator.h"
#include "mongo/db/s/balancer/balancer.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/s/sharded_connection_info.h"
#include "mongo/db/s/sharding_initialization_mongod.h"
#include "mongo/db/s/sharding_state.h"
@@ -132,7 +133,6 @@
#include "mongo/executor/thread_pool_task_executor.h"
#include "mongo/platform/process_id.h"
#include "mongo/rpc/metadata/egress_metadata_hook_list.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
#include "mongo/s/sharding_initialization.h"
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 8e512adcdcf..ddcc2ab2c5b 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -1565,10 +1565,10 @@ env.Library(
'$BUILD_DIR/mongo/db/repair_database',
'$BUILD_DIR/mongo/db/repl/oplog_buffer_proxy',
'$BUILD_DIR/mongo/db/s/balancer',
+ '$BUILD_DIR/mongo/db/s/sharding_catalog_manager',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/db/stats/counters',
'$BUILD_DIR/mongo/rpc/client_metadata',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_manager',
'bgsync',
'drop_pending_collection_reaper',
'oplog_buffer_collection',
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index 3a6819534b5..f2a1e8863eb 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -70,6 +70,7 @@
#include "mongo/db/repl/rs_sync.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/s/balancer/balancer.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/s/sharding_state_recovery.h"
#include "mongo/db/server_options.h"
@@ -82,7 +83,6 @@
#include "mongo/executor/network_interface_factory.h"
#include "mongo/executor/thread_pool_task_executor.h"
#include "mongo/rpc/metadata/egress_metadata_hook_list.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/catalog_cache_loader.h"
#include "mongo/s/client/shard_registry.h"
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index fd53ece397b..b41ea1be6a7 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -88,7 +88,6 @@ env.Library(
'$BUILD_DIR/mongo/db/commands/server_status',
'$BUILD_DIR/mongo/db/common',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_manager',
'$BUILD_DIR/mongo/s/client/shard_local',
'$BUILD_DIR/mongo/s/coreshard',
'$BUILD_DIR/mongo/s/is_mongos',
@@ -147,6 +146,28 @@ env.CppUnitTest(
)
env.Library(
+ target='sharding_catalog_manager',
+ source=[
+ 'config/sharding_catalog_manager_chunk_operations.cpp',
+ 'config/sharding_catalog_manager_collection_operations.cpp',
+ 'config/sharding_catalog_manager.cpp',
+ 'config/sharding_catalog_manager_database_operations.cpp',
+ 'config/sharding_catalog_manager_shard_operations.cpp',
+ 'config/sharding_catalog_manager_zone_operations.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/db/catalog/catalog_raii',
+ '$BUILD_DIR/mongo/db/commands/dcommands_fcv',
+ '$BUILD_DIR/mongo/db/repl/read_concern_args',
+ '$BUILD_DIR/mongo/db/s/balancer',
+ '$BUILD_DIR/mongo/executor/network_interface',
+ '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client',
+ '$BUILD_DIR/mongo/s/client/sharding_client',
+ '$BUILD_DIR/mongo/s/coreshard',
+ ],
+)
+
+env.Library(
target='commands_db_s',
source=[
'check_sharding_index_command.cpp',
@@ -189,11 +210,11 @@ env.Library(
'$BUILD_DIR/mongo/db/index_d',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'$BUILD_DIR/mongo/db/rw_concern_d',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_manager',
'$BUILD_DIR/mongo/s/commands/shared_cluster_commands',
'balancer',
'collection_metadata',
'sharding',
+ 'sharding_catalog_manager',
],
)
@@ -232,7 +253,7 @@ env.CppUnitTest(
'$BUILD_DIR/mongo/db/query/query_request',
'$BUILD_DIR/mongo/s/catalog/dist_lock_manager_mock',
'$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_mock',
+ '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_mock',
'$BUILD_DIR/mongo/s/shard_server_test_fixture',
],
)
@@ -296,8 +317,31 @@ env.CppUnitTest(
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/ops/write_ops_exec',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_mock',
+ '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_mock',
'$BUILD_DIR/mongo/s/shard_server_test_fixture',
'sharding',
]
)
+
+env.CppUnitTest(
+ target='sharding_catalog_manager_test',
+ source=[
+ 'config/sharding_catalog_manager_add_shard_test.cpp',
+ 'config/sharding_catalog_manager_add_shard_to_zone_test.cpp',
+ 'config/sharding_catalog_manager_assign_key_range_to_zone_test.cpp',
+ 'config/sharding_catalog_manager_commit_chunk_migration_test.cpp',
+ 'config/sharding_catalog_manager_config_initialization_test.cpp',
+ 'config/sharding_catalog_manager_create_database_test.cpp',
+ 'config/sharding_catalog_manager_drop_coll_test.cpp',
+ 'config/sharding_catalog_manager_enable_sharding_test.cpp',
+ 'config/sharding_catalog_manager_merge_chunks_test.cpp',
+ 'config/sharding_catalog_manager_remove_shard_from_zone_test.cpp',
+ 'config/sharding_catalog_manager_remove_shard_test.cpp',
+ 'config/sharding_catalog_manager_shard_collection_test.cpp',
+ 'config/sharding_catalog_manager_split_chunk_test.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/s/config_server_test_fixture',
+ '$BUILD_DIR/mongo/util/version_impl',
+ ]
+)
diff --git a/src/mongo/db/s/collection_sharding_state.cpp b/src/mongo/db/s/collection_sharding_state.cpp
index 78e9c8b4d55..07afbe69236 100644
--- a/src/mongo/db/s/collection_sharding_state.cpp
+++ b/src/mongo/db/s/collection_sharding_state.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/client.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/s/migration_chunk_cloner_source.h"
#include "mongo/db/s/migration_source_manager.h"
#include "mongo/db/s/operation_sharding_state.h"
@@ -49,7 +50,6 @@
#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/s/balancer_configuration.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_config_version.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/catalog/type_shard_collection.h"
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 834aa73ca74..2e587bef4d3 100644
--- a/src/mongo/db/s/config/configsvr_add_shard_command.cpp
+++ b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/add_shard_request_type.h"
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 00c1af987cf..2f280dffc00 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
@@ -35,7 +35,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/commands.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/add_shard_to_zone_request_type.h"
#include "mongo/util/log.h"
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 4e9b80d82ea..0dd43e61c74 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
@@ -37,9 +37,9 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/s/chunk_move_write_concern_options.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/rpc/get_status_from_command_result.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_locks.h"
#include "mongo/s/chunk_version.h"
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 797f76f5720..47740c174be 100644
--- a/src/mongo/db/s/config/configsvr_create_database_command.cpp
+++ b/src/mongo/db/s/config/configsvr_create_database_command.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/operation_context.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/grid.h"
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 bffad346dc6..e923f753c7a 100644
--- a/src/mongo/db/s/config/configsvr_drop_collection_command.cpp
+++ b/src/mongo/db/s/config/configsvr_drop_collection_command.cpp
@@ -34,8 +34,8 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/dist_lock_manager.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/client/shard_registry.h"
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 5a39eee3174..b85a2eab87e 100644
--- a/src/mongo/db/s/config/configsvr_drop_database_command.cpp
+++ b/src/mongo/db/s/config/configsvr_drop_database_command.cpp
@@ -33,8 +33,8 @@
#include "mongo/db/commands.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/dist_lock_manager.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/grid.h"
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 9bdbd5c5669..50cbe6d15ea 100644
--- a/src/mongo/db/s/config/configsvr_enable_sharding_command.cpp
+++ b/src/mongo/db/s/config/configsvr_enable_sharding_command.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/operation_context.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/grid.h"
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 37c32c6781a..ed49bba1b9d 100644
--- a/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp
+++ b/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/operation_context.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/merge_chunk_request_type.h"
#include "mongo/util/log.h"
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 ad02277cc69..4bdeb30ad05 100644
--- a/src/mongo/db/s/config/configsvr_move_primary_command.cpp
+++ b/src/mongo/db/s/config/configsvr_move_primary_command.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/client/shard_registry.h"
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 d55e81b4ba9..3ef3d0c6995 100644
--- a/src/mongo/db/s/config/configsvr_remove_shard_command.cpp
+++ b/src/mongo/db/s/config/configsvr_remove_shard_command.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/operation_context.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/client/shard_registry.h"
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 9aa7f9285e2..02c5473173f 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
@@ -35,7 +35,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/commands.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/remove_shard_from_zone_request_type.h"
#include "mongo/util/log.h"
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 d221a719bb8..5a2053719de 100644
--- a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp
+++ b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp
@@ -46,9 +46,9 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/sessions_collection.h"
#include "mongo/s/balancer_configuration.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/catalog_cache.h"
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 4d66c7ffa8b..474cf1b5e92 100644
--- a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
+++ b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/operation_context.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/split_chunk_request_type.h"
#include "mongo/util/log.h"
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 1742699b038..afd3ebdf2d2 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
@@ -35,7 +35,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/commands.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/update_zone_key_range_request_type.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager.cpp b/src/mongo/db/s/config/sharding_catalog_manager.cpp
index 18f616516e3..136fce6a29c 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager.cpp
@@ -30,7 +30,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/commands/feature_compatibility_version.h"
#include "mongo/db/operation_context.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager.h b/src/mongo/db/s/config/sharding_catalog_manager.h
index aa7bd212ae0..aa7bd212ae0 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager.h
+++ b/src/mongo/db/s/config/sharding_catalog_manager.h
diff --git a/src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp
index c2e8d7e9ba6..b0507b34451 100644
--- a/src/mongo/s/catalog/sharding_catalog_add_shard_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp
@@ -38,9 +38,9 @@
#include "mongo/db/commands.h"
#include "mongo/db/ops/write_ops.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/db/s/type_shard_identity.h"
#include "mongo/s/catalog/config_server_version.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_changelog.h"
#include "mongo/s/catalog/type_config_version.h"
#include "mongo/s/catalog/type_database.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_add_shard_to_zone_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_to_zone_test.cpp
index 7eec0fde082..c586f412ed1 100644
--- a/src/mongo/s/catalog/sharding_catalog_add_shard_to_zone_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_to_zone_test.cpp
@@ -30,7 +30,7 @@
#include "mongo/client/read_preference.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard.h"
#include "mongo/s/config_server_test_fixture.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_assign_key_range_to_zone_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_assign_key_range_to_zone_test.cpp
index fa65e3bd070..89b64867b99 100644
--- a/src/mongo/s/catalog/sharding_catalog_assign_key_range_to_zone_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_assign_key_range_to_zone_test.cpp
@@ -31,7 +31,7 @@
#include "mongo/bson/json.h"
#include "mongo/client/read_preference.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/catalog/type_shard.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager_chunk_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
index 72c92bc6625..dca5b5403e8 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager_chunk_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
@@ -30,7 +30,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/base/status_with.h"
#include "mongo/bson/bsonobjbuilder.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp
index 2ae71429ceb..874b87a8dc5 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp
@@ -30,7 +30,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include <iomanip>
#include <set>
diff --git a/src/mongo/s/catalog/sharding_catalog_commit_chunk_migration_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
index c703bb6e9b1..76340441d2c 100644
--- a/src/mongo/s/catalog/sharding_catalog_commit_chunk_migration_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
@@ -32,7 +32,7 @@
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/client/read_preference.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard_registry.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_config_initialization_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_config_initialization_test.cpp
index bfb5234823a..151d1a888a7 100644
--- a/src/mongo/s/catalog/sharding_catalog_config_initialization_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_config_initialization_test.cpp
@@ -38,9 +38,9 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/config_server_version.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_config_version.h"
#include "mongo/s/catalog/type_lockpings.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_create_database_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_create_database_test.cpp
index 6fc126503b9..9e4bdb14ffe 100644
--- a/src/mongo/s/catalog/sharding_catalog_create_database_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_create_database_test.cpp
@@ -37,12 +37,12 @@
#include "mongo/db/commands.h"
#include "mongo/db/query/query_request.h"
#include "mongo/db/repl/read_concern_args.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/executor/task_executor.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
#include "mongo/rpc/metadata/tracking_metadata.h"
#include "mongo/s/catalog/dist_lock_catalog_impl.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog/type_locks.h"
#include "mongo/s/catalog/type_shard.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager_database_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp
index be0e5839d2d..d84ea03282f 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager_database_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp
@@ -28,7 +28,7 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kSharding
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include <pcrecpp.h>
diff --git a/src/mongo/s/catalog/sharding_catalog_drop_coll_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_drop_coll_test.cpp
index 86526197821..1e767b6c0f1 100644
--- a/src/mongo/s/catalog/sharding_catalog_drop_coll_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_drop_coll_test.cpp
@@ -32,8 +32,8 @@
#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/rpc/metadata/tracking_metadata.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/chunk_version.h"
#include "mongo/s/client/shard_registry.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_enable_sharding_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_enable_sharding_test.cpp
index 7ff982e9662..b97b8efbca0 100644
--- a/src/mongo/s/catalog/sharding_catalog_enable_sharding_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_enable_sharding_test.cpp
@@ -37,12 +37,12 @@
#include "mongo/db/commands.h"
#include "mongo/db/query/query_request.h"
#include "mongo/db/repl/read_concern_args.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/executor/task_executor.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
#include "mongo/rpc/metadata/tracking_metadata.h"
#include "mongo/s/catalog/dist_lock_catalog_impl.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog/type_locks.h"
#include "mongo/s/catalog/type_shard.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_merge_chunks_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_merge_chunks_test.cpp
index 32bcb66778a..3d115ec0a80 100644
--- a/src/mongo/s/catalog/sharding_catalog_merge_chunks_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_merge_chunks_test.cpp
@@ -30,8 +30,8 @@
#include "mongo/client/read_preference.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/config_server_test_fixture.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_remove_shard_from_zone_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_from_zone_test.cpp
index 5d0a9ea668a..f3998cab85c 100644
--- a/src/mongo/s/catalog/sharding_catalog_remove_shard_from_zone_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_from_zone_test.cpp
@@ -30,7 +30,7 @@
#include "mongo/client/read_preference.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/catalog/type_tags.h"
#include "mongo/s/client/shard.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_remove_shard_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_test.cpp
index 2db9d9658e0..6def5ee6603 100644
--- a/src/mongo/s/catalog/sharding_catalog_remove_shard_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_remove_shard_test.cpp
@@ -36,11 +36,11 @@
#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/db/commands.h"
#include "mongo/db/ops/write_ops.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/executor/network_interface_mock.h"
#include "mongo/executor/task_executor.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
#include "mongo/rpc/metadata/tracking_metadata.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_changelog.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_database.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_shard_collection_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp
index c2d150bbe3f..35b564c9139 100644
--- a/src/mongo/s/catalog/sharding_catalog_shard_collection_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp
@@ -39,10 +39,10 @@
#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/executor/network_interface_mock.h"
#include "mongo/executor/task_executor.h"
#include "mongo/rpc/metadata/tracking_metadata.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_changelog.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager_shard_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
index ac2582a27f7..e8f93fc34f3 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager_shard_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
@@ -30,7 +30,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include <iomanip>
#include <pcrecpp.h>
diff --git a/src/mongo/s/catalog/sharding_catalog_split_chunk_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_split_chunk_test.cpp
index 07c2301d624..31d3a794d41 100644
--- a/src/mongo/s/catalog/sharding_catalog_split_chunk_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_split_chunk_test.cpp
@@ -30,7 +30,7 @@
#include "mongo/client/read_preference.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/config_server_test_fixture.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager_zone_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_zone_operations.cpp
index b841c7d0ee0..37d783a9a02 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager_zone_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_zone_operations.cpp
@@ -30,7 +30,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/base/status_with.h"
#include "mongo/client/read_preference.h"
diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp
index bccdebf8f21..6f93f3498d6 100644
--- a/src/mongo/db/s/sharding_initialization_mongod.cpp
+++ b/src/mongo/db/s/sharding_initialization_mongod.cpp
@@ -45,7 +45,6 @@
#include "mongo/db/server_options.h"
#include "mongo/executor/task_executor.h"
#include "mongo/rpc/metadata/egress_metadata_hook_list.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/catalog_cache_loader.h"
#include "mongo/s/client/shard_factory.h"
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 16687b6567d..142cbce6cc1 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -121,28 +121,16 @@ env.Library(
)
env.Library(
- target='shard_server_test_fixture',
- source=[
- 'shard_server_test_fixture.cpp',
- ],
- LIBDEPS=[
- 'sharding_mongod_test_fixture',
- '$BUILD_DIR/mongo/s/catalog/dist_lock_catalog_mock',
- '$BUILD_DIR/mongo/s/catalog/dist_lock_manager_mock',
- ],
-)
-
-env.Library(
target='sharding_mongod_test_fixture',
source=[
'sharding_mongod_test_fixture.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/client/remote_command_targeter_mock',
+ '$BUILD_DIR/mongo/db/namespace_string',
'$BUILD_DIR/mongo/db/op_observer_d',
'$BUILD_DIR/mongo/db/repl/drop_pending_collection_reaper',
'$BUILD_DIR/mongo/db/repl/replmocks',
- '$BUILD_DIR/mongo/db/namespace_string',
'$BUILD_DIR/mongo/db/service_context_d_test_fixture',
'$BUILD_DIR/mongo/executor/network_test_env',
'$BUILD_DIR/mongo/executor/task_executor_pool',
@@ -150,18 +138,30 @@ env.Library(
'$BUILD_DIR/mongo/rpc/metadata',
'$BUILD_DIR/mongo/s/catalog/dist_lock_manager_mock',
'$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_manager',
'$BUILD_DIR/mongo/s/coreshard',
'$BUILD_DIR/mongo/util/clock_source_mock',
],
)
env.Library(
+ target='shard_server_test_fixture',
+ source=[
+ 'shard_server_test_fixture.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/s/catalog/dist_lock_catalog_mock',
+ '$BUILD_DIR/mongo/s/catalog/dist_lock_manager_mock',
+ 'sharding_mongod_test_fixture',
+ ],
+)
+
+env.Library(
target='config_server_test_fixture',
source=[
'config_server_test_fixture.cpp',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/s/sharding_catalog_manager',
'sharding_mongod_test_fixture',
],
)
@@ -308,7 +308,7 @@ env.CppUnitTest(
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/query/query_test_service_context',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_test_fixture',
+ '$BUILD_DIR/mongo/s/sharding_test_fixture',
'coreshard',
]
)
diff --git a/src/mongo/s/catalog/SConscript b/src/mongo/s/catalog/SConscript
index 65f757f7413..1913fee75d6 100644
--- a/src/mongo/s/catalog/SConscript
+++ b/src/mongo/s/catalog/SConscript
@@ -16,17 +16,6 @@ env.Library(
)
env.Library(
- target='sharding_catalog_mock',
- source=[
- 'sharding_catalog_client_mock.cpp',
- ],
- LIBDEPS=[
- 'dist_lock_manager_mock',
- 'sharding_catalog_client',
- ]
-)
-
-env.Library(
target='dist_lock_manager',
source=[
'dist_lock_manager.cpp',
@@ -38,17 +27,6 @@ env.Library(
)
env.Library(
- target='dist_lock_manager_mock',
- source=[
- 'dist_lock_manager_mock.cpp',
- ],
- LIBDEPS=[
- 'dist_lock_manager',
- '$BUILD_DIR/mongo/unittest/unittest',
- ],
-)
-
-env.Library(
target='dist_lock_catalog_interface',
source=[
'dist_lock_catalog.cpp',
@@ -59,18 +37,6 @@ env.Library(
)
env.Library(
- target='dist_lock_catalog_mock',
- source=[
- 'dist_lock_catalog_mock.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/s/common_s',
- '$BUILD_DIR/mongo/unittest/unittest',
- 'dist_lock_catalog_interface',
- ]
-)
-
-env.Library(
target='replset_dist_lock_manager',
source=[
'replset_dist_lock_manager.cpp',
@@ -105,21 +71,6 @@ env.Library(
],
)
-env.CppUnitTest(
- target='replset_dist_lock_manager_test',
- source=[
- 'dist_lock_catalog_impl_test.cpp',
- 'replset_dist_lock_manager_test.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/s/catalog/dist_lock_catalog_mock',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_mock',
- '$BUILD_DIR/mongo/s/sharding_mongod_test_fixture',
- 'dist_lock_catalog_impl',
- 'replset_dist_lock_manager',
- ]
-)
-
env.Library(
target='sharding_catalog_client_impl',
source=[
@@ -129,70 +80,64 @@ env.Library(
'$BUILD_DIR/mongo/db/repl/read_concern_args',
'$BUILD_DIR/mongo/db/s/type_shard_identity',
'$BUILD_DIR/mongo/executor/network_interface',
- '$BUILD_DIR/mongo/s/catalog/dist_lock_manager',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client',
'$BUILD_DIR/mongo/s/client/sharding_client',
'$BUILD_DIR/mongo/s/coreshard',
+ 'dist_lock_manager',
+ 'sharding_catalog_client',
],
)
env.Library(
- target='sharding_catalog_manager',
+ target='dist_lock_manager_mock',
source=[
- 'sharding_catalog_manager_chunk_operations.cpp',
- 'sharding_catalog_manager_collection_operations.cpp',
- 'sharding_catalog_manager.cpp',
- 'sharding_catalog_manager_database_operations.cpp',
- 'sharding_catalog_manager_shard_operations.cpp',
- 'sharding_catalog_manager_zone_operations.cpp',
+ 'dist_lock_manager_mock.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/catalog/catalog_raii',
- '$BUILD_DIR/mongo/db/commands/dcommands_fcv',
- '$BUILD_DIR/mongo/db/repl/read_concern_args',
- '$BUILD_DIR/mongo/db/s/balancer',
- '$BUILD_DIR/mongo/executor/network_interface',
- '$BUILD_DIR/mongo/s/client/sharding_client',
- '$BUILD_DIR/mongo/s/coreshard',
- 'sharding_catalog_client',
+ '$BUILD_DIR/mongo/unittest/unittest',
+ 'dist_lock_manager',
],
)
env.Library(
- target='sharding_catalog_test_fixture',
+ target='dist_lock_catalog_mock',
source=[
- 'sharding_catalog_test_fixture.cpp',
+ 'dist_lock_catalog_mock.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/s/sharding_test_fixture',
+ '$BUILD_DIR/mongo/s/common_s',
+ '$BUILD_DIR/mongo/unittest/unittest',
+ 'dist_lock_catalog_interface',
+ ]
+)
+
+env.Library(
+ target='sharding_catalog_client_mock',
+ source=[
+ 'sharding_catalog_client_mock.cpp',
],
+ LIBDEPS=[
+ 'dist_lock_manager_mock',
+ 'sharding_catalog_client',
+ ]
)
env.CppUnitTest(
- target='config_server_catalog_test',
+ target='replset_dist_lock_manager_test',
source=[
- 'sharding_catalog_add_shard_test.cpp',
- 'sharding_catalog_add_shard_to_zone_test.cpp',
- 'sharding_catalog_assign_key_range_to_zone_test.cpp',
- 'sharding_catalog_commit_chunk_migration_test.cpp',
- 'sharding_catalog_config_initialization_test.cpp',
- 'sharding_catalog_create_database_test.cpp',
- 'sharding_catalog_enable_sharding_test.cpp',
- 'sharding_catalog_merge_chunks_test.cpp',
- 'sharding_catalog_remove_shard_from_zone_test.cpp',
- 'sharding_catalog_remove_shard_test.cpp',
- 'sharding_catalog_shard_collection_test.cpp',
- 'sharding_catalog_split_chunk_test.cpp',
- 'sharding_catalog_drop_coll_test.cpp',
+ 'dist_lock_catalog_impl_test.cpp',
+ 'replset_dist_lock_manager_test.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/s/config_server_test_fixture',
- '$BUILD_DIR/mongo/util/version_impl',
+ '$BUILD_DIR/mongo/s/catalog/dist_lock_catalog_mock',
+ '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_mock',
+ '$BUILD_DIR/mongo/s/sharding_mongod_test_fixture',
+ 'dist_lock_catalog_impl',
+ 'replset_dist_lock_manager',
]
)
env.CppUnitTest(
- target='sharding_catalog_test',
+ target='sharding_catalog_client_test',
source=[
'sharding_catalog_log_change_test.cpp',
'sharding_catalog_test.cpp',
@@ -200,6 +145,5 @@ env.CppUnitTest(
],
LIBDEPS=[
'$BUILD_DIR/mongo/s/sharding_test_fixture',
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_test_fixture',
]
)
diff --git a/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp b/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp
index 1dffcecf95e..9e7f354c9c0 100644
--- a/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_log_change_test.cpp
@@ -37,8 +37,8 @@
#include "mongo/executor/network_interface_mock.h"
#include "mongo/executor/task_executor.h"
#include "mongo/s/catalog/sharding_catalog_client_impl.h"
-#include "mongo/s/catalog/sharding_catalog_test_fixture.h"
#include "mongo/s/client/shard_registry.h"
+#include "mongo/s/sharding_test_fixture.h"
#include "mongo/stdx/chrono.h"
#include "mongo/stdx/future.h"
#include "mongo/util/log.h"
@@ -56,7 +56,7 @@ using unittest::assertGet;
const Seconds kFutureTimeout{5};
const HostAndPort configHost{"TestHost1"};
-class InfoLoggingTest : public ShardingCatalogTestFixture {
+class InfoLoggingTest : public ShardingTestFixture {
public:
enum CollType { ActionLog, ChangeLog };
@@ -64,7 +64,7 @@ public:
: _configCollType(configCollType), _cappedSize(cappedSize) {}
void setUp() override {
- ShardingCatalogTestFixture::setUp();
+ ShardingTestFixture::setUp();
configTargeter()->setFindHostReturnValue(configHost);
}
diff --git a/src/mongo/s/catalog/sharding_catalog_test.cpp b/src/mongo/s/catalog/sharding_catalog_test.cpp
index 7db7cedaf2a..d20ab52f4ff 100644
--- a/src/mongo/s/catalog/sharding_catalog_test.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_test.cpp
@@ -45,7 +45,6 @@
#include "mongo/rpc/metadata/tracking_metadata.h"
#include "mongo/s/catalog/dist_lock_manager_mock.h"
#include "mongo/s/catalog/sharding_catalog_client_impl.h"
-#include "mongo/s/catalog/sharding_catalog_test_fixture.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/catalog/type_database.h"
@@ -53,6 +52,7 @@
#include "mongo/s/catalog/type_tags.h"
#include "mongo/s/chunk_version.h"
#include "mongo/s/client/shard_registry.h"
+#include "mongo/s/sharding_test_fixture.h"
#include "mongo/s/versioning.h"
#include "mongo/s/write_ops/batched_command_response.h"
#include "mongo/stdx/future.h"
@@ -72,7 +72,7 @@ using std::string;
using std::vector;
using unittest::assertGet;
-using ShardingCatalogClientTest = ShardingCatalogTestFixture;
+using ShardingCatalogClientTest = ShardingTestFixture;
const int kMaxCommandRetry = 3;
const NamespaceString kNamespace("TestDB", "TestColl");
diff --git a/src/mongo/s/catalog/sharding_catalog_test_fixture.cpp b/src/mongo/s/catalog/sharding_catalog_test_fixture.cpp
deleted file mode 100644
index 092407324f3..00000000000
--- a/src/mongo/s/catalog/sharding_catalog_test_fixture.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright (C) 2015 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/commands.h"
-#include "mongo/s/catalog/sharding_catalog_test_fixture.h"
-
-namespace mongo {
-
-using executor::RemoteCommandRequest;
-
-using std::string;
-
-const string ShardingCatalogTestFixture::CONFIG_HOST_PORT{"$dummy_config:27017"};
-
-ShardingCatalogTestFixture::ShardingCatalogTestFixture() = default;
-
-ShardingCatalogTestFixture::~ShardingCatalogTestFixture() = default;
-
-void ShardingCatalogTestFixture::expectFindOnConfigSendBSONObjVector(std::vector<BSONObj> obj) {
- onFindCommand([&, obj](const RemoteCommandRequest& request) {
- ASSERT_EQ(request.target, HostAndPort(CONFIG_HOST_PORT));
- ASSERT_EQ(request.dbname, "config");
- return obj;
- });
-}
-
-} // namespace mongo
diff --git a/src/mongo/s/catalog/sharding_catalog_test_fixture.h b/src/mongo/s/catalog/sharding_catalog_test_fixture.h
deleted file mode 100644
index f5736de022a..00000000000
--- a/src/mongo/s/catalog/sharding_catalog_test_fixture.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright (C) 2015 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#include <vector>
-
-#include "mongo/s/sharding_test_fixture.h"
-
-namespace mongo {
-
-/**
- * Sets up the mocked out objects for testing the replica-set backed ShardingCatalogManager and
- * ShardingCatalogClient.
- */
-class ShardingCatalogTestFixture : public ShardingTestFixture {
-public:
- ShardingCatalogTestFixture();
- ~ShardingCatalogTestFixture();
-
-protected:
- static const std::string CONFIG_HOST_PORT;
-
- void expectFindOnConfigSendBSONObjVector(std::vector<BSONObj> obj);
-};
-
-} // namespace mongo
diff --git a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp
index d32de61a18e..be76d387b1a 100644
--- a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp
@@ -44,7 +44,6 @@
#include "mongo/rpc/metadata/repl_set_metadata.h"
#include "mongo/s/catalog/dist_lock_manager_mock.h"
#include "mongo/s/catalog/sharding_catalog_client_impl.h"
-#include "mongo/s/catalog/sharding_catalog_test_fixture.h"
#include "mongo/s/catalog/type_changelog.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
@@ -52,6 +51,7 @@
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
+#include "mongo/s/sharding_test_fixture.h"
#include "mongo/s/write_ops/batched_command_response.h"
#include "mongo/stdx/future.h"
#include "mongo/stdx/memory.h"
@@ -69,8 +69,8 @@ using std::string;
using std::vector;
using unittest::assertGet;
-using InsertRetryTest = ShardingCatalogTestFixture;
-using UpdateRetryTest = ShardingCatalogTestFixture;
+using InsertRetryTest = ShardingTestFixture;
+using UpdateRetryTest = ShardingTestFixture;
const NamespaceString kTestNamespace("config.TestColl");
const HostAndPort kTestHosts[] = {
diff --git a/src/mongo/s/catalog_cache_refresh_test.cpp b/src/mongo/s/catalog_cache_refresh_test.cpp
index fc08a4a4fbb..0cb0ba0c887 100644
--- a/src/mongo/s/catalog_cache_refresh_test.cpp
+++ b/src/mongo/s/catalog_cache_refresh_test.cpp
@@ -54,14 +54,14 @@ protected:
}
void expectGetDatabase() {
- expectFindOnConfigSendBSONObjVector([&]() {
+ expectFindSendBSONObjVector(kConfigHostAndPort, [&]() {
DatabaseType db(kNss.db().toString(), {"0"}, true);
return std::vector<BSONObj>{db.toBSON()};
}());
}
void expectGetCollection(OID epoch, const ShardKeyPattern& shardKeyPattern) {
- expectFindOnConfigSendBSONObjVector([&]() {
+ expectFindSendBSONObjVector(kConfigHostAndPort, [&]() {
CollectionType collType;
collType.setNs(kNss);
collType.setEpoch(epoch);
@@ -83,7 +83,7 @@ TEST_F(CatalogCacheRefreshTest, FullLoad) {
expectGetCollection(epoch, shardKeyPattern);
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector([&]() {
+ expectFindSendBSONObjVector(kConfigHostAndPort, [&]() {
ChunkVersion version(1, 0, epoch);
ChunkType chunk1(kNss,
@@ -122,8 +122,8 @@ TEST_F(CatalogCacheRefreshTest, DatabaseNotFound) {
// Return an empty database (need to return it twice because for missing databases, the
// CatalogClient tries twice)
- expectFindOnConfigSendBSONObjVector({});
- expectFindOnConfigSendBSONObjVector({});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {});
try {
auto routingInfo = future.timed_get(kFutureTimeout);
@@ -141,9 +141,10 @@ TEST_F(CatalogCacheRefreshTest, DatabaseBSONCorrupted) {
auto future = scheduleRoutingInfoRefresh(kNss);
// Return a corrupted database entry
- expectFindOnConfigSendBSONObjVector(
- {BSON("BadValue"
- << "This value should not be in a database config document")});
+ expectFindSendBSONObjVector(kConfigHostAndPort,
+ {BSON(
+ "BadValue"
+ << "This value should not be in a database config document")});
try {
auto routingInfo = future.timed_get(kFutureTimeout);
@@ -163,7 +164,7 @@ TEST_F(CatalogCacheRefreshTest, CollectionNotFound) {
expectGetDatabase();
// Return an empty collection
- expectFindOnConfigSendBSONObjVector({});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {});
auto routingInfo = future.timed_get(kFutureTimeout);
ASSERT(!routingInfo->cm());
@@ -177,7 +178,8 @@ TEST_F(CatalogCacheRefreshTest, CollectionBSONCorrupted) {
expectGetDatabase();
// Return a corrupted collection entry
- expectFindOnConfigSendBSONObjVector(
+ expectFindSendBSONObjVector(
+ kConfigHostAndPort,
{BSON("BadValue"
<< "This value should not be in a collection config document")});
@@ -204,13 +206,13 @@ TEST_F(CatalogCacheRefreshTest, NoChunksFoundForCollection) {
// Return no chunks three times, which is how frequently the catalog cache retries
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector({});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {});
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector({});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {});
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector({});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {});
try {
auto routingInfo = future.timed_get(kFutureTimeout);
@@ -235,7 +237,7 @@ TEST_F(CatalogCacheRefreshTest, ChunksBSONCorrupted) {
// Return no chunks three times, which is how frequently the catalog cache retries
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector([&] {
+ expectFindSendBSONObjVector(kConfigHostAndPort, [&] {
return std::vector<BSONObj>{ChunkType(kNss,
{shardKeyPattern.getKeyPattern().globalMin(),
BSON("_id" << 0)},
@@ -293,13 +295,13 @@ TEST_F(CatalogCacheRefreshTest, IncompleteChunksFoundForCollection) {
// Return incomplete set of chunks three times, which is how frequently the catalog cache
// retries
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector(incompleteChunks);
+ expectFindSendBSONObjVector(kConfigHostAndPort, incompleteChunks);
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector(incompleteChunks);
+ expectFindSendBSONObjVector(kConfigHostAndPort, incompleteChunks);
expectGetCollection(epoch, shardKeyPattern);
- expectFindOnConfigSendBSONObjVector(incompleteChunks);
+ expectFindSendBSONObjVector(kConfigHostAndPort, incompleteChunks);
try {
auto routingInfo = future.timed_get(kFutureTimeout);
@@ -340,13 +342,13 @@ TEST_F(CatalogCacheRefreshTest, ChunkEpochChangeDuringIncrementalLoad) {
// Return set of chunks, one of which has different epoch. Do it three times, which is how
// frequently the catalog cache retries.
expectGetCollection(initialRoutingInfo->getVersion().epoch(), shardKeyPattern);
- expectFindOnConfigSendBSONObjVector(inconsistentChunks);
+ expectFindSendBSONObjVector(kConfigHostAndPort, inconsistentChunks);
expectGetCollection(initialRoutingInfo->getVersion().epoch(), shardKeyPattern);
- expectFindOnConfigSendBSONObjVector(inconsistentChunks);
+ expectFindSendBSONObjVector(kConfigHostAndPort, inconsistentChunks);
expectGetCollection(initialRoutingInfo->getVersion().epoch(), shardKeyPattern);
- expectFindOnConfigSendBSONObjVector(inconsistentChunks);
+ expectFindSendBSONObjVector(kConfigHostAndPort, inconsistentChunks);
try {
auto routingInfo = future.timed_get(kFutureTimeout);
@@ -549,7 +551,7 @@ TEST_F(CatalogCacheRefreshTest, IncrementalLoadAfterMove) {
expectGetCollection(version.epoch(), shardKeyPattern);
// Return set of chunks, which represent a move
- expectFindOnConfigSendBSONObjVector([&]() {
+ expectFindSendBSONObjVector(kConfigHostAndPort, [&]() {
version.incMajor();
expectedDestShardVersion = version;
ChunkType chunk1(
@@ -587,7 +589,7 @@ TEST_F(CatalogCacheRefreshTest, IncrementalLoadAfterMoveLastChunk) {
expectGetCollection(version.epoch(), shardKeyPattern);
// Return set of chunks, which represent a move
- expectFindOnConfigSendBSONObjVector([&]() {
+ expectFindSendBSONObjVector(kConfigHostAndPort, [&]() {
version.incMajor();
ChunkType chunk1(kNss,
{shardKeyPattern.getKeyPattern().globalMin(),
diff --git a/src/mongo/s/catalog_cache_test_fixture.cpp b/src/mongo/s/catalog_cache_test_fixture.cpp
index 86890c4a41b..4fcb9803907 100644
--- a/src/mongo/s/catalog_cache_test_fixture.cpp
+++ b/src/mongo/s/catalog_cache_test_fixture.cpp
@@ -51,9 +51,9 @@
namespace mongo {
void CatalogCacheTestFixture::setUp() {
- ShardingCatalogTestFixture::setUp();
+ ShardingTestFixture::setUp();
setRemote(HostAndPort("FakeRemoteClient:34567"));
- configTargeter()->setFindHostReturnValue(HostAndPort{CONFIG_HOST_PORT});
+ configTargeter()->setFindHostReturnValue(kConfigHostAndPort);
CollatorFactoryInterface::set(serviceContext(), stdx::make_unique<CollatorFactoryMock>());
}
@@ -138,10 +138,10 @@ std::shared_ptr<ChunkManager> CatalogCacheTestFixture::makeChunkManager(
auto future = scheduleRoutingInfoRefresh(nss);
- expectFindOnConfigSendBSONObjVector({databaseBSON});
- expectFindOnConfigSendBSONObjVector({collectionBSON});
- expectFindOnConfigSendBSONObjVector({collectionBSON});
- expectFindOnConfigSendBSONObjVector(initialChunks);
+ expectFindSendBSONObjVector(kConfigHostAndPort, {databaseBSON});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {collectionBSON});
+ expectFindSendBSONObjVector(kConfigHostAndPort, {collectionBSON});
+ expectFindSendBSONObjVector(kConfigHostAndPort, initialChunks);
auto routingInfo = future.timed_get(kFutureTimeout);
ASSERT(routingInfo->cm());
diff --git a/src/mongo/s/catalog_cache_test_fixture.h b/src/mongo/s/catalog_cache_test_fixture.h
index 4c620eafee5..439541424c5 100644
--- a/src/mongo/s/catalog_cache_test_fixture.h
+++ b/src/mongo/s/catalog_cache_test_fixture.h
@@ -31,7 +31,7 @@
#include <vector>
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/sharding_catalog_test_fixture.h"
+#include "mongo/s/sharding_test_fixture.h"
#include "mongo/stdx/memory.h"
namespace mongo {
@@ -42,7 +42,7 @@ class ChunkManager;
class CollatorInterface;
class ShardKeyPattern;
-class CatalogCacheTestFixture : public ShardingCatalogTestFixture {
+class CatalogCacheTestFixture : public ShardingTestFixture {
protected:
void setUp() override;
@@ -74,6 +74,8 @@ protected:
* generated as "0", "1", etc.
*/
void setupNShards(int numShards);
+
+ const HostAndPort kConfigHostAndPort{"DummyConfig", 1234};
};
} // namespace mongo
diff --git a/src/mongo/s/config_server_test_fixture.cpp b/src/mongo/s/config_server_test_fixture.cpp
index a7e24e34e25..6e25ade1764 100644
--- a/src/mongo/s/config_server_test_fixture.cpp
+++ b/src/mongo/s/config_server_test_fixture.cpp
@@ -48,6 +48,7 @@
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
+#include "mongo/db/s/config/sharding_catalog_manager.h"
#include "mongo/executor/network_interface_mock.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/executor/thread_pool_task_executor_test_fixture.h"
@@ -57,7 +58,6 @@
#include "mongo/s/catalog/dist_lock_catalog_impl.h"
#include "mongo/s/catalog/replset_dist_lock_manager.h"
#include "mongo/s/catalog/sharding_catalog_client_impl.h"
-#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_changelog.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index 2a38a9a136e..d4673afd1cc 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -30,8 +30,6 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/server.h"
-
#include <boost/optional.hpp>
#include "mongo/base/init.h"
@@ -120,16 +118,22 @@
namespace mongo {
-using std::string;
-using std::vector;
-
using logger::LogComponent;
+#if !defined(__has_feature)
+#define __has_feature(x) 0
+#endif
+
namespace {
-boost::optional<ShardingUptimeReporter> shardingUptimeReporter;
+#if defined(_WIN32)
+const ntservice::NtServiceDefaultStrings defaultServiceStrings = {
+ L"MongoS", L"MongoDB Router", L"MongoDB Sharding Router"};
+#endif
-static constexpr auto kRetryInterval = Seconds{1};
+constexpr auto kSignKeysRetryInterval = Seconds{1};
+
+boost::optional<ShardingUptimeReporter> shardingUptimeReporter;
Status waitForSigningKeys(OperationContext* opCtx) {
auto const shardRegistry = Grid::get(opCtx)->shardRegistry();
@@ -157,38 +161,26 @@ Status waitForSigningKeys(OperationContext* opCtx) {
if (LogicalTimeValidator::get(opCtx)->shouldGossipLogicalTime()) {
return Status::OK();
}
- log() << "Waiting for signing keys, sleeping for " << kRetryInterval
+ log() << "Waiting for signing keys, sleeping for " << kSignKeysRetryInterval
<< " and trying again.";
- sleepFor(kRetryInterval);
+ sleepFor(kSignKeysRetryInterval);
continue;
} catch (const DBException& ex) {
Status status = ex.toStatus();
- warning() << "Error waiting for signing keys, sleeping for " << kRetryInterval
+ warning() << "Error waiting for signing keys, sleeping for " << kSignKeysRetryInterval
<< " and trying again " << causedBy(status);
- sleepFor(kRetryInterval);
+ sleepFor(kSignKeysRetryInterval);
continue;
}
}
}
-} // namespace
-
-#if defined(_WIN32)
-ntservice::NtServiceDefaultStrings defaultServiceStrings = {
- L"MongoS", L"MongoDB Router", L"MongoDB Sharding Router"};
-static ExitCode initService();
-#endif
-
-#if !defined(__has_feature)
-#define __has_feature(x) 0
-#endif
-
-// NOTE: This function may be called at any time after
-// registerShutdownTask is called below. It must not depend on the
-// prior execution of mongo initializers or the existence of threads.
-static void cleanupTask() {
+/**
+ * NOTE: This function may be called at any time after registerShutdownTask is called below. It must
+ * not depend on the prior execution of mongo initializers or the existence of threads.
+ */
+void cleanupTask(ServiceContext* serviceContext) {
{
- auto serviceContext = getGlobalServiceContext();
Client::initThreadIfNotAlready();
Client& client = cc();
ServiceContext::UniqueOperationContext uniqueTxn;
@@ -268,11 +260,7 @@ static void cleanupTask() {
audit::logShutdown(Client::getCurrent());
}
-} // namespace mongo
-
-using namespace mongo;
-
-static Status initializeSharding(OperationContext* opCtx) {
+Status initializeSharding(OperationContext* opCtx) {
auto targeterFactory = stdx::make_unique<RemoteCommandTargeterFactoryImpl>();
auto targeterFactoryPtr = targeterFactory.get();
@@ -332,8 +320,9 @@ static Status initializeSharding(OperationContext* opCtx) {
return Status::OK();
}
-static void _initWireSpec() {
+void initWireSpec() {
WireSpec& spec = WireSpec::instance();
+
// Since the upgrade order calls for upgrading mongos last, it only needs to talk the latest
// wire version. This ensures that users will get errors if they upgrade in the wrong order.
spec.outgoing.minWireVersion = LATEST_WIRE_VERSION;
@@ -342,38 +331,36 @@ static void _initWireSpec() {
spec.isInternalClient = true;
}
-static ExitCode runMongosServer() {
+ExitCode runMongosServer(ServiceContext* serviceContext) {
Client::initThread("mongosMain");
printShardingVersionInfo(false);
- _initWireSpec();
+ initWireSpec();
- auto sep = stdx::make_unique<ServiceEntryPointMongos>(getGlobalServiceContext());
- getGlobalServiceContext()->setServiceEntryPoint(std::move(sep));
+ serviceContext->setServiceEntryPoint(
+ stdx::make_unique<ServiceEntryPointMongos>(serviceContext));
- auto tl = transport::TransportLayerManager::createWithConfig(&serverGlobalParams,
- getGlobalServiceContext());
+ auto tl =
+ transport::TransportLayerManager::createWithConfig(&serverGlobalParams, serviceContext);
auto res = tl->setup();
if (!res.isOK()) {
error() << "Failed to set up listener: " << res;
return EXIT_NET_ERROR;
}
- getGlobalServiceContext()->setTransportLayer(std::move(tl));
+ serviceContext->setTransportLayer(std::move(tl));
auto unshardedHookList = stdx::make_unique<rpc::EgressMetadataHookList>();
+ unshardedHookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext));
unshardedHookList->addHook(
- stdx::make_unique<rpc::LogicalTimeMetadataHook>(getGlobalServiceContext()));
- unshardedHookList->addHook(
- stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(getGlobalServiceContext()));
+ stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext));
// Add sharding hooks to both connection pools - ShardingConnectionHook includes auth hooks
globalConnPool.addHook(new ShardingConnectionHook(false, std::move(unshardedHookList)));
auto shardedHookList = stdx::make_unique<rpc::EgressMetadataHookList>();
+ shardedHookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext));
shardedHookList->addHook(
- stdx::make_unique<rpc::LogicalTimeMetadataHook>(getGlobalServiceContext()));
- shardedHookList->addHook(
- stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(getGlobalServiceContext()));
+ stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext));
shardConnectionPool.addHook(new ShardingConnectionHook(true, std::move(shardedHookList)));
@@ -415,7 +402,7 @@ static ExitCode runMongosServer() {
startMongoSFTDC();
- Status status = getGlobalAuthorizationManager()->initialize(NULL);
+ Status status = AuthorizationManager::get(serviceContext)->initialize(NULL);
if (!status.isOK()) {
error() << "Initializing authorization data failed: " << status;
return EXIT_SHARDING_ERROR;
@@ -428,7 +415,7 @@ static ExitCode runMongosServer() {
clusterCursorCleanupJob.go();
- UserCacheInvalidator cacheInvalidatorThread(getGlobalAuthorizationManager());
+ UserCacheInvalidator cacheInvalidatorThread(AuthorizationManager::get(serviceContext));
{
cacheInvalidatorThread.initialize(opCtx.get());
cacheInvalidatorThread.go();
@@ -439,29 +426,30 @@ static ExitCode runMongosServer() {
// Set up the periodic runner for background job execution
auto runner = makePeriodicRunner();
runner->startup().transitional_ignore();
- getGlobalServiceContext()->setPeriodicRunner(std::move(runner));
+ serviceContext->setPeriodicRunner(std::move(runner));
- SessionKiller::set(
- getGlobalServiceContext(),
- std::make_shared<SessionKiller>(getGlobalServiceContext(), killSessionsRemote));
+ SessionKiller::set(serviceContext,
+ std::make_shared<SessionKiller>(serviceContext, killSessionsRemote));
// Set up the logical session cache
- LogicalSessionCache::set(getGlobalServiceContext(), makeLogicalSessionCacheS());
+ LogicalSessionCache::set(serviceContext, makeLogicalSessionCacheS());
- auto start = getGlobalServiceContext()->getServiceExecutor()->start();
- if (!start.isOK()) {
- error() << "Failed to start the service executor: " << start;
+ status = serviceContext->getServiceExecutor()->start();
+ if (!status.isOK()) {
+ error() << "Failed to start the service executor: " << redact(status);
return EXIT_NET_ERROR;
}
- start = getGlobalServiceContext()->getTransportLayer()->start();
- if (!start.isOK()) {
+ status = serviceContext->getTransportLayer()->start();
+ if (!status.isOK()) {
+ error() << "Failed to start the transport layer: " << redact(status);
return EXIT_NET_ERROR;
}
- getGlobalServiceContext()->notifyStartupComplete();
+ serviceContext->notifyStartupComplete();
+
#if !defined(_WIN32)
- mongo::signalForkSuccess();
+ signalForkSuccess();
#else
if (ntservice::shouldStartService()) {
ntservice::reportStatus(SERVICE_RUNNING);
@@ -474,47 +462,35 @@ static ExitCode runMongosServer() {
return waitForShutdown();
}
-namespace {
-MONGO_INITIALIZER_GENERAL(ForkServer, ("EndStartupOptionHandling"), ("default"))
-(InitializerContext* context) {
- mongo::forkServerOrDie();
- return Status::OK();
-}
-} // namespace
-
-// We set the featureCompatibilityVersion to 3.6 in the mongos and rely on the shards to reject
-// usages of new features if their featureCompatibilityVersion is lower.
-MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion36, ("EndStartupOptionStorage"))
-(InitializerContext* context) {
- mongo::serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
- return Status::OK();
+#if defined(_WIN32)
+ExitCode initService() {
+ return runMongosServer(getGlobalServiceContext());
}
+#endif
-/*
- * This function should contain the startup "actions" that we take based on the startup config. It
+/**
+ * This function should contain the startup "actions" that we take based on the startup config. It
* is intended to separate the actions from "storage" and "validation" of our startup configuration.
*/
-static void startupConfigActions(const std::vector<std::string>& argv) {
+void startupConfigActions(const std::vector<std::string>& argv) {
#if defined(_WIN32)
- vector<string> disallowedOptions;
+ std::vector<std::string> disallowedOptions;
disallowedOptions.push_back("upgrade");
ntservice::configureService(
initService, moe::startupOptionsParsed, defaultServiceStrings, disallowedOptions, argv);
#endif
}
-static int _main() {
- if (!initializeServerGlobalState())
- return EXIT_FAILURE;
-
- startSignalProcessingThread();
+std::unique_ptr<AuthzManagerExternalState> createAuthzManagerExternalStateMongos() {
+ return stdx::make_unique<AuthzManagerExternalStateMongos>();
+}
- getGlobalServiceContext()->setFastClockSource(FastClockSourceFactory::create(Milliseconds{10}));
+ExitCode main(ServiceContext* serviceContext) {
+ serviceContext->setFastClockSource(FastClockSourceFactory::create(Milliseconds{10}));
- auto shardingContext = Grid::get(getGlobalServiceContext());
+ auto const shardingContext = Grid::get(serviceContext);
- // we either have a setting where all processes are in localhost or none are
+ // We either have a setting where all processes are in localhost or none are
std::vector<HostAndPort> configServers = mongosGlobalParams.configdbs.getServers();
for (std::vector<HostAndPort>::const_iterator it = configServers.begin();
it != configServers.end();
@@ -526,35 +502,35 @@ static int _main() {
}
if (configAddr.isLocalHost() != shardingContext->allowLocalHost()) {
- mongo::log(LogComponent::kDefault)
- << "cannot mix localhost and ip addresses in configdbs";
- return 10;
+ log(LogComponent::kDefault) << "cannot mix localhost and ip addresses in configdbs";
+ return EXIT_BADOPTIONS;
}
}
#if defined(_WIN32)
if (ntservice::shouldStartService()) {
ntservice::startService();
- // if we reach here, then we are not running as a service. service installation
- // exits directly and so never reaches here either.
+ // If we reach here, then we are not running as a service. Service installation exits
+ // directly and so never reaches here either.
}
#endif
- return runMongosServer();
+ return runMongosServer(serviceContext);
}
-#if defined(_WIN32)
-namespace mongo {
-static ExitCode initService() {
- return runMongosServer();
+MONGO_INITIALIZER_GENERAL(ForkServer, ("EndStartupOptionHandling"), ("default"))
+(InitializerContext* context) {
+ forkServerOrDie();
+ return Status::OK();
}
-} // namespace mongo
-#endif
-namespace {
-
-std::unique_ptr<AuthzManagerExternalState> createAuthzManagerExternalStateMongos() {
- return stdx::make_unique<AuthzManagerExternalStateMongos>();
+// We set the featureCompatibilityVersion to 3.6 in the mongos and rely on the shards to reject
+// usages of new features if their featureCompatibilityVersion is lower.
+MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion36, ("EndStartupOptionStorage"))
+(InitializerContext* context) {
+ serverGlobalParams.featureCompatibility.setVersion(
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+ return Status::OK();
}
MONGO_INITIALIZER(CreateAuthorizationExternalStateFactory)(InitializerContext* context) {
@@ -578,20 +554,22 @@ MONGO_INITIALIZER_GENERAL(setSSLManagerType, MONGO_NO_PREREQUISITES, ("SSLManage
}
#endif
-int mongoSMain(int argc, char* argv[], char** envp) {
- mongo::setMongos();
+} // namespace
+
+ExitCode mongoSMain(int argc, char* argv[], char** envp) {
+ setMongos();
if (argc < 1)
- return EXIT_FAILURE;
+ return EXIT_BADOPTIONS;
- registerShutdownTask(cleanupTask);
+ registerShutdownTask([&]() { cleanupTask(getGlobalServiceContext()); });
setupSignalHandlers();
- Status status = mongo::runGlobalInitializers(argc, argv, envp);
+ Status status = runGlobalInitializers(argc, argv, envp);
if (!status.isOK()) {
severe(LogComponent::kDefault) << "Failed global initialization: " << status;
- quickExit(EXIT_FAILURE);
+ return EXIT_ABRUPT;
}
ErrorExtraInfo::invariantHaveAllParsers();
@@ -599,23 +577,28 @@ int mongoSMain(int argc, char* argv[], char** envp) {
startupConfigActions(std::vector<std::string>(argv, argv + argc));
cmdline_utils::censorArgvArray(argc, argv);
- mongo::logCommonStartupWarnings(serverGlobalParams);
+ logCommonStartupWarnings(serverGlobalParams);
try {
- int exitCode = _main();
- return exitCode;
+ if (!initializeServerGlobalState())
+ return EXIT_ABRUPT;
+
+ startSignalProcessingThread();
+
+ return main(getGlobalServiceContext());
} catch (const DBException& e) {
error() << "uncaught DBException in mongos main: " << redact(e);
+ return EXIT_UNCAUGHT;
} catch (const std::exception& e) {
error() << "uncaught std::exception in mongos main:" << redact(e.what());
+ return EXIT_UNCAUGHT;
} catch (...) {
error() << "uncaught unknown exception in mongos main";
+ return EXIT_UNCAUGHT;
}
-
- return 20;
}
-} // namespace
+} // namespace mongo
#if defined(_WIN32)
// In Windows, wmain() is an alternate entry point for main(), and receives the same parameters
@@ -624,13 +607,11 @@ int mongoSMain(int argc, char* argv[], char** envp) {
// and makes them available through the argv() and envp() members. This enables mongoSMain()
// to process UTF-8 encoded arguments and environment variables without regard to platform.
int wmain(int argc, wchar_t* argvW[], wchar_t* envpW[]) {
- WindowsCommandLine wcl(argc, argvW, envpW);
- int exitCode = mongoSMain(argc, wcl.argv(), wcl.envp());
- exitCleanly(ExitCode(exitCode));
+ mongo::WindowsCommandLine wcl(argc, argvW, envpW);
+ mongo::exitCleanly(mongo::mongoSMain(argc, wcl.argv(), wcl.envp()));
}
#else
int main(int argc, char* argv[], char** envp) {
- int exitCode = mongoSMain(argc, argv, envp);
- exitCleanly(ExitCode(exitCode));
+ mongo::exitCleanly(mongo::mongoSMain(argc, argv, envp));
}
#endif
diff --git a/src/mongo/s/server.h b/src/mongo/s/server.h
deleted file mode 100644
index 6466e001d13..00000000000
--- a/src/mongo/s/server.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// server.h
-
-/**
-* Copyright (C) 2008 10gen Inc.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License, version 3,
-* as published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* As a special exception, the copyright holders give permission to link the
-* code of portions of this program with the OpenSSL library under certain
-* conditions as described in each individual source file and distribute
-* linked combinations including the program with the OpenSSL library. You
-* must comply with the GNU Affero General Public License in all respects
-* for all of the code used other than as permitted herein. If you modify
-* file(s) with this exception, you may extend this exception to your
-* version of the file(s), but you are not obligated to do so. If you do not
-* wish to do so, delete this exception statement from your version. If you
-* delete this exception statement from all source files in the program,
-* then also delete it in the license file.
-*/
-
-#include <string>
-
-#include "mongo/db/jsobj.h"
-
-namespace mongo {
-
-class AbstractMessagingPort;
-class Message;
-
-extern OID serverID;
-
-// from request.cpp
-void processRequest(Message& m, AbstractMessagingPort& p);
-}
diff --git a/src/mongo/s/shard_server_test_fixture.cpp b/src/mongo/s/shard_server_test_fixture.cpp
index 0efca5710f6..e246e4b621a 100644
--- a/src/mongo/s/shard_server_test_fixture.cpp
+++ b/src/mongo/s/shard_server_test_fixture.cpp
@@ -67,14 +67,6 @@ void ShardServerTestFixture::expectFindOnConfigSendErrorCode(ErrorCodes::Error c
});
}
-void ShardServerTestFixture::expectFindOnConfigSendBSONObjVector(std::vector<BSONObj> obj) {
- onFindCommand([&, obj](const executor::RemoteCommandRequest& request) {
- ASSERT_EQ(request.target, kConfigHostAndPort);
- ASSERT_EQ(request.dbname, "config");
- return obj;
- });
-}
-
void ShardServerTestFixture::setUp() {
ShardingMongodTestFixture::setUp();
diff --git a/src/mongo/s/shard_server_test_fixture.h b/src/mongo/s/shard_server_test_fixture.h
index b6f59137b97..6fe244964aa 100644
--- a/src/mongo/s/shard_server_test_fixture.h
+++ b/src/mongo/s/shard_server_test_fixture.h
@@ -58,8 +58,6 @@ public:
void expectFindOnConfigSendErrorCode(ErrorCodes::Error code);
- void expectFindOnConfigSendBSONObjVector(std::vector<BSONObj> obj);
-
protected:
/**
* Sets up a ClusterRole::ShardServer replica set with a real catalog client and mock dist lock
diff --git a/src/mongo/s/sharding_test_fixture.cpp b/src/mongo/s/sharding_test_fixture.cpp
index b33a434c637..b9495d65e7a 100644
--- a/src/mongo/s/sharding_test_fixture.cpp
+++ b/src/mongo/s/sharding_test_fixture.cpp
@@ -522,6 +522,15 @@ void ShardingTestFixture::expectCount(const HostAndPort& configHost,
});
}
+void ShardingTestFixture::expectFindSendBSONObjVector(const HostAndPort& configHost,
+ std::vector<BSONObj> obj) {
+ onFindCommand([&, obj](const RemoteCommandRequest& request) {
+ ASSERT_EQ(request.target, configHost);
+ ASSERT_EQ(request.dbname, "config");
+ return obj;
+ });
+}
+
void ShardingTestFixture::setRemote(const HostAndPort& remote) {
_transportSession = transport::MockSession::create(remote, HostAndPort{}, _transportLayer);
}
diff --git a/src/mongo/s/sharding_test_fixture.h b/src/mongo/s/sharding_test_fixture.h
index 0e33ac1c562..49b28d46efa 100644
--- a/src/mongo/s/sharding_test_fixture.h
+++ b/src/mongo/s/sharding_test_fixture.h
@@ -144,6 +144,12 @@ protected:
const NamespaceString& expectedNs,
const BSONObj& expectedQuery,
const StatusWith<long long>& response);
+
+ /**
+ *
+ */
+ void expectFindSendBSONObjVector(const HostAndPort& configHost, std::vector<BSONObj> obj);
+
/**
* Waits for an operation which creates a capped config collection with the specified name and
* capped size.