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

avoid scanning a dummy shard for an unsatisfiable query

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • Sharding

      As part of the SERVER-4554 fix, ChunkManager::getShardsForQuery() returns a dummy shard for an unsatisfiable query (one that cannot match any documents). The reason for this is that some callers of getShardsForQuery() expect that at least one shard will be returned for any query.

      I believe the current behavior is functionally correct, but we are querying the dummy shard unnecessarily for these unsatisfiable queries.

      The current implementations of count and find have explicit assertions that the returned list of shards is not empty. It would make sense to ensure/check that all callers for getShardsForQuery() can handle an empty set of shards. Some of the tricky cases I can see are:

      • making sure the parallel cursor works correctly with zero shards (and zero connections)
      • making sure there are no issues relating to shard version information -> Greg suggested that he should look at this.

      I will add some additional comments indicating which pieces of code will need to be touched to change the behavior of getShardsForQuery().

            Assignee:
            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: