diff options
-rw-r--r-- | src/mongo/db/s/sharding_initialization_mongod.cpp | 13 | ||||
-rw-r--r-- | src/mongo/s/server.cpp | 13 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp index 8e8a35de617..741ead68a8b 100644 --- a/src/mongo/db/s/sharding_initialization_mongod.cpp +++ b/src/mongo/db/s/sharding_initialization_mongod.cpp @@ -101,10 +101,20 @@ public: // Update the shard identy config string void onConfirmedSet(const State& state) noexcept final { + auto connStr = state.connStr; + try { + LOGV2(471691, + "Updating the shard registry with confirmed replica set", + "connectionString"_attr = connStr); + Grid::get(_serviceContext)->shardRegistry()->updateReplSetHosts(connStr); + } catch (const ExceptionForCat<ErrorCategory::ShutdownError>& e) { + LOGV2(471692, "Unable to update the shard registry", "error"_attr = e); + } + Grid::get(_serviceContext) ->getExecutorPool() ->getFixedExecutor() - ->schedule([serviceContext = _serviceContext, connStr = state.connStr](Status status) { + ->schedule([serviceContext = _serviceContext, connStr](Status status) { if (ErrorCodes::isCancelationError(status.code())) { LOGV2_DEBUG(22067, 2, @@ -120,7 +130,6 @@ public: "Updating config server with confirmed replica set {connectionString}", "Updating config server with confirmed replica set", "connectionString"_attr = connStr); - Grid::get(serviceContext)->shardRegistry()->updateReplSetHosts(connStr); if (MONGO_unlikely(failUpdateShardIdentityConfigString.shouldFail())) { return; diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 281d7eecccf..6213d04215f 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -481,6 +481,16 @@ public: void onConfirmedSet(const State& state) noexcept final { auto connStr = state.connStr; + try { + LOGV2(471693, + "Updating the shard registry with confirmed replica set", + "connectionString"_attr = connStr); + Grid::get(_serviceContext)->shardRegistry()->updateReplSetHosts(connStr); + } catch (const ExceptionForCat<ErrorCategory::ShutdownError>& e) { + LOGV2(471694, + "Unable to update the shard registry with confirmed replica set", + "error"_attr = e); + } auto fun = [serviceContext = _serviceContext, connStr](auto args) { if (ErrorCodes::isCancelationError(args.status.code())) { @@ -492,9 +502,6 @@ public: LOGV2(22846, "Updating sharding state with confirmed replica set", "connectionString"_attr = connStr); - - Grid::get(serviceContext)->shardRegistry()->updateReplSetHosts(connStr); - if (MONGO_unlikely(failReplicaSetChangeConfigServerUpdateHook.shouldFail())) { return; } |