Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30476

Use of exception thrown by ChunkManager::findIntersectingChunk() to determine single shard targeting

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 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

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: