diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-09-04 11:43:00 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-09-04 11:43:00 -0400 |
commit | eea8acf410705f8c25018babdcf4e7861eb7128e (patch) | |
tree | d93cc43081b730656951a7570816173717e2b4c8 /src | |
parent | 767da33d396fc0d6a13aaff8387ba5a05c8c43b7 (diff) | |
download | mongo-eea8acf410705f8c25018babdcf4e7861eb7128e.tar.gz |
Revert "SERVER-25935 move ShardRegistry::init() out of Grid::init()"
This reverts commit d1d57b9ebab61ae897aaee624ca8df34399baa01.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/sharding_state_test.cpp | 12 | ||||
-rw-r--r-- | src/mongo/s/grid.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/sharding_initialization.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/sharding_mongod_test_fixture.cpp | 13 | ||||
-rw-r--r-- | src/mongo/s/sharding_test_fixture.cpp | 3 |
5 files changed, 15 insertions, 16 deletions
diff --git a/src/mongo/db/s/sharding_state_test.cpp b/src/mongo/db/s/sharding_state_test.cpp index 4cad4ce849a..5367ea1933e 100644 --- a/src/mongo/db/s/sharding_state_test.cpp +++ b/src/mongo/db/s/sharding_state_test.cpp @@ -63,7 +63,17 @@ protected: _shardingState.setGlobalInitMethodForTest([&](OperationContext* txn, const ConnectionString& configConnStr, StringData distLockProcessId) { - return initializeGlobalShardingStateForMongodForTest(configConnStr); + auto status = initializeGlobalShardingStateForMongodForTest(configConnStr); + if (!status.isOK()) { + return status; + } + // Set the ConnectionString return value on the mock targeter so that later calls to + // the targeter's getConnString() return the appropriate value. + auto configTargeter = + RemoteCommandTargeterMock::get(shardRegistry()->getConfigShard()->getTargeter()); + configTargeter->setConnectionStringReturnValue(configConnStr); + + return Status::OK(); }); } diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp index f6297702989..fbc973788d9 100644 --- a/src/mongo/s/grid.cpp +++ b/src/mongo/s/grid.cpp @@ -88,6 +88,8 @@ void Grid::init(std::unique_ptr<ShardingCatalogClient> catalogClient, _balancerConfig = std::move(balancerConfig); _executorPool = std::move(executorPool); _network = network; + + _shardRegistry->init(); } bool Grid::allowLocalHost() const { diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp index 215c57252f8..0c46df7a3cd 100644 --- a/src/mongo/s/sharding_initialization.cpp +++ b/src/mongo/s/sharding_initialization.cpp @@ -154,7 +154,6 @@ Status initializeGlobalShardingState(OperationContext* txn, executorPool->startup(); auto shardRegistry(stdx::make_unique<ShardRegistry>(std::move(shardFactory), configCS)); - shardRegistry->init(); auto catalogClient = makeCatalogClient(txn->getServiceContext(), shardRegistry.get(), distLockProcessId); diff --git a/src/mongo/s/sharding_mongod_test_fixture.cpp b/src/mongo/s/sharding_mongod_test_fixture.cpp index b8b17d9c843..2c37be980a9 100644 --- a/src/mongo/s/sharding_mongod_test_fixture.cpp +++ b/src/mongo/s/sharding_mongod_test_fixture.cpp @@ -209,18 +209,7 @@ std::unique_ptr<ShardRegistry> MongodTestFixture::makeShardRegistry( auto shardFactory = stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); - auto shardRegistry = stdx::make_unique<ShardRegistry>(std::move(shardFactory), configConnStr); - shardRegistry->init(); - - if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { - // Set the ConnectionString return value on the mock targeter so that later calls to - // the targeter's getConnString() return the appropriate value. - auto configTargeter = - RemoteCommandTargeterMock::get(shardRegistry->getConfigShard()->getTargeter()); - configTargeter->setConnectionStringReturnValue(configConnStr); - } - - return shardRegistry; + return stdx::make_unique<ShardRegistry>(std::move(shardFactory), configConnStr); } std::unique_ptr<DistLockCatalog> MongodTestFixture::makeDistLockCatalog( diff --git a/src/mongo/s/sharding_test_fixture.cpp b/src/mongo/s/sharding_test_fixture.cpp index 534c71036c6..9541019e1c6 100644 --- a/src/mongo/s/sharding_test_fixture.cpp +++ b/src/mongo/s/sharding_test_fixture.cpp @@ -121,7 +121,6 @@ void ShardingTestFixture::setUp() { auto executorPool = stdx::make_unique<executor::TaskExecutorPool>(); executorPool->addExecutors(std::move(executorsForPool), std::move(fixedExec)); - executorPool->startup(); auto uniqueDistLockManager = stdx::make_unique<DistLockManagerMock>(nullptr); _distLockManager = uniqueDistLockManager.get(); @@ -162,7 +161,7 @@ void ShardingTestFixture::setUp() { stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); auto shardRegistry(stdx::make_unique<ShardRegistry>(std::move(shardFactory), configCS)); - shardRegistry->init(); + executorPool->startup(); // For now initialize the global grid object. All sharding objects will be accessible from there // until we get rid of it. |