-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
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 (HandleTopologyChangeV2, InjectControlEvents) 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:
- 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: ShardedClusterFixture, num_shards: 1, num_mongos: 3.
- 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_execution, default, change_streams, requires_all_feature_flags.
- 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)
- is related to
-
SERVER-117391 Ensure change_streams/timeseries.js test passes when running change streams in v2 mode
-
- Needs Scheduling
-
-
SERVER-114511 V2 change stream readers may miss events when the resume point matches the commit of a chunk migration
-
- Backlog
-