diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-09-24 14:31:22 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-09-26 02:47:40 -0400 |
commit | a0ebd4bb3a30fdf574fd08ab473e7d6ce1b59619 (patch) | |
tree | ba437e69a942aa896bf856c02bb7c51eac80e407 /src/mongo/db/s/sharding_state_recovery.cpp | |
parent | dbc88bbcf51c3adc2f2a0ad3e4c22b98a2dc9388 (diff) | |
download | mongo-a0ebd4bb3a30fdf574fd08ab473e7d6ce1b59619.tar.gz |
SERVER-30714 Handle 'not master' errors in ReplicationCoordinatorExternalStateImpl::_shardingOnTransitionToPrimaryHook
Diffstat (limited to 'src/mongo/db/s/sharding_state_recovery.cpp')
-rw-r--r-- | src/mongo/db/s/sharding_state_recovery.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mongo/db/s/sharding_state_recovery.cpp b/src/mongo/db/s/sharding_state_recovery.cpp index 0eecfbfe135..8914dc56254 100644 --- a/src/mongo/db/s/sharding_state_recovery.cpp +++ b/src/mongo/db/s/sharding_state_recovery.cpp @@ -218,9 +218,9 @@ void ShardingStateRecovery::endMetadataOp(OperationContext* opCtx) { } Status ShardingStateRecovery::recover(OperationContext* opCtx) { - if (serverGlobalParams.clusterRole != ClusterRole::ShardServer) { - return Status::OK(); - } + Grid* const grid = Grid::get(opCtx); + ShardingState* const shardingState = ShardingState::get(opCtx); + invariant(shardingState->enabled()); BSONObj recoveryDocBSON; @@ -242,10 +242,6 @@ Status ShardingStateRecovery::recover(OperationContext* opCtx) { log() << "Sharding state recovery process found document " << redact(recoveryDoc.toBSON()); - Grid* const grid = Grid::get(opCtx); - ShardingState* const shardingState = ShardingState::get(opCtx); - invariant(shardingState->enabled()); - if (!recoveryDoc.getMinOpTimeUpdaters()) { // Treat the minOpTime as up-to-date grid->advanceConfigOpTime(recoveryDoc.getMinOpTime()); |