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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 4.4.0-rc11
    • Fix Version/s: 4.9.0
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Query Optimization 2021-02-22, Query Optimization 2021-03-08, Query Optimization 2021-03-22

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: