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

Avoid change streams broadcasting {fullDocument: "updateLookup"} queries to all shards when shard key field is missing

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Change streams
    • Labels:
      None
    • Query Execution

      MongoDB 4.4 enabled documents in a sharded collection to omit any or all of the shard key fields (SERVER-42390). ShardServerProcessInterface::lookupSingleDocument() ends up passing the document key directly into a $match stage. This means change streams may run a {_id: "hello"} query on a collection sharded by {a: 1, b: 1} and end up broadcasting the query to all shards to find the matching one.

      Note that technically because change streams isn't reading at a single point-in-time across all of these shards it is technically possible for it to find multiple matching documents from the document being deleted + inserted across shards (e.g. from the shard key value being updated). This would lead to a ChangeStreamFatalError response.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: