Refactor sharded change-stream updateLookup jstests into mochalite with a shared post-image-lookup observability seam

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2026-07-06
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Enabling the optimized updateLookup for sharded clusters (SERVER-129059) changes how a change
      stream resolves a post-image: instead of a routed aggregate, the owning shard does a local
      Express lookup. That changes what the existing tests can observe (no routed command, no local-read
      log, and the lookup uses the _id index rather than the shard-key index), so the three sharded
      updateLookup tests need new assertions.

      To keep that change reviewable, this ticket does the behavior-preserving refactor first, so the
      follow-up only flips the feature flag and adds the optimized assertions.

      Scope

      • Convert to mochalite (describe/it):
        • jstests/sharding/query/change_streams/change_stream_read_preference.js
        • jstests/sharding/query/change_streams/change_stream_update_lookup_read_concern.js
        • jstests/sharding/query/change_streams/change_stream_update_lookup_collation.js
      • Add shared test helpers:
        • jstests/libs/index_stats_utils.js: getIndexAccessOps / withIndexStatsDelta / indexAccessOpsByName (the $indexStats accesses.ops signal that shows which index a lookup used).
        • jstests/libs/query/change_stream_util.js: withChangeStreamTest (RAII cursor cleanup) and observePostImageLookup (per-node legacy local-read count plus a per-index accesses.ops delta).
      • Assertions stay on the legacy behavior, so the tests are flag-agnostic and pass on the base in all variants. collation now positively asserts the lookup used the shard-key index and not _id.
      • Consolidate the duplicated numIdIndexUsages helper in jstests/noPassthrough/query/change_streams/change_streams_update_lookup_collation.js.

      Out of scope

      The optimized-path assertions themselves are added by SERVER-129059 once the eligibility factory returns the sharded decision. TODO SERVER-129059 markers in each test note where they go.

      Testing

      The three tests pass under the sharding suite both with and without featureFlagChangeStreamOptimizedUpdateLookup (behavior is identical on this branch because the sharded eligibility still declines until SERVER-129059).

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

              Created:
              Updated:
              Resolved: