ExportXMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.1.0-rc0, 9.1.0-rc1025
    • Affects Version/s: None
    • Component/s: None
    • None
    • DB Integration & Observability
    • Fully Compatible
    • QE 2026-10-26
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Deliverable

      Add per-cursor, per-node change-stream state to ExpressionContext. All state is gated by changeStreamShowsErrorsAsEvents() (which reads spec.showErrorsAsEvents); when the flag is off, the state operations are no-ops.

      • activeChangeStreamEvent — optional<Document>
      • activeChangeStreamErrorSource — optional<ChangeStreamErrorSource>
      • pendingChangeStreamResumeGap — optional<Document>
      • pendingChangeStreamRouterErrorEvent — optional<Document>
      • changeStreamOplogFloorAfterRollover — optional<Timestamp>

      Add recordActiveEventIdentity(). It records an identity envelope containing _id (the resume token from the single-element sort key), clusterTime, wallTime, ns, and documentKey.

      recordActiveEventIdentity() is a no-op when:

      • changeStreamShowsErrorsAsEvents() is off.
      • The document is itself an error event.
      • There is no single-element object sort key.

      Files

      • src/mongo/db/pipeline/expression_context.h
      • src/mongo/db/pipeline/change_stream_helpers.cpp

      Tests

      • Verify the identity envelope is built from a normal event.
      • Verify recording is a no-op when the feature flag is off, for an error event, and when there is no single-element sort key.
      • Verify the state slots' set/get/clear/release lifecycle.

      Dependency

      • ChangeStreamError conversion stage.

            Assignee:
            Nicola Cabiddu
            Reporter:
            Nicola Cabiddu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: