summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaley Connelly <haley.connelly@mongodb.com>2020-03-31 17:57:38 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-02 21:23:52 +0000
commited3a75b6f792dc8f93540622305caa3ea35ad389 (patch)
tree0b291e2fa796fa1458de850c680975397e5bdccd /src
parent717c79bf6031ceee5594e68b416c7874bfc6f5e2 (diff)
downloadmongo-ed3a75b6f792dc8f93540622305caa3ea35ad389.tar.gz
SERVER-47169 Call ShardRegistry::updateReplSetHosts() synchronously
(cherry picked from commit 08351c1b12f3ca5c9ab99b6628e27d2083278011)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/s/sharding_initialization_mongod.cpp13
-rw-r--r--src/mongo/s/server.cpp13
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;
}