-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:
-
Query Optimization
There are several places where we call ChunkManager::findIntersectingChunk() as a fast-path check to determine whether a single shard can be targeted for query. If it can't (one case being when shard key collation doesn't match the request) a uassert is triggered, which we then catch and ignore.
We should refactor these call sites to not use exceptions as part of the non-error path.
Here are a few examples. All callers of ChunkManager::findIntersectingChunk() and ChunkManager::findIntersectingChunkWithSimpleCollation() should be audited as part of this work.
https://github.com/mongodb/mongo/blob/20c85d4848b4e4b3c88e1788eaff362143fffd20/src/mongo/s/chunk_manager.cpp#L126-L134
https://github.com/mongodb/mongo/blob/20c85d4848b4e4b3c88e1788eaff362143fffd20/src/mongo/s/commands/cluster_aggregate.cpp#L238-L243