summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorJaume Moragues <jaume.moragues@mongodb.com>2020-11-05 10:59:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-05 11:18:24 +0000
commitced11f8535500f0cb7c50f92ec3c6e4bc0729163 (patch)
tree3b27ecf4d1c711e4fe80512c367570c321bcc398 /src/mongo
parent2317871d1b0630bcf6cd01de538bae2c7dec15bf (diff)
downloadmongo-ced11f8535500f0cb7c50f92ec3c6e4bc0729163.tar.gz
SERVER-50909 Only apply changed connection strings inside ShardRegistry::_lookup()
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/s/client/shard_registry.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp
index 4bb4e11a2c0..28b4af8dc3c 100644
--- a/src/mongo/s/client/shard_registry.cpp
+++ b/src/mongo/s/client/shard_registry.cpp
@@ -174,10 +174,8 @@ ShardRegistry::Cache::LookupResult ShardRegistry::_lookup(OperationContext* opCt
auto [latestConnStrings, rsmIncrementForConnStrings] = _getLatestConnStrings();
for (const auto& latestConnString : latestConnStrings) {
- // TODO SERVER-50909: Optimise by only doing this work if the latest conn string differs.
-
auto shard = returnData.findByRSName(latestConnString.first.toString());
- if (!shard) {
+ if (shard == nullptr || shard->getConnString() == latestConnString.second) {
continue;
}