-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Distributed Query Execution
-
None
-
Query Execution
-
ALL
-
QE 2024-05-13, QE 2024-05-27, QE 2024-06-10, QE 2024-12-09, QE 2024-12-23, QE 2025-01-06
The changes from SERVER-76855 ensure that the aggregate command will correctly use the collator in mongos when targeting for an untracked collection. There are places outside of the aggregate command in mongos which attempt to utilize the collation. Further investigation is needed to determine the extent to which mongos would be doing post-processing of results after merging cursor results (e.g. $group followed by $match) where the collator used by mongos is relevant for the correctness of query results.
Here is a reference to my simple audit from SERVER-76855 along with a more recent output from searching the codebase:
$ git grep -E 'collation.*isEmpty' -- src/mongo/s/ src/mongo/s/chunk_manager.cpp:674: const bool hasSimpleCollation = (collation.isEmpty() && !_rt->optRt->getDefaultCollator()) || src/mongo/s/cluster_commands_helpers.cpp:119: const auto noCollationSpecified = collation.isEmpty(); src/mongo/s/cluster_commands_helpers.cpp:226: if (!collation.isEmpty()) { src/mongo/s/collection_routing_info_targeter.cpp:406: if (!collation.isEmpty()) { src/mongo/s/collection_routing_info_targeter.cpp:777: if (!collation.isEmpty()) { src/mongo/s/commands/cluster_distinct_cmd.cpp:373: !collation.isEmpty() src/mongo/s/commands/cluster_map_reduce_agg.cpp:118: if (!collationObj.isEmpty()) { src/mongo/s/commands/cluster_map_reduce_agg.cpp:161: if (!cm.hasRoutingTable() && collationObj.isEmpty()) { src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp:150: if (!parsedInfo.collation.isEmpty()) { src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp:427: if (parsedInfoFromRequest.collation.isEmpty()) { src/mongo/s/commands/sharding_expressions.cpp:119: if (auto collation = indexDescriptor->collation(); !collation.isEmpty()) { src/mongo/s/query/cluster_aggregate.cpp:140: if (!collationObj.isEmpty()) { src/mongo/s/query/cluster_aggregate.cpp:159: if ((!cri || !cri->cm.hasRoutingTable()) && collationObj.isEmpty()) { src/mongo/s/query/cluster_aggregation_planner.cpp:633: !collationToReturn.isEmpty()); src/mongo/s/query/cluster_aggregation_planner.cpp:816: if (nss.isCollectionlessAggregateNS() || !collation.isEmpty() || !cm) { src/mongo/s/shard_key_pattern_query_util.cpp:468: if (!collation.isEmpty()) { src/mongo/s/shard_key_pattern_query_util.cpp:476: if (!cm.hasRoutingTable() && collation.isEmpty()) { src/mongo/s/write_ops/write_without_shard_key_util.cpp:267: if (collation.isEmpty()) {
- is related to
-
SERVER-76855 Audit mongos for improper usage of collation and incorrectly assuming simple collation rather than collection default
- Closed
-
SERVER-71896 Validate if a query with _id or shard key is directly targetable to a shard
- Closed
-
SERVER-76857 Have useTwoPhaseProtocol use the collection default collation if the collation is not specified
- Closed
-
SERVER-24433 Distinguish between the simple collator and the absence of a collator
- Backlog
- related to
-
SERVER-92967 Refactor index spec collations to be a proper type
- Backlog