Implement SbeSingleDocumentLookupExecutor for local _id point lookups

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • QE 2026-06-22, QE 2026-07-06
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      Add SbeSingleDocumentLookupExecutor, an SBE-based SingleDocumentLookupExecutor strategy for
      local _id point lookups. It compiles a parameterized _id-only SBE plan once and reuses it across
      lookups by rebinding the single _id slot, amortizing plan compilation. It is intended for any
      caller that issues many _id-style lookups against a fixed namespace: change-stream post-image
      (updateLookup) and pre-image lookups, and the internal search idLookup stage.

      Details

      • SlotBinder rebinds the cached plan's bounds slots per call. Two supported shapes:
        • kIxscanKeyPair – non-clustered id IXSCAN (KeyString low/high slot pair).
        • kClusteredRecordIdPair – clustered collection, min/max RecordId slots (handles scalar and compound BSON _id).
        • Any other plan shape returns kNotHandled so the PrimaryWithFallback chain routes onward.
      • The compiled plan is the only cross-call cache; invalidation is keyed on (collectionUUID, CollectionQueryInfo::getPlanCacheInvalidatorVersion()).
      • Eligibility runs through LocalLookupEligibility::run(expCtx, nss, documentKey, body); catalog-and-routing errors reset cached state and rethrow so the eligibility's route() retry rebuilds cleanly.
      • Plugs into the batched enrichment stage from SERVER-129168.

      Testing

      Unit tests in sbe_single_document_lookup_executor_test.cpp: functional lookups, cross-call plan reuse (stress, non-clustered + clustered + compound _id), plan-shape assertions (index scan vs bounded clustered scan, no residual filter), and SlotBinder engagement counters.

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

              Created:
              Updated: