summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-01-24 08:39:12 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-01-29 13:43:56 -0500
commit1162812624d110c52ac73a548f43b2d7f9ecf46c (patch)
tree7fe0bcbd604e654302ca83be3484a30c99a0c0a5 /src
parent2487ab101a42434e1f61e68ee7c2383432861f8b (diff)
downloadmongo-1162812624d110c52ac73a548f43b2d7f9ecf46c.tar.gz
SERVER-32901 Consolidate sharding libraries
Also gets rid of most usages of the std::string variant of CollectionShardingState::get.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/SConscript2
-rw-r--r--src/mongo/db/commands/create_indexes.cpp8
-rw-r--r--src/mongo/db/op_observer_impl.cpp6
-rw-r--r--src/mongo/db/s/SConscript2
-rw-r--r--src/mongo/db/s/active_migrations_registry.h2
-rw-r--r--src/mongo/db/s/active_migrations_registry_test.cpp2
-rw-r--r--src/mongo/db/s/balancer/migration_manager.cpp2
-rw-r--r--src/mongo/db/s/balancer/migration_manager.h2
-rw-r--r--src/mongo/db/s/balancer/migration_manager_test.cpp2
-rw-r--r--src/mongo/db/s/balancer/scoped_migration_request.h2
-rw-r--r--src/mongo/db/s/balancer/scoped_migration_request_test.cpp2
-rw-r--r--src/mongo/db/s/chunk_move_write_concern_options.cpp2
-rw-r--r--src/mongo/db/s/cleanup_orphaned_cmd.cpp4
-rw-r--r--src/mongo/db/s/config/configsvr_shard_collection_command.cpp2
-rw-r--r--src/mongo/db/s/merge_chunks_command.cpp4
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy.h2
-rw-r--r--src/mongo/db/s/migration_destination_manager_legacy_commands.cpp2
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp7
-rw-r--r--src/mongo/db/s/migration_source_manager.h2
-rw-r--r--src/mongo/db/s/move_chunk_command.cpp4
-rw-r--r--src/mongo/db/s/split_chunk.cpp2
-rw-r--r--src/mongo/db/s/start_chunk_clone_request.h2
-rw-r--r--src/mongo/s/SConscript81
-rw-r--r--src/mongo/s/balancer_configuration.h2
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client_impl.cpp2
-rw-r--r--src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp2
-rw-r--r--src/mongo/s/client/SConscript2
-rw-r--r--src/mongo/s/client/sharding_network_connection_hook.cpp2
-rw-r--r--src/mongo/s/client/version_manager.cpp2
-rw-r--r--src/mongo/s/commands/cluster_move_chunk_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_shard_collection_cmd.cpp2
-rw-r--r--src/mongo/s/config_server_test_fixture.cpp2
-rw-r--r--src/mongo/s/request_types/balance_chunk_request_type.h2
-rw-r--r--src/mongo/s/request_types/migration_secondary_throttle_options.cpp (renamed from src/mongo/s/migration_secondary_throttle_options.cpp)2
-rw-r--r--src/mongo/s/request_types/migration_secondary_throttle_options.h (renamed from src/mongo/s/migration_secondary_throttle_options.h)0
-rw-r--r--src/mongo/s/request_types/migration_secondary_throttle_options_test.cpp (renamed from src/mongo/s/migration_secondary_throttle_options_test.cpp)2
-rw-r--r--src/mongo/s/request_types/move_chunk_request.cpp (renamed from src/mongo/s/move_chunk_request.cpp)2
-rw-r--r--src/mongo/s/request_types/move_chunk_request.h (renamed from src/mongo/s/move_chunk_request.h)2
-rw-r--r--src/mongo/s/request_types/move_chunk_request_test.cpp (renamed from src/mongo/s/move_chunk_request_test.cpp)2
-rw-r--r--src/mongo/s/request_types/set_shard_version_request.cpp (renamed from src/mongo/s/set_shard_version_request.cpp)2
-rw-r--r--src/mongo/s/request_types/set_shard_version_request.h (renamed from src/mongo/s/set_shard_version_request.h)0
-rw-r--r--src/mongo/s/request_types/set_shard_version_request_test.cpp (renamed from src/mongo/s/set_shard_version_request_test.cpp)2
-rw-r--r--src/mongo/s/shard_id.h2
-rw-r--r--src/mongo/s/sharding_mongod_test_fixture.cpp2
-rw-r--r--src/mongo/s/sharding_test_fixture.cpp2
-rw-r--r--src/mongo/s/versioning.cpp18
-rw-r--r--src/mongo/s/versioning.h8
47 files changed, 92 insertions, 120 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index aab2e95dc36..afe4693791f 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -875,7 +875,6 @@ env.Library(
"$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl",
"$BUILD_DIR/mongo/s/client/sharding_connection_hook",
"$BUILD_DIR/mongo/s/coreshard",
- "$BUILD_DIR/mongo/s/shard_id",
"$BUILD_DIR/mongo/scripting/scripting_server",
"$BUILD_DIR/mongo/util/clock_sources",
"$BUILD_DIR/mongo/util/elapsed_tracker",
@@ -1142,7 +1141,6 @@ env.Library(
'$BUILD_DIR/mongo/s/client/sharding_client',
'$BUILD_DIR/mongo/s/commands/shared_cluster_commands',
'$BUILD_DIR/mongo/s/coreshard',
- '$BUILD_DIR/mongo/s/sharding_request_types',
'dbdirectclient',
'sessions_collection',
'sessions_collection_sharded',
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 63f94e9f5cf..036e8dc5148 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -319,7 +319,7 @@ public:
for (size_t i = 0; i < specs.size(); i++) {
const BSONObj& spec = specs[i];
if (spec["unique"].trueValue()) {
- status = checkUniqueIndexConstraints(opCtx, ns.ns(), spec["key"].Obj());
+ status = checkUniqueIndexConstraints(opCtx, ns, spec["key"].Obj());
if (!status.isOK()) {
return CommandHelpers::appendCommandStatus(result, status);
@@ -408,11 +408,11 @@ public:
private:
static Status checkUniqueIndexConstraints(OperationContext* opCtx,
- StringData ns,
+ const NamespaceString& nss,
const BSONObj& newIdxKey) {
- invariant(opCtx->lockState()->isCollectionLockedForMode(ns, MODE_X));
+ invariant(opCtx->lockState()->isCollectionLockedForMode(nss.ns(), MODE_X));
- auto metadata(CollectionShardingState::get(opCtx, ns.toString())->getMetadata());
+ auto metadata(CollectionShardingState::get(opCtx, nss)->getMetadata());
if (metadata) {
ShardKeyPattern shardKeyPattern(metadata->getKeyPattern());
if (!shardKeyPattern.isUniqueIndexCompatible(newIdxKey)) {
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp
index 0eba11776e8..4323e783738 100644
--- a/src/mongo/db/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer_impl.cpp
@@ -319,7 +319,7 @@ void OpObserverImpl::onInserts(OperationContext* opCtx,
auto css = (nss == NamespaceString::kSessionTransactionsTableNamespace || fromMigrate)
? nullptr
- : CollectionShardingState::get(opCtx, nss.ns());
+ : CollectionShardingState::get(opCtx, nss);
size_t index = 0;
for (auto it = begin; it != end; it++, index++) {
@@ -415,7 +415,7 @@ void OpObserverImpl::aboutToDelete(OperationContext* opCtx,
NamespaceString const& nss,
BSONObj const& doc) {
auto& deleteState = getDeleteState(opCtx);
- auto* css = CollectionShardingState::get(opCtx, nss.ns());
+ auto* css = CollectionShardingState::get(opCtx, nss);
deleteState = css->makeDeleteState(doc);
}
@@ -436,7 +436,7 @@ void OpObserverImpl::onDelete(OperationContext* opCtx,
if (nss != NamespaceString::kSessionTransactionsTableNamespace) {
if (!fromMigrate) {
- auto css = CollectionShardingState::get(opCtx, nss.ns());
+ auto css = CollectionShardingState::get(opCtx, nss);
css->onDeleteOp(opCtx, deleteState, opTime.writeOpTime, opTime.prePostImageOpTime);
}
}
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index c6929a5c1b1..b5c82cdae1d 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -106,7 +106,6 @@ env.Library(
'$BUILD_DIR/mongo/s/coreshard',
'$BUILD_DIR/mongo/s/is_mongos',
'$BUILD_DIR/mongo/s/sharding_initialization',
- '$BUILD_DIR/mongo/s/sharding_request_types',
'$BUILD_DIR/mongo/util/elapsed_tracker',
'balancer',
'collection_metadata',
@@ -205,7 +204,6 @@ env.Library(
'$BUILD_DIR/mongo/db/rw_concern_d',
'$BUILD_DIR/mongo/s/catalog/sharding_catalog_manager',
'$BUILD_DIR/mongo/s/commands/shared_cluster_commands',
- '$BUILD_DIR/mongo/s/sharding_request_types',
'balancer',
'collection_metadata',
'sharding',
diff --git a/src/mongo/db/s/active_migrations_registry.h b/src/mongo/db/s/active_migrations_registry.h
index 982cb2f8b26..a36699d09cf 100644
--- a/src/mongo/db/s/active_migrations_registry.h
+++ b/src/mongo/db/s/active_migrations_registry.h
@@ -32,7 +32,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/db/s/migration_session_id.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/mutex.h"
#include "mongo/util/concurrency/notification.h"
diff --git a/src/mongo/db/s/active_migrations_registry_test.cpp b/src/mongo/db/s/active_migrations_registry_test.cpp
index 7907434e0d0..d336ba0362d 100644
--- a/src/mongo/db/s/active_migrations_registry_test.cpp
+++ b/src/mongo/db/s/active_migrations_registry_test.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/client.h"
#include "mongo/db/s/active_migrations_registry.h"
#include "mongo/db/service_context_noop.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/db/s/balancer/migration_manager.cpp b/src/mongo/db/s/balancer/migration_manager.cpp
index 5eb1d625b3e..0beffad2508 100644
--- a/src/mongo/db/s/balancer/migration_manager.cpp
+++ b/src/mongo/db/s/balancer/migration_manager.cpp
@@ -48,7 +48,7 @@
#include "mongo/s/catalog_cache.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/util/log.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/db/s/balancer/migration_manager.h b/src/mongo/db/s/balancer/migration_manager.h
index a99b5696d80..4d5418b1066 100644
--- a/src/mongo/db/s/balancer/migration_manager.h
+++ b/src/mongo/db/s/balancer/migration_manager.h
@@ -39,7 +39,7 @@
#include "mongo/db/s/balancer/type_migration.h"
#include "mongo/executor/task_executor.h"
#include "mongo/s/catalog/dist_lock_manager.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/stdx/condition_variable.h"
#include "mongo/stdx/mutex.h"
#include "mongo/stdx/unordered_map.h"
diff --git a/src/mongo/db/s/balancer/migration_manager_test.cpp b/src/mongo/db/s/balancer/migration_manager_test.cpp
index 82be67e10a4..70718a25504 100644
--- a/src/mongo/db/s/balancer/migration_manager_test.cpp
+++ b/src/mongo/db/s/balancer/migration_manager_test.cpp
@@ -41,7 +41,7 @@
#include "mongo/s/catalog/type_locks.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/config_server_test_fixture.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/db/s/balancer/scoped_migration_request.h b/src/mongo/db/s/balancer/scoped_migration_request.h
index b3f100d92d6..de56546b955 100644
--- a/src/mongo/db/s/balancer/scoped_migration_request.h
+++ b/src/mongo/db/s/balancer/scoped_migration_request.h
@@ -30,7 +30,7 @@
#include "mongo/base/status_with.h"
#include "mongo/db/s/balancer/balancer_policy.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
namespace mongo {
diff --git a/src/mongo/db/s/balancer/scoped_migration_request_test.cpp b/src/mongo/db/s/balancer/scoped_migration_request_test.cpp
index 10fb8da0e22..1aab0157210 100644
--- a/src/mongo/db/s/balancer/scoped_migration_request_test.cpp
+++ b/src/mongo/db/s/balancer/scoped_migration_request_test.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/s/balancer/type_migration.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/config_server_test_fixture.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
namespace mongo {
namespace {
diff --git a/src/mongo/db/s/chunk_move_write_concern_options.cpp b/src/mongo/db/s/chunk_move_write_concern_options.cpp
index 641571c2e2b..2f2d7452b7b 100644
--- a/src/mongo/db/s/chunk_move_write_concern_options.cpp
+++ b/src/mongo/db/s/chunk_move_write_concern_options.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/service_context.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/s/cleanup_orphaned_cmd.cpp b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
index 623312b1cdd..afadefadbd4 100644
--- a/src/mongo/db/s/cleanup_orphaned_cmd.cpp
+++ b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/service_context.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/util/log.h"
namespace mongo {
@@ -77,7 +77,7 @@ CleanupResult cleanupOrphanedData(OperationContext* opCtx,
{
AutoGetCollection autoColl(opCtx, ns, MODE_IX);
- const auto css = CollectionShardingState::get(opCtx, ns.toString());
+ const auto css = CollectionShardingState::get(opCtx, ns);
auto metadata = css->getMetadata();
if (!metadata) {
log() << "skipping orphaned data cleanup for " << ns.toString()
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 64cc9986f58..00cfa9f1710 100644
--- a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp
+++ b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp
@@ -56,7 +56,7 @@
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/config_server_client.h"
#include "mongo/s/grid.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/s/request_types/shard_collection_gen.h"
#include "mongo/s/shard_util.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/s/merge_chunks_command.cpp b/src/mongo/db/s/merge_chunks_command.cpp
index da9755d5383..4e8c9c768e0 100644
--- a/src/mongo/db/s/merge_chunks_command.cpp
+++ b/src/mongo/db/s/merge_chunks_command.cpp
@@ -60,7 +60,7 @@ bool checkMetadataForSuccess(OperationContext* opCtx,
const BSONObj& maxKey) {
const auto metadataAfterMerge = [&] {
AutoGetCollection autoColl(opCtx, nss, MODE_IS);
- return CollectionShardingState::get(opCtx, nss.ns())->getMetadata();
+ return CollectionShardingState::get(opCtx, nss)->getMetadata();
}();
uassert(ErrorCodes::StaleEpoch,
@@ -115,7 +115,7 @@ Status mergeChunks(OperationContext* opCtx,
const auto metadata = [&] {
AutoGetCollection autoColl(opCtx, nss, MODE_IS);
- return CollectionShardingState::get(opCtx, nss.ns())->getMetadata();
+ return CollectionShardingState::get(opCtx, nss)->getMetadata();
}();
if (!metadata) {
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.h b/src/mongo/db/s/migration_chunk_cloner_source_legacy.h
index 1bdad9ee4c7..28981b21c15 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.h
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.h
@@ -39,7 +39,7 @@
#include "mongo/db/s/migration_chunk_cloner_source.h"
#include "mongo/db/s/migration_session_id.h"
#include "mongo/db/s/session_catalog_migration_source.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/s/shard_key_pattern.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/mutex.h"
diff --git a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
index 007288ff96d..c598a5db337 100644
--- a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
+++ b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/s/chunk_move_write_concern_options.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/s/chunk_version.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index f50e23bb550..7e931c1979f 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -51,7 +51,7 @@
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
#include "mongo/s/request_types/commit_chunk_migration_request_type.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/s/shard_key_pattern.h"
#include "mongo/s/stale_exception.h"
#include "mongo/stdx/memory.h"
@@ -240,7 +240,7 @@ Status MigrationSourceManager::startClone(OperationContext* opCtx) {
{
// Register for notifications from the replication subsystem
AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_X);
- auto css = CollectionShardingState::get(opCtx, getNss().ns());
+ auto css = CollectionShardingState::get(opCtx, getNss());
const auto metadata = css->getMetadata();
Status status = checkCollectionEpochMatches(metadata, _collectionEpoch);
@@ -650,8 +650,7 @@ void MigrationSourceManager::_cleanup(OperationContext* opCtx) {
auto cloneDriver = [&]() {
// Unregister from the collection's sharding state
AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_X);
-
- auto css = CollectionShardingState::get(opCtx, getNss().ns());
+ auto css = CollectionShardingState::get(opCtx, getNss());
// The migration source manager is not visible anymore after it is unregistered from the
// collection
diff --git a/src/mongo/db/s/migration_source_manager.h b/src/mongo/db/s/migration_source_manager.h
index 635fed591f7..050fd8e43bf 100644
--- a/src/mongo/db/s/migration_source_manager.h
+++ b/src/mongo/db/s/migration_source_manager.h
@@ -32,7 +32,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/db/s/collection_sharding_state.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/util/concurrency/notification.h"
#include "mongo/util/timer.h"
diff --git a/src/mongo/db/s/move_chunk_command.cpp b/src/mongo/db/s/move_chunk_command.cpp
index f736f1b8d2e..c2dbc58e076 100644
--- a/src/mongo/db/s/move_chunk_command.cpp
+++ b/src/mongo/db/s/move_chunk_command.cpp
@@ -43,8 +43,8 @@
#include "mongo/db/s/sharding_state.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/util/concurrency/notification.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/s/split_chunk.cpp b/src/mongo/db/s/split_chunk.cpp
index 181fa43c1fa..c8c9015a1d3 100644
--- a/src/mongo/db/s/split_chunk.cpp
+++ b/src/mongo/db/s/split_chunk.cpp
@@ -97,7 +97,7 @@ bool checkMetadataForSuccessfulSplitChunk(OperationContext* opCtx,
const std::vector<BSONObj>& splitKeys) {
const auto metadataAfterSplit = [&] {
AutoGetCollection autoColl(opCtx, nss, MODE_IS);
- return CollectionShardingState::get(opCtx, nss.ns())->getMetadata();
+ return CollectionShardingState::get(opCtx, nss)->getMetadata();
}();
uassert(ErrorCodes::StaleEpoch,
diff --git a/src/mongo/db/s/start_chunk_clone_request.h b/src/mongo/db/s/start_chunk_clone_request.h
index 8b21a664243..8f2700d863c 100644
--- a/src/mongo/db/s/start_chunk_clone_request.h
+++ b/src/mongo/db/s/start_chunk_clone_request.h
@@ -33,7 +33,7 @@
#include "mongo/client/connection_string.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/s/migration_session_id.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/s/shard_id.h"
namespace mongo {
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 2c4b0bee9f8..2e09b51ec2a 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -38,17 +38,6 @@ env.Library(
],
)
-# Functionality shared between mongod and mongos
-env.Library(
- target='shard_id',
- source=[
- 'shard_id.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- ]
-)
-
env.Library(
target="async_requests_sender",
source=[
@@ -78,48 +67,35 @@ env.Library(
'catalog/type_shard.cpp',
'catalog/type_shard_collection.cpp',
'catalog/type_tags.cpp',
+ 'chunk_version.cpp',
'request_types/add_shard_request_type.cpp',
'request_types/add_shard_to_zone_request_type.cpp',
'request_types/balance_chunk_request_type.cpp',
'request_types/commit_chunk_migration_request_type.cpp',
+ 'request_types/merge_chunk_request_type.cpp',
+ 'request_types/migration_secondary_throttle_options.cpp',
+ 'request_types/move_chunk_request.cpp',
'request_types/remove_shard_from_zone_request_type.cpp',
+ 'request_types/set_shard_version_request.cpp',
'request_types/split_chunk_request_type.cpp',
- 'request_types/merge_chunk_request_type.cpp',
'request_types/update_zone_key_range_request_type.cpp',
- 'chunk_version.cpp',
- 'migration_secondary_throttle_options.cpp',
- 'move_chunk_request.cpp',
- 'set_shard_version_request.cpp',
- 'shard_key_pattern.cpp',
- env.Idlc('database_version.idl')[0],
+ 'shard_id.cpp',
'versioning.cpp',
+ env.Idlc('database_version.idl')[0],
+ env.Idlc('request_types/create_database.idl')[0],
+ env.Idlc('request_types/flush_routing_table_cache_updates.idl')[0],
+ env.Idlc('request_types/move_primary.idl')[0],
+ env.Idlc('request_types/shard_collection.idl')[0],
],
LIBDEPS=[
- 'shard_id',
- 'sharding_request_types',
'$BUILD_DIR/mongo/client/connection_string',
'$BUILD_DIR/mongo/db/common',
- '$BUILD_DIR/mongo/db/matcher/expressions',
- '$BUILD_DIR/mongo/db/query/query_planner',
+ '$BUILD_DIR/mongo/db/namespace_string',
'$BUILD_DIR/mongo/db/query/query_request',
'$BUILD_DIR/mongo/db/repl/optime',
- '$BUILD_DIR/mongo/db/update/update_common',
- '$BUILD_DIR/mongo/rpc/metadata',
- ]
-)
-
-env.Library(
- target='sharding_request_types',
- source=[
- env.Idlc('request_types/create_database.idl')[0],
- env.Idlc('request_types/move_primary.idl')[0],
- env.Idlc('request_types/shard_collection.idl')[0],
- env.Idlc('request_types/flush_routing_table_cache_updates.idl')[0],
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/idl/idl_parser',
- ],
+ '$BUILD_DIR/mongo/util/uuid',
+ ]
)
env.Library(
@@ -203,16 +179,6 @@ env.CppUnitTest(
)
env.CppUnitTest(
- target='shard_id_test',
- source=[
- 'shard_id_test.cpp',
- ],
- LIBDEPS=[
- 'common_s',
- ]
-)
-
-env.CppUnitTest(
target='sharding_common_test',
source=[
'catalog/type_changelog_test.cpp',
@@ -223,14 +189,11 @@ env.CppUnitTest(
'catalog/type_lockpings_test.cpp',
'catalog/type_locks_test.cpp',
'catalog/type_mongos_test.cpp',
- 'catalog/type_shard_test.cpp',
'catalog/type_shard_collection_test.cpp',
+ 'catalog/type_shard_test.cpp',
'catalog/type_tags_test.cpp',
'chunk_version_test.cpp',
- 'migration_secondary_throttle_options_test.cpp',
- 'move_chunk_request_test.cpp',
- 'set_shard_version_request_test.cpp',
- 'shard_key_pattern_test.cpp',
+ 'shard_id_test.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/query/query_test_service_context',
@@ -244,9 +207,12 @@ env.CppUnitTest('request_types_test',
'request_types/add_shard_to_zone_request_test.cpp',
'request_types/balance_chunk_request_test.cpp',
'request_types/commit_chunk_migration_request_test.cpp',
+ 'request_types/merge_chunk_request_test.cpp',
+ 'request_types/migration_secondary_throttle_options_test.cpp',
+ 'request_types/move_chunk_request_test.cpp',
'request_types/remove_shard_from_zone_request_test.cpp',
+ 'request_types/set_shard_version_request_test.cpp',
'request_types/split_chunk_request_test.cpp',
- 'request_types/merge_chunk_request_test.cpp',
'request_types/update_zone_key_range_request_test.cpp',
],
LIBDEPS=[
@@ -259,9 +225,13 @@ env.Library(
source=[
'chunk.cpp',
'chunk_manager.cpp',
+ 'shard_key_pattern.cpp',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/matcher/expressions',
+ '$BUILD_DIR/mongo/db/query/query_planner',
'$BUILD_DIR/mongo/db/storage/key_string',
+ '$BUILD_DIR/mongo/db/update/update_common',
'common_s',
],
)
@@ -315,12 +285,13 @@ env.Library(
)
env.CppUnitTest(
- target='catalog_cache_test',
+ target='routing_table_test',
source=[
'catalog_cache_refresh_test.cpp',
'catalog_cache_test_fixture.cpp',
'chunk_manager_index_bounds_test.cpp',
'chunk_manager_query_test.cpp',
+ 'shard_key_pattern_test.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/query/query_test_service_context',
diff --git a/src/mongo/s/balancer_configuration.h b/src/mongo/s/balancer_configuration.h
index 71a3832f537..831848d7536 100644
--- a/src/mongo/s/balancer_configuration.h
+++ b/src/mongo/s/balancer_configuration.h
@@ -34,7 +34,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/platform/atomic_word.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/stdx/mutex.h"
namespace mongo {
diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
index 0d2633627c2..19e83ed737d 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
@@ -68,7 +68,7 @@
#include "mongo/s/client/shard_connection.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/s/shard_key_pattern.h"
#include "mongo/s/shard_util.h"
#include "mongo/s/write_ops/batched_command_request.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp b/src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp
index 9439fd7f85a..0576f4d59bd 100644
--- a/src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_manager_collection_operations.cpp
@@ -57,7 +57,7 @@
#include "mongo/s/client/shard.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/s/shard_key_pattern.h"
#include "mongo/s/shard_util.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/client/SConscript b/src/mongo/s/client/SConscript
index 80a27409895..5a5019433bb 100644
--- a/src/mongo/s/client/SConscript
+++ b/src/mongo/s/client/SConscript
@@ -87,7 +87,7 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/client/remote_command_retry_scheduler',
- '$BUILD_DIR/mongo/s/shard_id',
+ '$BUILD_DIR/mongo/s/common_s',
'$BUILD_DIR/mongo/s/write_ops/batch_write_types',
]
)
diff --git a/src/mongo/s/client/sharding_network_connection_hook.cpp b/src/mongo/s/client/sharding_network_connection_hook.cpp
index 9133a97e697..8486fe2ff4f 100644
--- a/src/mongo/s/client/sharding_network_connection_hook.cpp
+++ b/src/mongo/s/client/sharding_network_connection_hook.cpp
@@ -38,7 +38,7 @@
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/hostandport.h"
diff --git a/src/mongo/s/client/version_manager.cpp b/src/mongo/s/client/version_manager.cpp
index 729144f4bb3..27016c0a566 100644
--- a/src/mongo/s/client/version_manager.cpp
+++ b/src/mongo/s/client/version_manager.cpp
@@ -42,7 +42,7 @@
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
#include "mongo/s/is_mongos.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/s/stale_exception.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
index 954da092625..19ac5c51cea 100644
--- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
+++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
@@ -44,7 +44,7 @@
#include "mongo/s/commands/cluster_commands_helpers.h"
#include "mongo/s/config_server_client.h"
#include "mongo/s/grid.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/util/log.h"
#include "mongo/util/timer.h"
diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
index 0c9df731b06..a7281fa85f9 100644
--- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
+++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
@@ -58,7 +58,7 @@
#include "mongo/s/commands/cluster_write.h"
#include "mongo/s/config_server_client.h"
#include "mongo/s/grid.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/s/request_types/shard_collection_gen.h"
#include "mongo/util/log.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/s/config_server_test_fixture.cpp b/src/mongo/s/config_server_test_fixture.cpp
index e6b47f65a9a..d6260b1984d 100644
--- a/src/mongo/s/config_server_test_fixture.cpp
+++ b/src/mongo/s/config_server_test_fixture.cpp
@@ -72,7 +72,7 @@
#include "mongo/s/config_server_catalog_cache_loader.h"
#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/s/shard_id.h"
#include "mongo/s/write_ops/batched_command_response.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/s/request_types/balance_chunk_request_type.h b/src/mongo/s/request_types/balance_chunk_request_type.h
index db748bbd0cb..2b0d2587c84 100644
--- a/src/mongo/s/request_types/balance_chunk_request_type.h
+++ b/src/mongo/s/request_types/balance_chunk_request_type.h
@@ -32,7 +32,7 @@
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/client/shard.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
namespace mongo {
diff --git a/src/mongo/s/migration_secondary_throttle_options.cpp b/src/mongo/s/request_types/migration_secondary_throttle_options.cpp
index 210c2e76219..a0b2a8d92cf 100644
--- a/src/mongo/s/migration_secondary_throttle_options.cpp
+++ b/src/mongo/s/request_types/migration_secondary_throttle_options.cpp
@@ -28,7 +28,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/base/status_with.h"
#include "mongo/bson/util/bson_extract.h"
diff --git a/src/mongo/s/migration_secondary_throttle_options.h b/src/mongo/s/request_types/migration_secondary_throttle_options.h
index d18f41a8dad..d18f41a8dad 100644
--- a/src/mongo/s/migration_secondary_throttle_options.h
+++ b/src/mongo/s/request_types/migration_secondary_throttle_options.h
diff --git a/src/mongo/s/migration_secondary_throttle_options_test.cpp b/src/mongo/s/request_types/migration_secondary_throttle_options_test.cpp
index fb9300707bd..149ba02cd2b 100644
--- a/src/mongo/s/migration_secondary_throttle_options_test.cpp
+++ b/src/mongo/s/request_types/migration_secondary_throttle_options_test.cpp
@@ -30,7 +30,7 @@
#include "mongo/bson/bsonmisc.h"
#include "mongo/db/write_concern_options.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/s/move_chunk_request.cpp b/src/mongo/s/request_types/move_chunk_request.cpp
index a90b7bbf4bd..d1d5183672b 100644
--- a/src/mongo/s/move_chunk_request.cpp
+++ b/src/mongo/s/request_types/move_chunk_request.cpp
@@ -28,7 +28,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/base/status_with.h"
#include "mongo/bson/util/bson_extract.h"
diff --git a/src/mongo/s/move_chunk_request.h b/src/mongo/s/request_types/move_chunk_request.h
index eb58f971675..720eaa23b58 100644
--- a/src/mongo/s/move_chunk_request.h
+++ b/src/mongo/s/request_types/move_chunk_request.h
@@ -34,7 +34,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/chunk_version.h"
-#include "mongo/s/migration_secondary_throttle_options.h"
+#include "mongo/s/request_types/migration_secondary_throttle_options.h"
namespace mongo {
diff --git a/src/mongo/s/move_chunk_request_test.cpp b/src/mongo/s/request_types/move_chunk_request_test.cpp
index 79ee1727ba9..9cc5231f677 100644
--- a/src/mongo/s/move_chunk_request_test.cpp
+++ b/src/mongo/s/request_types/move_chunk_request_test.cpp
@@ -30,7 +30,7 @@
#include "mongo/bson/bsonmisc.h"
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/s/move_chunk_request.h"
+#include "mongo/s/request_types/move_chunk_request.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/s/set_shard_version_request.cpp b/src/mongo/s/request_types/set_shard_version_request.cpp
index d98cd14f606..e3c8b4bb965 100644
--- a/src/mongo/s/set_shard_version_request.cpp
+++ b/src/mongo/s/request_types/set_shard_version_request.cpp
@@ -28,7 +28,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/base/status_with.h"
#include "mongo/bson/bsonobj.h"
diff --git a/src/mongo/s/set_shard_version_request.h b/src/mongo/s/request_types/set_shard_version_request.h
index 0fb5a149d93..0fb5a149d93 100644
--- a/src/mongo/s/set_shard_version_request.h
+++ b/src/mongo/s/request_types/set_shard_version_request.h
diff --git a/src/mongo/s/set_shard_version_request_test.cpp b/src/mongo/s/request_types/set_shard_version_request_test.cpp
index 6e44c1f4ba3..8f834c84c34 100644
--- a/src/mongo/s/set_shard_version_request_test.cpp
+++ b/src/mongo/s/request_types/set_shard_version_request_test.cpp
@@ -30,7 +30,7 @@
#include "mongo/bson/bsonmisc.h"
#include "mongo/bson/oid.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/s/shard_id.h b/src/mongo/s/shard_id.h
index 76a31769453..cbb15032cca 100644
--- a/src/mongo/s/shard_id.h
+++ b/src/mongo/s/shard_id.h
@@ -49,7 +49,7 @@ public:
ShardId() = default;
// Note that this c-tor allows the implicit conversion from std::string
- ShardId(const std::string shardId) : _shardId(std::move(shardId)) {}
+ ShardId(std::string shardId) : _shardId(std::move(shardId)) {}
// Implicit StringData conversion
operator StringData();
diff --git a/src/mongo/s/sharding_mongod_test_fixture.cpp b/src/mongo/s/sharding_mongod_test_fixture.cpp
index 905d96a2a33..dea70878919 100644
--- a/src/mongo/s/sharding_mongod_test_fixture.cpp
+++ b/src/mongo/s/sharding_mongod_test_fixture.cpp
@@ -73,7 +73,7 @@
#include "mongo/s/client/shard_remote.h"
#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/clock_source_mock.h"
#include "mongo/util/tick_source_mock.h"
diff --git a/src/mongo/s/sharding_test_fixture.cpp b/src/mongo/s/sharding_test_fixture.cpp
index 07750a6fe81..8b053a7426f 100644
--- a/src/mongo/s/sharding_test_fixture.cpp
+++ b/src/mongo/s/sharding_test_fixture.cpp
@@ -64,7 +64,7 @@
#include "mongo/s/config_server_catalog_cache_loader.h"
#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
-#include "mongo/s/set_shard_version_request.h"
+#include "mongo/s/request_types/set_shard_version_request.h"
#include "mongo/s/sharding_egress_metadata_hook_for_mongos.h"
#include "mongo/s/write_ops/batched_command_response.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/s/versioning.cpp b/src/mongo/s/versioning.cpp
index 52dbc2cfa80..9bb751cc131 100644
--- a/src/mongo/s/versioning.cpp
+++ b/src/mongo/s/versioning.cpp
@@ -26,22 +26,26 @@
* then also delete it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include "mongo/s/versioning.h"
+
#include "mongo/s/database_version_gen.h"
namespace mongo {
-DatabaseVersion Versioning::increment(const DatabaseVersion& v) {
- DatabaseVersion dbv;
- dbv.setVersion(v.getVersion() + 1);
- dbv.setUuid(v.getUuid());
- return dbv;
-}
-
DatabaseVersion Versioning::newDatabaseVersion() {
DatabaseVersion dbv;
dbv.setVersion(0);
dbv.setUuid(UUID::gen());
return dbv;
}
+
+DatabaseVersion Versioning::incrementDatabaseVersion(const DatabaseVersion& v) {
+ DatabaseVersion dbv;
+ dbv.setVersion(v.getVersion() + 1);
+ dbv.setUuid(v.getUuid());
+ return dbv;
}
+
+} // namespace mongo
diff --git a/src/mongo/s/versioning.h b/src/mongo/s/versioning.h
index ebd7b8a3760..c3dfc88f9b6 100644
--- a/src/mongo/s/versioning.h
+++ b/src/mongo/s/versioning.h
@@ -26,14 +26,16 @@
* then also delete it in the license file.
*/
+#include "mongo/s/chunk_version.h"
#include "mongo/s/database_version_gen.h"
namespace mongo {
class Versioning {
public:
- static DatabaseVersion increment(const DatabaseVersion& v);
-
static DatabaseVersion newDatabaseVersion();
+
+ static DatabaseVersion incrementDatabaseVersion(const DatabaseVersion& v);
};
-}
+
+} // namespace mongo