Enable sharded local updateLookup behind the flag: flip eligibility factory and add sharding integration tests

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2026-06-22, QE 2026-07-06
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Make sharded clusters take the local change-stream updateLookup path under featureFlagChangeStreamOptimizedUpdateLookup. The production eligibility factory currently declines on a sharded node, so flag-on sharded streams always fall through to the routed aggregation lookup.

      What

      • Flip the eligibility factory so a sharded node produces the real sharded eligibility (using the node's shard id); the replica-set path is unchanged.
      • Let StaleConfig, StaleDbVersion, and ShardCannotRefreshDueToLocksHeld propagate out of the Express lookup body so the eligibility's router refresh and retry handle them; keep NamespaceNotFound and CollectionUUIDMismatch mapping to a null fullDocument. Update the affected Express unit tests to the new behavior.
      • Add a router-level refresh-and-retry unit test for the sharded eligibility (stale then fresh routing info; the body throws StaleConfig once then succeeds).
      • Add sharding integration jstests under jstests/sharding/query/change_streams covering a chunk migration race, the orphan window, a collection after resharding, a collection after refining the shard key, database-level and cluster-level streams, and collation. Each asserts that flag-on output matches flag-off output.

      Acceptance

      • On a sharded cluster with the flag on, a locally owned documentKey is served by the local path, and migration, resharding, and shard-key-refine races still produce the correct document.
      • All new and existing sharding change-stream updateLookup jstests pass with the flag on and with the flag off.

            Assignee:
            Denis Grebennicov
            Reporter:
            Denis Grebennicov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: