From 9cb82d2e8680717d3002459ba5fdb16036183a17 Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Tue, 25 Aug 2020 01:42:28 -0400 Subject: SERVER-50505 Make the CatalogCache return ChunkManager(s) directly ... instead of returning the intermediate CachedCollectionRoutingInfo class. The ChunkManager should be the only class used for routing. --- src/mongo/s/commands/cluster_distinct_cmd.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/mongo/s/commands/cluster_distinct_cmd.cpp') diff --git a/src/mongo/s/commands/cluster_distinct_cmd.cpp b/src/mongo/s/commands/cluster_distinct_cmd.cpp index 7359c79e910..9f836644ff5 100644 --- a/src/mongo/s/commands/cluster_distinct_cmd.cpp +++ b/src/mongo/s/commands/cluster_distinct_cmd.cpp @@ -176,10 +176,10 @@ public: CollatorFactoryInterface::get(opCtx->getServiceContext())->makeFromBSON(collation)); } - const auto routingInfo = uassertStatusOK(getCollectionRoutingInfoForTxnCmd(opCtx, nss)); + const auto cm = uassertStatusOK(getCollectionRoutingInfoForTxnCmd(opCtx, nss)); if (repl::ReadConcernArgs::get(opCtx).getLevel() == repl::ReadConcernLevel::kSnapshotReadConcern && - !opCtx->inMultiDocumentTransaction() && routingInfo.cm()) { + !opCtx->inMultiDocumentTransaction() && cm.isSharded()) { uasserted(ErrorCodes::InvalidOptions, "readConcern level \"snapshot\" prohibited for \"distinct\" command on" " sharded collection"); @@ -191,7 +191,7 @@ public: opCtx, nss.db(), nss, - routingInfo, + cm, applyReadWriteConcern( opCtx, this, CommandHelpers::filterCommandRequestForPassthrough(cmdObj)), ReadPreferenceSetting::get(opCtx), @@ -226,12 +226,11 @@ public: return true; } - BSONObjComparator bsonCmp( - BSONObj(), - BSONObjComparator::FieldNamesMode::kConsider, - !collation.isEmpty() - ? collator.get() - : (routingInfo.cm() ? routingInfo.cm()->getDefaultCollator() : nullptr)); + BSONObjComparator bsonCmp(BSONObj(), + BSONObjComparator::FieldNamesMode::kConsider, + !collation.isEmpty() + ? collator.get() + : (cm.isSharded() ? cm.getDefaultCollator() : nullptr)); BSONObjSet all = bsonCmp.makeBSONObjSet(); for (const auto& response : shardResponses) { -- cgit v1.2.1