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

Remove kickback to mongos requirement for cluster view read when view is backed by unsharded collection

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: 4.4.0-rc11
    • Component/s: None
    • Fully Compatible
    • Query Optimization 2021-02-22, Query Optimization 2021-03-08, Query Optimization 2021-03-22

      Currently when a read is performed against a view backed by an unsharded collection, the following takes place:
      1) mongos sends the read to the primary shard for the given database
      2) The primary shard determines that namespace is a view, and returns the view definition and underlying namespace to mongos
      3) mongos rewrites the read on the view to be an aggregate command against the underlying collection, with the view definition incorporated into the aggregation pipeline
      4) mongos executes the aggregate command

      When the view is backed by an unsharded collection we would ideally perform the rewrite on the primary shard and execute locally rather than return the view definition to mongos for rewrite/execution. This was previously not possible, as the primary shard could incorrectly report that a sharded collection was unsharded. With the completion of SERVER-32198 however we can now definitively know whether a collection's sharding state is sharded, unsharded or unknown. In the case where we know it is unsharded, we can execute the view on the read remotely, without mongos kick-back.

            Assignee:
            james.wahlin@mongodb.com James Wahlin
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: