Split ChangeStreamAddPostImageStage into ChangeStreamUpdateLookupStage and a post-image-only stage

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-06-22
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      The execution-level ChangeStreamAddPostImageStage currently does two unrelated jobs: the updateLookup enrichment (fullDocument: "updateLookup" - a lookup against the user collection) and the post-image-from-pre-image computation (applying the oplog delta on top of the pre-image, for the required / whenAvailable modes). Split it into two single-responsibility stages.

      Scope

      • Extract a dedicated ChangeStreamUpdateLookupStage handling only the updateLookup user-collection lookup.
      • Slim ChangeStreamAddPostImageStage down to only the post-image-from-pre-image+delta path (required / whenAvailable).
      • Have DocumentSourceChangeStreamAddPostImage build the correct execution stage per fullDocument mode.

      Files

      • src/mongo/db/exec/agg/change_stream_update_lookup_stage.h / .cpp (new)
      • src/mongo/db/exec/agg/change_stream_add_post_image_stage.h / .cpp
      • src/mongo/db/exec/agg/change_stream_add_post_image_stage_fn.cpp
      • src/mongo/db/pipeline/document_source_change_stream_add_post_image.h / .cpp

      Acceptance criteria

      • Behaviour-preserving: no change-stream output change, no feature flag.
      • Existing change_streams and the sharded / whole-db passthrough suites stay green.
      • Unit tests covering per-fullDocument-mode stage selection.

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

              Created:
              Updated:
              Resolved: