-
Type:
Sub-task
-
Resolution: Fixed
-
Priority:
Critical - P2
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
Fully Compatible
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Goal
Populate the reason field of queryPlanner.rankerChoice in explain V3. SERVER-132229 (PR #59603) emits the envelope with reason: "" as a placeholder; this ticket replaces the placeholder with the real value and discharges the corresponding TODO marker.
Mechanism
Each plan-ranking strategy records its terminal state at the point where the decision is made, and that value is threaded to the single emission point in explain (next to the existing chosenRanker source, OpDebug::planRankerMethod). The reason must never be inferred after the fact from which statistics happen to be present in the ranking result — several (chosenRanker, reason) pairs are indistinguishable by surviving statistics alone.
Reason values and where they are decided
Per the valid-combination table in the design doc ("Extend Explain for customer troubleshooting", section "Information computed during query planning by each plan ranker"):
- Config-fixed choices in the ranking dispatch (plan_ranking/plan_ranker.cpp): featureFlag, queryKnob, singlePlan
- Mixed / NoMultiplanningResults (cbr_for_no_mp_results.cpp): noMultiplanningResults, mpEarlyExitOrResult, smallCollection, inestimableNode (CBR fallback)
- Mixed / EstimateRankingEffort: cbrCheaperThanMp, mpCheaperThanCbr, mpEarlyExitEofOrFullBatch, inestimableMP, inestimableNode
- CBR strict-mode fallbacks: inestimableNode, histogramCEInternalColl
Scope notes
- Include representative per-configuration tests: a handful of (knob configuration, collection shape) -> expected reason rows covering each strategy family. The exhaustive validity matrix over (requestedRanker, chosenRanker, reason) triples is deliberately left to
SERVER-132230, which depends on this ticket — rationale: that matrix asserts the combined object and cannot pass before all three fields are real. - The optional phases decision trail (the design doc's may-defer enrichment) is out of scope here; the defer-or-drop decision is recorded at
SERVER-132230.
- depends on
-
SERVER-132230 Add requestedRanker to explain V3 and finalize the rankerChoice object
-
- Closed
-
-
SERVER-132104 Add plan rankerChoice to V3 explain
-
- Closed
-
- is depended on by
-
SERVER-132229 Add chosenRanker to explain V3
-
- Closed
-
- is related to
-
SERVER-132229 Add chosenRanker to explain V3
-
- Closed
-
-
SERVER-132230 Add requestedRanker to explain V3 and finalize the rankerChoice object
-
- Closed
-
- related to
-
SERVER-132012 Choose an explain-specialized PlanExplainer at the factory instead of the isExplain constructor flag
-
- Needs Scheduling
-
-
SERVER-132079 Stop sourcing explain content from OpDebug diagnostics state
-
- Needs Scheduling
-