Introduce SingleDocumentLookupExecutor interface and PrimaryWithFallback combinator

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

      Add the SingleDocumentLookupExecutor abstraction that change-stream lookup strategies will implement, plus the PrimaryWithFallbackSingleDocumentLookupExecutor combinator that composes a primary strategy with a universal fallback. Interface and test mock only; no production wiring in this ticket.

      Scope

      • SingleDocumentLookupExecutor abstract base in src/mongo/db/exec/agg/single_doc_lookup/single_document_lookup_executor.h (header-only target, no SBE symbols).
      • A three-state LookupResult with values kNotHandled, kHandledNotFound, kHandledFound.
      • performLookup(expCtx, nss, collectionUUID, documentKey, afterClusterTime), where the last argument is boost::optional<Timestamp> (the event clusterTime, not a prebuilt readConcern).
      • detachFromOperationContext() / reattachToOperationContext() lifecycle hooks.
      • PrimaryWithFallbackSingleDocumentLookupExecutor: calls the primary; on kNotHandled it calls the fallback exactly once with identical arguments; forwards detach/reattach to both children.
      • A test-only mock executor.

      Acceptance criteria

      • Unit tests for chain dispatch:
        • kHandledFound / kHandledNotFound return immediately; fallback not invoked.
        • kNotHandled invokes the fallback exactly once with the same arguments.
        • detach/reattach forwarded to both primary and fallback.
      • No production callsite wired.

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

              Created:
              Updated:
              Resolved: