diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/op_observer_impl.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/repl/rs_rollback.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/client/shard_registry.cpp | 20 | ||||
-rw-r--r-- | src/mongo/s/client/shard_registry.h | 6 |
4 files changed, 3 insertions, 39 deletions
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp index e14695db5de..383f5d47e34 100644 --- a/src/mongo/db/op_observer_impl.cpp +++ b/src/mongo/db/op_observer_impl.cpp @@ -2288,14 +2288,6 @@ void OpObserverImpl::_onReplicationRollback(OperationContext* opCtx, fassertFailedNoTrace(50712); } - // Force the config server to update its shard registry on next access. Otherwise it may have - // the stale data that has been just rolled back. - if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { - if (auto shardRegistry = Grid::get(opCtx)->shardRegistry()) { - shardRegistry->clearEntries(); - } - } - // Force the default read/write concern cache to reload on next access in case the defaults // document was rolled back. ReadWriteConcernDefaults::get(opCtx).invalidate(); diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index bca10b5c3ed..8777903803c 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -2012,14 +2012,6 @@ void rollback_internal::syncFixUp(OperationContext* opCtx, validator->resetKeyManagerCache(); } - // Force the config server to update its shard registry on next access. Otherwise it may have - // the stale data that has been just rolled back. - if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { - if (auto shardRegistry = Grid::get(opCtx)->shardRegistry()) { - shardRegistry->clearEntries(); - } - } - // Force the default read/write concern cache to reload on next access in case the defaults // document was rolled back. ReadWriteConcernDefaults::get(opCtx).invalidate(); diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp index 5bfacde260e..ecd18026ffd 100644 --- a/src/mongo/s/client/shard_registry.cpp +++ b/src/mongo/s/client/shard_registry.cpp @@ -426,11 +426,6 @@ SharedSemiFuture<ShardRegistry::Cache::ValueHandle> ShardRegistry::_reloadIntern return _getDataAsync(); } -void ShardRegistry::clearEntries() { - LOGV2_DEBUG(6471800, 1, "Invalidating Shard Registry"); - _cache->invalidateAll(); -} - void ShardRegistry::updateReplicaSetOnConfigServer(ServiceContext* serviceContext, const ConnectionString& connStr) noexcept { ThreadClient tc("UpdateReplicaSetOnConfigServer", serviceContext); @@ -570,18 +565,9 @@ std::pair<ShardRegistryData, Timestamp> ShardRegistryData::createFromCatalogClie OperationContext* opCtx, ShardFactory* shardFactory) { auto const catalogClient = Grid::get(opCtx)->catalogClient(); - auto readConcern = repl::ReadConcernLevel::kMajorityReadConcern; - - // ShardRemote requires a majority read. We can only allow a non-majority read if we are a - // config server. - if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer && - !repl::ReadConcernArgs::get(opCtx).isEmpty()) { - readConcern = repl::ReadConcernArgs::get(opCtx).getLevel(); - } - - auto shardsAndOpTime = - uassertStatusOKWithContext(catalogClient->getAllShards(opCtx, readConcern), - "could not get updated shard list from config server"); + auto shardsAndOpTime = uassertStatusOKWithContext( + catalogClient->getAllShards(opCtx, repl::ReadConcernLevel::kMajorityReadConcern), + "could not get updated shard list from config server"); auto shards = std::move(shardsAndOpTime.value); auto reloadOpTime = std::move(shardsAndOpTime.opTime); diff --git a/src/mongo/s/client/shard_registry.h b/src/mongo/s/client/shard_registry.h index df7c5a75977..96b27923275 100644 --- a/src/mongo/s/client/shard_registry.h +++ b/src/mongo/s/client/shard_registry.h @@ -283,12 +283,6 @@ public: void reload(OperationContext* opCtx); /** - * Clears all entries from the shard registry entries, which will force the registry to do a - * reload on next access. - */ - void clearEntries(); - - /** * For use in mongos which needs notifications about changes to shard replset membership to * update the config.shards collection. */ |