Investigate compatibility of v2 change streams with $_passthroughToShard

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2026-03-16
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Background:
      $_passthroughToShard routes change stream commands to a single specific shard via the kSpecificShardOnly path in cluster_aggregate.cpp. This path sends the original $changeStream spec (not the expanded pipeline) to the target shard with inRouter=false. When the shard parses {}{$changeStream: {version: "v2"{}}}, _determineChangeStreamReaderVersion() (document_source_change_stream.cpp:330) sees getInRouter()=false and builds a replica set pipeline — no topology handler stage (neither v1 HandleTopologyChange nor v2 HandleTopologyChangeV2) and no control event injection. The mongos acts purely as a passthrough proxy, and the shard operates as if it were a standalone replica set member.

      No server code changes are required. The v2 topology handling stages (HandleTopologyChangeV2InjectControlEvents) should not run in the per-shard-cursor path because they assume multi-shard coordination, which contradicts the per-shard-cursor contract.

      This ticket adds test coverage to prove this combination works correctly.

      Acceptance Criteria:

      1. New resmoke suite buildscripts/resmokeconfig/suites/change_streams_per_shard_cursor_passthrough_v2.yml:
        • Based on change_streams_per_shard_cursor_passthrough.yml.
        • Imports implicit_change_stream_v2.js before implicit_passthrough_to_shard_changestreams.js in the eval block.
        • Excludes the standard v2-incompatible tests:
          • create_event_from_chunk_migration.js (v1-specific internals)
          • migrate_last_chunk_from_shard_event.js (SERVER-114511)
          • timeseries.js (SERVER-117391)
        • Same fixture as v1 suite: ShardedClusterFixturenum_shards: 1num_mongos: 3.
      1. New Evergreen task in etc/evergreen_yml_components/tasks/resmoke/server_divisions/query/tasks.yml:
        • Name: change_streams_per_shard_cursor_passthrough_v2
        • Tags: assigned_to_jira_team_server_query_executiondefaultchange_streamsrequires_all_feature_flags.
      1. All jstests/change_streams/*/.js tests (minus excluded files) pass in the new suite on the all-feature-flags variant.

      Out of scope: v2 coverage for jstests/noPassthrough/query/change_streams/ tests (separate ticket)

            Assignee:
            Lyublena Antova
            Reporter:
            Jan Steemann
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: