-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 9.0.0
-
Component/s: Query Execution
-
None
-
Query Integration
-
Fully Compatible
-
ALL
-
v9.0
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
InternalSearchIdLookUpStage::enrich tripwires with tassert 13006201 when the SBE idLookup executor returns kNotHandled. The query fails; mongod does not crash. Seen in production on 9.0.0 (AF-20648).
Problem
On 9.0, featureFlagSearchOptimizedIdLookup is on by default. buildIdLookupExecutor() installs SbeSingleDocumentLookupExecutor alone (no fallback) for $search / $vectorSearch $_internalSearchIdLookup when there is no view.
SbeSingleDocumentLookupExecutor::performLookup is allowed to return kNotHandled when:
- the _id type cannot be encoded as a single bound pair (object/compound _id, regex, array, ...)
- planning fails or the plan shape is not supported by SlotBinder
enrich() assumes a bare _id lookup is always handled and tripwires:
tassert(13006201,
"$_internalSearchIdLookup executor did not handle an _id lookup",
lookupResult.status != HandledStatus::kNotHandled);
Change-stream updateLookup already wraps the fast path with PrimaryWithFallbackSingleDocumentLookupExecutor. Search does not.
Impact
- Query fails with tassert 13006201; the process stays up
- Production replica set on 9.0.0 (AF-20648); duplicates AF-20627, AF-20666, AF-20669
- Does not affect views, returnStoredSource: true, or the flag-off local-read path
- Distinct from SERVER-134004 (UAF/SIGBUS on parked getMore)
Fix
In buildIdLookupExecutor(), when the flag is on and there is no view, wrap SBE with PrimaryWithFallbackSingleDocumentLookupExecutor and use InternalSearchIdLookUpLocalReadExecutor as the fallback (same pattern as change-stream updateLookup).
Do not treat kNotHandled as a document miss; that would silently drop search hits SBE cannot encode.
Testing
- Unit test that an SBE-declined _id (e.g. object _id) succeeds via local-read fallback instead of tasserting
- Existing $_internalSearchIdLookup tests continue to pass