diff options
author | Randolph Tan <randolph@10gen.com> | 2016-04-26 17:35:45 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2016-05-05 10:49:28 -0400 |
commit | 359f97d52340e356324e2bf3b724fad6a2383ea1 (patch) | |
tree | 03df941994a2d570a2ef58d35ff4a51b8fae8b38 /src/mongo/db/db.cpp | |
parent | f7a46a118288ba0ce45c7664777ea0e89c2eb845 (diff) | |
download | mongo-359f97d52340e356324e2bf3b724fad6a2383ea1.tar.gz |
SERVER-22664 Add _overrideShardIdentity configuration for cloud backup service
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r-- | src/mongo/db/db.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 5d31ce8cf14..9fc2e5bb2df 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -91,6 +91,7 @@ #include "mongo/db/restapi.h" #include "mongo/db/s/sharding_state.h" #include "mongo/db/s/sharding_state_recovery.h" +#include "mongo/db/s/type_shard_identity.h" #include "mongo/db/server_options.h" #include "mongo/db/server_parameters.h" #include "mongo/db/service_context.h" @@ -107,6 +108,7 @@ #include "mongo/db/wire_version.h" #include "mongo/executor/network_interface_factory.h" #include "mongo/platform/process_id.h" +#include "mongo/s/sharding_initialization.h" #include "mongo/scripting/engine.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" @@ -748,6 +750,12 @@ static void _initAndListen(int listenPort) { } logStartup(startupOpCtx.get()); + } else if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { + auto parseStatus = ShardIdentityType::fromBSON(serverGlobalParams.overrideShardIdentity); + uassertStatusOK(parseStatus); + uassertStatusOK(ShardingState::get(startupOpCtx.get()) + ->initializeFromShardIdentity(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 |