ExportXMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • DB Integration & Observability
    • QI 2025-02-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Deliverable

      Implement ChangeStreamEnsureResumeTokenPresentStage, a subclass of CheckResumability. The stage delivers and positions the outcome decided by the detector.

      Behavior

      • Materialize the stashed gap: Release the gap stashed by CheckResumability only when the exact ChangeStreamHistoryLost signal is received.
      • Build and position error events: Build per-event error events from recoverable failures using tryBuildErrorEvent. Compare each error event with the client resume token: swallow events at or before the token; emit events past thetoken.
      • Report filtered resume tokens: Emit the ChangeStreamFilteredToken gap (code 532) when the token's event was filtered out by the pipeline. Apply this behavior on the high-water-mark EOF path when the flag is enabled, too.
      • Fail closed for fragments: Raise ChangeStreamFatalError for fragment resumes, and skip fragments belonging to the resumed event.
      • Handle router role: Record each ordinary event's identity for router user stages. To move a built error event past those stages, throw ChangeStreamErrorEventBypass (code 534) with the event stashed in pendingChangeStreamRouterErrorEvent.

      Files

      • src/mongo/db/exec/agg/change_stream_ensure_resume_token_present_stage.h
      • src/mongo/db/exec/agg/change_stream_ensure_resume_token_present_stage.cpp
      • src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h
      • src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.cpp

      Tests

      Unit tests in check_resume_token:

      • Gap materialization
      • Positioning at, before, and past the token
      • Filtered-token gap
      • Fragment fail-closed behavior
      • High-water-mark EOF path
      • Router identity recording and code 534 throw

            Assignee:
            Cian Nugent McGealy
            Reporter:
            Nicola Cabiddu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: