summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Segel <daniel_segel@brown.edu>2022-06-16 15:55:42 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-23 19:27:23 +0000
commit7ad5fbf86418d2a6f17d553b5888198c5f9de05a (patch)
tree9a0aca73b4de1b6f005cfc6aa395d1675eecffe0
parent924507bde170b07fc25bb994ab6b0ee852afcb53 (diff)
downloadmongo-7ad5fbf86418d2a6f17d553b5888198c5f9de05a.tar.gz
SERVER-66956 Remove redundant tests in MULTI_PLAN and CACHED_PLAN
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index ebf38ca93d6..adbca1bf973 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -1234,7 +1234,6 @@ PipelineD::buildInnerQueryExecutorGeneric(const MultipleCollectionAccessor& coll
unpack && sort) {
auto execImpl = dynamic_cast<PlanExecutorImpl*>(exec.get());
if (execImpl) {
-
// Get source stage
PlanStage* rootStage = execImpl->getRootStage();
while (rootStage &&
@@ -1247,28 +1246,27 @@ PipelineD::buildInnerQueryExecutorGeneric(const MultipleCollectionAccessor& coll
case STAGE_SHARDING_FILTER:
rootStage = rootStage->child().get();
break;
- case STAGE_MULTI_PLAN:
- if (auto mps = static_cast<MultiPlanStage*>(rootStage)) {
- if (mps->bestPlanChosen() && mps->bestPlanIdx()) {
- rootStage = (mps->getChildren())[*(mps->bestPlanIdx())].get();
- } else {
- rootStage = nullptr;
- tasserted(6655801,
- "Expected multiplanner to have selected a bestPlan.");
- }
+ case STAGE_MULTI_PLAN: {
+ auto mps = static_cast<MultiPlanStage*>(rootStage);
+ if (mps->bestPlanChosen() && mps->bestPlanIdx()) {
+ rootStage = (mps->getChildren())[*(mps->bestPlanIdx())].get();
+ } else {
+ rootStage = nullptr;
+ tasserted(6655801,
+ "Expected multiplanner to have selected a bestPlan.");
}
break;
- case STAGE_CACHED_PLAN:
- if (auto cp = static_cast<CachedPlanStage*>(rootStage)) {
- if (cp->bestPlanChosen()) {
- rootStage = rootStage->child().get();
- } else {
- rootStage = nullptr;
- tasserted(6655802,
- "Expected cached plan to have selected a bestPlan.");
- }
+ }
+ case STAGE_CACHED_PLAN: {
+ auto cp = static_cast<CachedPlanStage*>(rootStage);
+ if (cp->bestPlanChosen()) {
+ rootStage = rootStage->child().get();
+ } else {
+ rootStage = nullptr;
+ tasserted(6655802, "Expected cached plan to have selected a bestPlan.");
}
break;
+ }
default:
rootStage = nullptr;
}