Add LocalLookupEligibility interface with AlwaysLocal and always-decline implementations

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

      Introduce the LocalLookupEligibility interface and factory that decides, per event, whether a
      change-stream lookup can be served locally. Ships the two trivial implementations needed for the
      first optimized path; the real sharded routing module lands later (M4). No pipeline wiring yet –
      consumed by the Express executor (later in this milestone).

      Scope

      • Define LocalLookupEligibility with a check() returning a decision that is either
        Local (carrying the shard/db version it was based on) or Unknown, plus an isLocal()
        helper.
      • Define the LocalLookupEligibilityFactory interface (+ mock) so the decision strategy is
        injectable per stage.
      • AlwaysLocalEligibility: always returns Local. Correct for replica sets, pre-images and
        $search.
      • Always-decline implementation: always returns Unknown. The sharded placeholder, so sharded
        clusters route through the unchanged Aggregation fallback until M4.

      Files

      • src/mongo/db/exec/agg/single_doc_lookup/local_lookup_eligibility.h / .cpp
      • src/mongo/db/exec/agg/single_doc_lookup/local_lookup_eligibility_factory_interface.h
      • src/mongo/db/exec/agg/single_doc_lookup/local_lookup_eligibility_factory_impl.h / .cpp
      • src/mongo/db/exec/agg/single_doc_lookup/local_lookup_eligibility_factory_mock.h
      • src/mongo/db/exec/agg/single_doc_lookup/mock_local_lookup_eligibility.h
      • src/mongo/db/exec/agg/single_doc_lookup/local_lookup_eligibility_test.cpp

      Acceptance criteria

      • Interface + factory defined; both implementations return the documented decision.
      • Unit tests cover AlwaysLocal returning Local and the always-decline impl returning
        Unknown.

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

              Created:
              Updated:
              Resolved: