-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
Fully Compatible
-
QE 2026-06-22
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Summary
Implement the Express single-document lookup executor: a per-call _id-equality local point
lookup that serves the change-stream updateLookup against the user collection, declining
(kNotHandled) to the Aggregation fallback when the lookup is not provably local. No production
wiring here – wiring lands in a follow-up ticket.
Scope
- ExpressSingleDocumentLookupExecutor implementing SingleDocumentLookupExecutor
(SERVER-128408). - Eligibility-gated cheap decline: on an Unknown decision, return kNotHandled before any
collection acquisition or plan build. - Build a fresh executor per call via the existing public makeExpressExecutorForFindById /
makeExpressExecutorForFindByClusteredId (from plan_executor_express.h), choosing the
variant from the live collection layout. - _id-only seek: strip any shard-key fields a sharded documentKey carries before building the
find. Correct because _id is unique per shard and the read is local and versioned. - Exception handling: StaleConfig / StaleDbVersion / ShardCannotRefreshDueToLocksHeld
invalidate as appropriate and return kNotHandled; NamespaceNotFound /
CollectionUUIDMismatch return kHandledNotFound; anything else propagates. - Call assertLocalLookupReadAtOrAfter() (
SERVER-128411) after acquisition for point-in-time
correctness. - Acquirer-agnostic: holds the polymorphic CollectionAcquirer base.
Files
- src/mongo/db/exec/agg/single_doc_lookup/express_single_document_lookup_executor.h / .cpp
- src/mongo/db/exec/agg/single_doc_lookup/single_document_lookup_executor_test.cpp (executor matrix)
Acceptance criteria
- All paths of the exception handling covered by unit tests, parameterised over the eligibility
mock. - A multi-field (sharded) documentKey is served by matching _id alone (kHandledFound), not
declined for being sharded; a stale shard-key value in the documentKey is ignored. - Cheap-decline verified: an Unknown decision returns kNotHandled with no acquisition.
Dependencies
Depends on SERVER-128408 (interface), SERVER-128411 (acquirer), SERVER-128412 (eligibility).
- is related to
-
SERVER-128408 Introduce SingleDocumentLookupExecutor interface and PrimaryWithFallback combinator
-
- Closed
-
-
SERVER-128411 Add CollectionAcquirer interface with OnDemand and PreAcquired implementations
-
- Closed
-
-
SERVER-128412 Add LocalLookupEligibility interface with AlwaysLocal and always-decline implementations
-
- Closed
-
- related to
-
SERVER-129514 Record updateLookup metrics from the Express lookup executor
-
- Backlog
-
-
SERVER-128414 Wire ExpressSingleDocumentLookupExecutor live behind featureFlagChangeStreamOptimizedUpdateLookup
-
- Closed
-
-
SERVER-128963 Move the Express plan executor into its own library so it links without query_exec
-
- Closed
-