summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2016-05-06 19:02:34 -0400
committerRandolph Tan <randolph@10gen.com>2016-05-10 13:09:08 -0400
commita0b042b01f7ec2e3b086f189e5695785092d1657 (patch)
treee3134b10cde6d4572aefb5bd252d0a19b046b3c0
parentbef3ecb7a957a1efbf96b14828e343584b1a242b (diff)
downloadmongo-a0b042b01f7ec2e3b086f189e5695785092d1657.tar.gz
SERVER-24084 Gracefully handle errors inside ReplicationCoordinatorExternalStateImpl::recoverShardingState
(cherry picked from commit 718c5c01597163288730617ea534bf3a0b3dc325)
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index b83e9e96c33..75b08a4fd76 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -361,7 +361,17 @@ void ReplicationCoordinatorExternalStateImpl::clearShardingState() {
}
void ReplicationCoordinatorExternalStateImpl::recoverShardingState(OperationContext* txn) {
- uassertStatusOK(ShardingStateRecovery::recover(txn));
+ auto status = ShardingStateRecovery::recover(txn);
+
+ if (status == ErrorCodes::ShutdownInProgress) {
+ // Note: callers of this method don't expect exceptions, so throw only unexpected fatal
+ // errors.
+ return;
+ }
+
+ if (!status.isOK()) {
+ fassertFailedWithStatus(40107, status);
+ }
// There is a slight chance that some stale metadata might have been loaded before the latest
// optime has been recovered, so throw out everything that we have up to now