diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-08-02 17:48:20 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-08-04 15:10:11 -0400 |
commit | 58f8401f1f79dc9ec33b9fdbb3eeb21d9f508245 (patch) | |
tree | 3968bc6ccf857272d89a3cc52f40d2bf33664046 /src/mongo/db/db.cpp | |
parent | af198512c7dbb00442fb5115aeac661bf85535c8 (diff) | |
download | mongo-58f8401f1f79dc9ec33b9fdbb3eeb21d9f508245.tar.gz |
SERVER-25417 harden checks around using --shardSvr, --overrideShardIdentity, and queryableBackupMode
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r-- | src/mongo/db/db.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 491ac47cc84..0a891813048 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -711,12 +711,12 @@ static ExitCode _initAndListen(int listenPort) { HostnameCanonicalizationWorker::start(getGlobalServiceContext()); + uassertStatusOK(ShardingState::get(startupOpCtx.get()) + ->initializeShardingAwarenessIfNeeded(startupOpCtx.get())); + if (!storageGlobalParams.readOnly) { startFTDC(); if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { - uassertStatusOK(ShardingState::get(startupOpCtx.get()) - ->initializeFromShardIdentity(startupOpCtx.get())); - // Note: For replica sets, ShardingStateRecovery happens on transition to primary. if (!repl::getGlobalReplicationCoordinator()->isReplEnabled()) { uassertStatusOK(ShardingStateRecovery::recover(startupOpCtx.get())); @@ -728,13 +728,6 @@ static ExitCode _initAndListen(int listenPort) { kDistLockProcessIdForConfigServer)); Balancer::create(startupOpCtx->getServiceContext()); } - } else if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { - auto parseStatus = ShardIdentityType::fromBSON(serverGlobalParams.overrideShardIdentity); - uassertStatusOK(parseStatus); - uassertStatusOK(ShardingState::get(startupOpCtx.get()) - ->initializeFromShardIdentity( - startupOpCtx.get(), parseStatus.getValue(), Date_t::max())); - uassertStatusOK(reloadShardRegistryUntilSuccess(startupOpCtx.get())); } // MessageServer::run will return when exit code closes its socket and we don't need the |