diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-02-15 18:15:02 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-02-28 16:04:51 -0500 |
commit | ad1a3c97ec9cb2b3ece963a8674a05f5d8194c13 (patch) | |
tree | 105da1c97cb88d92c5f75bc8d25218db6edb22b1 /src/mongo/s | |
parent | 9bf92ae98e3621a31df91c6150f34ff3fa1213c7 (diff) | |
download | mongo-ad1a3c97ec9cb2b3ece963a8674a05f5d8194c13.tar.gz |
SERVER-28030 Move catalog_cache.h/.cpp to mongo/s/
There is no need for the CatalogCache and the cache entry classes to be in
the same directory as the catalog manager.
(cherry picked from commit f2744a782db74983e3ce4e145839ea15f1e4dd5f)
Diffstat (limited to 'src/mongo/s')
33 files changed, 80 insertions, 67 deletions
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript index 2ccbe5b43e4..ed7574032d7 100644 --- a/src/mongo/s/SConscript +++ b/src/mongo/s/SConscript @@ -202,17 +202,6 @@ env.CppUnitTest( ] ) -env.CppUnitTest( - target='chunk_manager_tests', - source=[ - 'chunk_manager_tests.cpp' - ], - LIBDEPS=[ - '$BUILD_DIR/mongo/s/catalog/sharding_catalog_test_fixture', - 'coreshard', - ] -) - env.CppUnitTest('request_types_test', source=[ 'request_types/add_shard_request_test.cpp', @@ -234,7 +223,7 @@ env.Library( target='coreshard', source=[ 'balancer_configuration.cpp', - 'catalog/catalog_cache.cpp', + 'catalog_cache.cpp', 'chunk.cpp', 'chunk_manager.cpp', 'cluster_identity_loader.cpp', @@ -251,12 +240,22 @@ env.Library( '$BUILD_DIR/mongo/db/repl/repl_coordinator_global', '$BUILD_DIR/mongo/executor/task_executor_pool', '$BUILD_DIR/mongo/s/query/cluster_cursor_manager', - 'catalog/sharding_catalog_client_impl', 'client/sharding_client', 'common', ], ) +env.CppUnitTest( + target='catalog_cache_test', + source=[ + 'chunk_manager_test.cpp' + ], + LIBDEPS=[ + '$BUILD_DIR/mongo/s/catalog/sharding_catalog_test_fixture', + 'coreshard', + ] +) + env.Library( target='cluster_last_error_info', source=[ diff --git a/src/mongo/s/catalog/sharding_catalog_client.cpp b/src/mongo/s/catalog/sharding_catalog_client.cpp index 1eb3a53489b..b9e0b8ec384 100644 --- a/src/mongo/s/catalog/sharding_catalog_client.cpp +++ b/src/mongo/s/catalog/sharding_catalog_client.cpp @@ -34,11 +34,9 @@ namespace mongo { const WriteConcernOptions ShardingCatalogClient::kMajorityWriteConcern( WriteConcernOptions::kMajority, - // Note: Even though we're setting UNSET here, - // kMajority implies JOURNAL if journaling is - // supported by mongod and - // writeConcernMajorityJournalDefault is set to true - // in the ReplicaSetConfig. + // Note: Even though we're setting UNSET here, kMajority implies JOURNAL if journaling is + // supported by mongod and writeConcernMajorityJournalDefault is set to true in the + // ReplicaSetConfig. WriteConcernOptions::SyncMode::UNSET, Seconds(15)); diff --git a/src/mongo/s/catalog/catalog_cache.cpp b/src/mongo/s/catalog_cache.cpp index b418977f8b2..f5523546a8c 100644 --- a/src/mongo/s/catalog/catalog_cache.cpp +++ b/src/mongo/s/catalog_cache.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/base/status_with.h" #include "mongo/s/catalog/sharding_catalog_client.h" diff --git a/src/mongo/s/catalog/catalog_cache.h b/src/mongo/s/catalog_cache.h index 8d30c1aebf0..8d30c1aebf0 100644 --- a/src/mongo/s/catalog/catalog_cache.h +++ b/src/mongo/s/catalog_cache.h diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index 67224e8ee51..f3a1d126ae1 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -32,7 +32,7 @@ #include "mongo/s/chunk_manager.h" -#include <iterator> +#include <boost/next_prior.hpp> #include <map> #include <set> @@ -50,9 +50,9 @@ #include "mongo/db/query/query_planner_common.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog/type_collection.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_diff.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/config.h" @@ -170,20 +170,21 @@ ChunkManager::ChunkManager(const string& ns, const ShardKeyPattern& pattern, std::unique_ptr<CollatorInterface> defaultCollator, bool unique) - : _ns(ns), + : _sequenceNumber(nextCMSequenceNumber.addAndFetch(1)), + _ns(ns), _keyPattern(pattern.getKeyPattern()), _defaultCollator(std::move(defaultCollator)), _unique(unique), - _sequenceNumber(nextCMSequenceNumber.addAndFetch(1)), _chunkMap(SimpleBSONObjComparator::kInstance.makeBSONObjIndexedMap<std::shared_ptr<Chunk>>()), _chunkRangeMap( SimpleBSONObjComparator::kInstance.makeBSONObjIndexedMap<ShardAndChunkRange>()) {} ChunkManager::ChunkManager(OperationContext* txn, const CollectionType& coll) - : _ns(coll.getNs().ns()), + : _sequenceNumber(nextCMSequenceNumber.addAndFetch(1)), + _ns(coll.getNs().ns()), _keyPattern(coll.getKeyPattern()), _unique(coll.getUnique()), - _sequenceNumber(nextCMSequenceNumber.addAndFetch(1)), + _chunkMap(SimpleBSONObjComparator::kInstance.makeBSONObjIndexedMap<std::shared_ptr<Chunk>>()), _chunkRangeMap( SimpleBSONObjComparator::kInstance.makeBSONObjIndexedMap<ShardAndChunkRange>()) { @@ -201,6 +202,8 @@ ChunkManager::ChunkManager(OperationContext* txn, const CollectionType& coll) } } +ChunkManager::~ChunkManager() = default; + void ChunkManager::loadExistingRanges(OperationContext* txn, const ChunkManager* oldManager) { invariant(!_version.isSet()); @@ -621,8 +624,6 @@ void ChunkManager::getShardIdsForRange(set<ShardId>& shardIds, } void ChunkManager::getAllShardIds(set<ShardId>* all) const { - dassert(all); - all->insert(_shardIds.begin(), _shardIds.end()); } diff --git a/src/mongo/s/chunk_manager.h b/src/mongo/s/chunk_manager.h index f809c6167c6..4cd6700cacf 100644 --- a/src/mongo/s/chunk_manager.h +++ b/src/mongo/s/chunk_manager.h @@ -57,9 +57,6 @@ class ChunkManager { MONGO_DISALLOW_COPYING(ChunkManager); public: - typedef std::map<ShardId, ChunkVersion> ShardVersionMap; - - // Loads a new chunk manager from a collection document ChunkManager(OperationContext* txn, const CollectionType& coll); // Creates an empty chunk manager for the namespace @@ -68,22 +65,27 @@ public: std::unique_ptr<CollatorInterface> defaultCollator, bool unique); + ~ChunkManager(); + const std::string& getns() const { return _ns; } + const ShardKeyPattern& getShardKeyPattern() const { return _keyPattern; } + const CollatorInterface* getDefaultCollator() const { return _defaultCollator.get(); } + bool isUnique() const { return _unique; } /** - * this is just an increasing number of how many ChunkManagers we have so we know if something - * has been updated + * An increasing number of how many ChunkManagers we have so we know if something has been + * updated. */ unsigned long long getSequenceNumber() const { return _sequenceNumber; @@ -231,6 +233,8 @@ private: // the complete space from [MinKey, MaxKey). using ChunkRangeMap = BSONObjIndexedMap<ShardAndChunkRange>; + using ShardVersionMap = std::map<ShardId, ChunkVersion>; + /** * If load was successful, returns true and it is guaranteed that the _chunkMap and * _chunkRangeMap are consistent with each other. If false is returned, it is not safe to use @@ -247,18 +251,21 @@ private: */ static ChunkRangeMap _constructRanges(const ChunkMap& chunkMap); - // All members should be const for thread-safety - const std::string _ns; - const ShardKeyPattern _keyPattern; - std::unique_ptr<CollatorInterface> _defaultCollator; - const bool _unique; - // The shard versioning mechanism hinges on keeping track of the number of times we reload // ChunkManagers. Increasing this number here will prompt checkShardVersion to refresh the // connection-level versions to the most up to date value. const unsigned long long _sequenceNumber; + std::string _ns; + + ShardKeyPattern _keyPattern; + + std::unique_ptr<CollatorInterface> _defaultCollator; + + bool _unique; + ChunkMap _chunkMap; + ChunkRangeMap _chunkRangeMap; std::set<ShardId> _shardIds; diff --git a/src/mongo/s/chunk_manager_targeter.cpp b/src/mongo/s/chunk_manager_targeter.cpp index 7771fa31db5..43e10250456 100644 --- a/src/mongo/s/chunk_manager_targeter.cpp +++ b/src/mongo/s/chunk_manager_targeter.cpp @@ -38,7 +38,7 @@ #include "mongo/db/operation_context.h" #include "mongo/db/query/canonical_query.h" #include "mongo/db/query/collation/collation_index_key.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" diff --git a/src/mongo/s/chunk_manager_tests.cpp b/src/mongo/s/chunk_manager_test.cpp index 4f3e3e87524..4f3e3e87524 100644 --- a/src/mongo/s/chunk_manager_tests.cpp +++ b/src/mongo/s/chunk_manager_test.cpp diff --git a/src/mongo/s/client/version_manager.cpp b/src/mongo/s/client/version_manager.cpp index c82e9afa10d..2e6a35f5e09 100644 --- a/src/mongo/s/client/version_manager.cpp +++ b/src/mongo/s/client/version_manager.cpp @@ -34,8 +34,8 @@ #include "mongo/client/dbclient_rs.h" #include "mongo/db/namespace_string.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_version.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/commands/cluster_commands_common.cpp b/src/mongo/s/commands/cluster_commands_common.cpp index 020bac131b3..c4b4673b5d4 100644 --- a/src/mongo/s/commands/cluster_commands_common.cpp +++ b/src/mongo/s/commands/cluster_commands_common.cpp @@ -35,8 +35,8 @@ #include "mongo/client/parallel.h" #include "mongo/db/commands.h" #include "mongo/db/query/cursor_response.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/type_collection.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/version_manager.h" #include "mongo/s/grid.h" diff --git a/src/mongo/s/commands/cluster_drop_cmd.cpp b/src/mongo/s/commands/cluster_drop_cmd.cpp index bf2b740ce33..7f611f543f8 100644 --- a/src/mongo/s/commands/cluster_drop_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_cmd.cpp @@ -33,10 +33,10 @@ #include "mongo/base/status.h" #include "mongo/db/commands.h" #include "mongo/db/operation_context.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/dist_lock_manager.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog/type_database.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/commands/cluster_commands_common.h" #include "mongo/s/commands/sharded_command_processing.h" diff --git a/src/mongo/s/commands/cluster_drop_database_cmd.cpp b/src/mongo/s/commands/cluster_drop_database_cmd.cpp index 33a4f1d64b8..f227b4aa89a 100644 --- a/src/mongo/s/commands/cluster_drop_database_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_database_cmd.cpp @@ -33,10 +33,10 @@ #include "mongo/base/status.h" #include "mongo/db/commands.h" #include "mongo/db/operation_context.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/dist_lock_manager.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog/type_database.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/commands/cluster_commands_common.h" #include "mongo/s/commands/sharded_command_processing.h" diff --git a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp index 6de883e8be1..555fdfb0349 100644 --- a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp +++ b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp @@ -39,8 +39,8 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/client.h" #include "mongo/db/commands.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/config.h" #include "mongo/s/grid.h" #include "mongo/util/log.h" diff --git a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp index 14cd8676917..c49a4517962 100644 --- a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp @@ -39,7 +39,7 @@ #include "mongo/db/operation_context.h" #include "mongo/db/query/collation/collator_factory_interface.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp b/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp index de726f47251..4f489ab28c1 100644 --- a/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp +++ b/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp @@ -29,7 +29,7 @@ #include "mongo/platform/basic.h" #include "mongo/db/commands.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/grid.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp index b9c8f8161b2..33a45eb1b92 100644 --- a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp +++ b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp @@ -42,9 +42,9 @@ #include "mongo/db/commands/mr.h" #include "mongo/db/query/collation/collation_spec.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/dist_lock_manager.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp index 7dd1aa79852..70894d96f4d 100644 --- a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp +++ b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp @@ -35,8 +35,8 @@ #include "mongo/db/commands.h" #include "mongo/db/field_parser.h" #include "mongo/db/namespace_string.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp index 1c986386d0b..df3a177692b 100644 --- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp @@ -39,7 +39,7 @@ #include "mongo/db/commands.h" #include "mongo/db/write_concern_options.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/config_server_client.h" diff --git a/src/mongo/s/commands/cluster_move_primary_cmd.cpp b/src/mongo/s/commands/cluster_move_primary_cmd.cpp index 26f0db8a7c3..fefd9bbd47d 100644 --- a/src/mongo/s/commands/cluster_move_primary_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_primary_cmd.cpp @@ -43,9 +43,9 @@ #include "mongo/db/commands.h" #include "mongo/db/operation_context.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog/type_database.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/commands/cluster_commands_common.h" #include "mongo/s/commands/sharded_command_processing.h" diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp index a7bf3060752..4146682243f 100644 --- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp +++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp @@ -51,8 +51,8 @@ #include "mongo/db/query/collation/collator_factory_interface.h" #include "mongo/db/write_concern_options.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/commands/cluster_write.h" diff --git a/src/mongo/s/commands/cluster_split_cmd.cpp b/src/mongo/s/commands/cluster_split_cmd.cpp index b8799b63cd0..d6cdcb4ba83 100644 --- a/src/mongo/s/commands/cluster_split_cmd.cpp +++ b/src/mongo/s/commands/cluster_split_cmd.cpp @@ -40,7 +40,7 @@ #include "mongo/db/client.h" #include "mongo/db/commands.h" #include "mongo/db/field_parser.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index 24ecc38e036..6736adc7443 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -52,8 +52,8 @@ #include "mongo/db/views/resolved_view.h" #include "mongo/executor/task_executor_pool.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp index c55e98dc29f..ff2efb798d5 100644 --- a/src/mongo/s/commands/strategy.cpp +++ b/src/mongo/s/commands/strategy.cpp @@ -53,7 +53,7 @@ #include "mongo/db/views/resolved_view.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/metadata/server_selection_metadata.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/chunk_version.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp index 6240bac0ba6..c9a7bbaea0b 100644 --- a/src/mongo/s/config.cpp +++ b/src/mongo/s/config.cpp @@ -35,11 +35,11 @@ #include <vector> #include "mongo/db/lasterror.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog/type_chunk.h" #include "mongo/s/catalog/type_collection.h" #include "mongo/s/catalog/type_database.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/chunk_version.h" #include "mongo/s/grid.h" diff --git a/src/mongo/s/config_server_test_fixture.cpp b/src/mongo/s/config_server_test_fixture.cpp index c6c5b219c42..fb446889e28 100644 --- a/src/mongo/s/config_server_test_fixture.cpp +++ b/src/mongo/s/config_server_test_fixture.cpp @@ -53,7 +53,6 @@ #include "mongo/rpc/metadata/repl_set_metadata.h" #include "mongo/rpc/metadata/server_selection_metadata.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" #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" @@ -62,6 +61,7 @@ #include "mongo/s/catalog/type_chunk.h" #include "mongo/s/catalog/type_collection.h" #include "mongo/s/catalog/type_shard.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_factory.h" #include "mongo/s/client/shard_local.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp index 98853d566f4..264bbfeb92f 100644 --- a/src/mongo/s/grid.cpp +++ b/src/mongo/s/grid.cpp @@ -37,9 +37,9 @@ #include "mongo/executor/task_executor.h" #include "mongo/executor/task_executor_pool.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog/sharding_catalog_manager.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_factory.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/query/cluster_cursor_manager.h" diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp index c1d32e5c6be..2f07e8494c7 100644 --- a/src/mongo/s/query/cluster_find.cpp +++ b/src/mongo/s/query/cluster_find.cpp @@ -46,7 +46,7 @@ #include "mongo/executor/task_executor_pool.h" #include "mongo/platform/overflow_arithmetic.h" #include "mongo/rpc/metadata/server_selection_metadata.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" #include "mongo/s/query/cluster_client_cursor_impl.h" diff --git a/src/mongo/s/shard_key_pattern.h b/src/mongo/s/shard_key_pattern.h index 52858a0100e..67c8eeb4a2f 100644 --- a/src/mongo/s/shard_key_pattern.h +++ b/src/mongo/s/shard_key_pattern.h @@ -223,8 +223,9 @@ public: private: // Ordered, parsed paths - const OwnedPointerVector<FieldRef> _keyPatternPaths; + OwnedPointerVector<FieldRef> _keyPatternPaths; - const KeyPattern _keyPattern; + KeyPattern _keyPattern; }; -} + +} // namespace mongo diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp index 5bcce059ec4..47803747f3a 100644 --- a/src/mongo/s/sharding_initialization.cpp +++ b/src/mongo/s/sharding_initialization.cpp @@ -49,11 +49,11 @@ #include "mongo/rpc/metadata/config_server_metadata.h" #include "mongo/rpc/metadata/metadata_hook.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" #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_impl.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_factory.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/client/sharding_network_connection_hook.h" diff --git a/src/mongo/s/sharding_mongod_test_fixture.cpp b/src/mongo/s/sharding_mongod_test_fixture.cpp index 41b6565ffb5..6ec49389d93 100644 --- a/src/mongo/s/sharding_mongod_test_fixture.cpp +++ b/src/mongo/s/sharding_mongod_test_fixture.cpp @@ -55,7 +55,6 @@ #include "mongo/rpc/metadata/repl_set_metadata.h" #include "mongo/rpc/metadata/server_selection_metadata.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/dist_lock_catalog.h" #include "mongo/s/catalog/dist_lock_manager.h" #include "mongo/s/catalog/sharding_catalog_client.h" @@ -63,6 +62,7 @@ #include "mongo/s/catalog/type_changelog.h" #include "mongo/s/catalog/type_collection.h" #include "mongo/s/catalog/type_shard.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_factory.h" #include "mongo/s/client/shard_local.h" #include "mongo/s/client/shard_registry.h" diff --git a/src/mongo/s/sharding_raii.cpp b/src/mongo/s/sharding_raii.cpp index 57b122fbce5..ea50d5ce128 100644 --- a/src/mongo/s/sharding_raii.cpp +++ b/src/mongo/s/sharding_raii.cpp @@ -31,8 +31,8 @@ #include "mongo/s/sharding_raii.h" #include "mongo/base/status_with.h" -#include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" diff --git a/src/mongo/s/sharding_test_fixture.cpp b/src/mongo/s/sharding_test_fixture.cpp index a6fe9d431d6..c1bf99c59e8 100644 --- a/src/mongo/s/sharding_test_fixture.cpp +++ b/src/mongo/s/sharding_test_fixture.cpp @@ -51,13 +51,13 @@ #include "mongo/rpc/metadata/server_selection_metadata.h" #include "mongo/rpc/metadata/tracking_metadata.h" #include "mongo/s/balancer_configuration.h" -#include "mongo/s/catalog/catalog_cache.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_manager.h" #include "mongo/s/catalog/type_changelog.h" #include "mongo/s/catalog/type_collection.h" #include "mongo/s/catalog/type_shard.h" +#include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_factory.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/client/shard_remote.h" @@ -231,9 +231,16 @@ executor::TaskExecutor* ShardingTestFixture::executor() const { DistLockManagerMock* ShardingTestFixture::distLock() const { invariant(_distLockManager); + return _distLockManager; } +ServiceContext* ShardingTestFixture::serviceContext() const { + invariant(_service); + + return _service.get(); +} + OperationContext* ShardingTestFixture::operationContext() const { invariant(_opCtx); diff --git a/src/mongo/s/sharding_test_fixture.h b/src/mongo/s/sharding_test_fixture.h index a48a56e0df3..8bd7ad1844a 100644 --- a/src/mongo/s/sharding_test_fixture.h +++ b/src/mongo/s/sharding_test_fixture.h @@ -98,10 +98,10 @@ protected: executor::TaskExecutor* executor() const; - const transport::SessionHandle& getTransportSession() const; - DistLockManagerMock* distLock() const; + ServiceContext* serviceContext() const; + OperationContext* operationContext() const; /** |