diff --git b/src/mongo/db/query/classic_runtime_planner/planner_interface.h a/src/mongo/db/query/classic_runtime_planner/planner_interface.h index 81f075ca126..47969151b2f 100644 --- b/src/mongo/db/query/classic_runtime_planner/planner_interface.h +++ a/src/mongo/db/query/classic_runtime_planner/planner_interface.h @@ -150,7 +150,8 @@ private: class SingleSolutionPassthroughPlanner final : public ClassicPlannerInterface { public: SingleSolutionPassthroughPlanner(PlannerData plannerData, - std::unique_ptr querySolution); + std::unique_ptr querySolution, + QueryPlanner::CostBasedRankerResult cbrResult); private: Status doPlan(PlanYieldPolicy* planYieldPolicy) override; diff --git b/src/mongo/db/query/classic_runtime_planner/single_solution_passthrough_planner.cpp a/src/mongo/db/query/classic_runtime_planner/single_solution_passthrough_planner.cpp index 9092e1e5a17..3cd4b8f3dcc 100644 --- b/src/mongo/db/query/classic_runtime_planner/single_solution_passthrough_planner.cpp +++ a/src/mongo/db/query/classic_runtime_planner/single_solution_passthrough_planner.cpp @@ -32,8 +32,11 @@ namespace mongo::classic_runtime_planner { SingleSolutionPassthroughPlanner::SingleSolutionPassthroughPlanner( - PlannerData plannerData, std::unique_ptr querySolution) - : ClassicPlannerInterface(std::move(plannerData)), _querySolution(std::move(querySolution)) { + PlannerData plannerData, + std::unique_ptr querySolution, + QueryPlanner::CostBasedRankerResult cbrResult) + : ClassicPlannerInterface(std::move(plannerData), std::move(cbrResult)), + _querySolution(std::move(querySolution)) { auto root = buildExecutableTree(*_querySolution); setRoot(std::move(root)); } diff --git b/src/mongo/db/query/get_executor.cpp a/src/mongo/db/query/get_executor.cpp index fae62fbdcf5..1894ba7f057 100644 --- b/src/mongo/db/query/get_executor.cpp +++ a/src/mongo/db/query/get_executor.cpp @@ -448,7 +448,8 @@ public: } else { planCacheCounters.incrementClassicSkippedCounter(); } - return buildSingleSolutionPlan(std::move(solution)); + return buildSingleSolutionPlan(std::move(solution), + QueryPlanner::CostBasedRankerResult{}); } // Tailable: If the query requests tailable the collection must be capped. @@ -536,7 +537,7 @@ public: 2, "Using fast count", "query"_attr = redact(_queryStringForDebugLog)); - return buildSingleSolutionPlan(std::move(solutions[i])); + return buildSingleSolutionPlan(std::move(solutions[i]), std::move(cbrResult)); } } } @@ -548,7 +549,7 @@ public: !internalQueryPlannerUseMultiplannerForSingleSolutions) { // Only one possible plan. Build the stages from the solution. solutions[0]->indexFilterApplied = _plannerParams->indexFiltersApplied; - return buildSingleSolutionPlan(std::move(solutions[0])); + return buildSingleSolutionPlan(std::move(solutions[0]), std::move(cbrResult)); } return buildMultiPlan(std::move(solutions), std::move(cbrResult)); } @@ -589,7 +590,7 @@ protected: * If there is only one available query solution, builds a PlanStage tree for it. */ virtual std::unique_ptr buildSingleSolutionPlan( - std::unique_ptr solution) = 0; + std::unique_ptr solution, QueryPlanner::CostBasedRankerResult cbrResult) = 0; /** * Either constructs a PlanStage tree from a cached plan (if exists in the plan cache), or @@ -702,10 +703,11 @@ private: } std::unique_ptr buildSingleSolutionPlan( - std::unique_ptr solution) final { + std::unique_ptr solution, + QueryPlanner::CostBasedRankerResult cbrResult) final { auto result = releaseResult(); result->runtimePlanner = std::make_unique( - makePlannerData(), std::move(solution)); + makePlannerData(), std::move(solution), std::move(cbrResult)); return result; } @@ -847,7 +849,8 @@ protected: } std::unique_ptr buildSingleSolutionPlan( - std::unique_ptr solution) final { + std::unique_ptr solution, + QueryPlanner::CostBasedRankerResult cbrResult) final { auto result = this->releaseResult(); result->runtimePlanner = std::make_unique( makePlannerData(), std::move(solution)); @@ -876,7 +879,8 @@ protected: this->makePlannerData(), std::move(solutions), true /*shouldWriteToPlanCache*/); return result; } else { - return this->buildSingleSolutionPlan(std::move(solutions[0])); + return this->buildSingleSolutionPlan(std::move(solutions[0]), + QueryPlanner::CostBasedRankerResult{}); } }