-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Motivation
In 9.0, $search and $vectorSearch move to the extensions API. The extension initiates gRPC requests and sets the three x-mongodb-* headers itself (see CLOUDP-373134).
However, a runtime fallback from extensions back to the legacy implementation must remain functional (IFR flag toggle, kick-back on unsupported patterns). When the legacy path is invoked, the server must emit the same headers so
that L7 load balancers can treat extension and legacy traffic uniformly.
Without this, any request that falls back to legacy silently loses all L7 routing metadata, breaking command-aware routing, consistent query grouping, and shard-aware dispatch for downstream proxies.
Scope
Header emission is required for the following legacy-path commands:
- aggregate with $search / $vectorSearch / $searchMeta when executed via the legacy implementation (IFR flag off or kick-back triggered)
- planShardedSearch — mongos-to-mongot planning command for sharded collections
- getMore on cursors originating from search pipelines (must carry forward the headers established on the initial command)
Header Semantics
| Header | Purpose |
|---|---|
| x-mongodb-command | Command name (aggregate, planShardedSearch, getMore, etc.) for command-aware L7 routing |
| x-mongodb-searchnodepreference | xxHash64(searchNodePreference.key) for logical query grouping / consistent routing to the same mongot |
| x-mongodb-shardid | Shard identity so L7 can dispatch to the correct per-shard mongot backend. |
Semantics must stay aligned with the extensions-path implementation so that LBs can apply a single set of routing rules regardless of which code path produced the traffic.
Impact If Not Done
- If headers are consumed (extensions path active): Fallback to legacy causes routing failures.
- If headers are not consumed: No viable path to Atlas-grade L7 with off-the-shelf or customer-managed LBs for legacy traffic, and UX degradation for customers.
- related to
-
SERVER-120289 [Propagating ShardId] Send ShardId to Extensions
-
- Closed
-