From 6f450a3cea6287612329f44e90536d72fe7c16c5 Mon Sep 17 00:00:00 2001 From: Jennifer Peshansky Date: Wed, 21 Sep 2022 15:35:34 +0000 Subject: SERVER-69748 Remove redundant totalPipelineLookup counter --- jstests/noPassthrough/lookup_metrics.js | 12 +++++------- src/mongo/db/curop.h | 3 --- src/mongo/db/pipeline/pipeline_d.cpp | 1 - src/mongo/db/stats/counters.h | 14 ++++---------- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/jstests/noPassthrough/lookup_metrics.js b/jstests/noPassthrough/lookup_metrics.js index f8e76e7408d..810fb81f812 100644 --- a/jstests/noPassthrough/lookup_metrics.js +++ b/jstests/noPassthrough/lookup_metrics.js @@ -56,19 +56,17 @@ function generateExpectedCounters(joinStrategy = lookupStrategy.nonSbe, spillToD let counters = db.serverStatus().metrics.query.lookup; assert(counters, "counters did not exist"); let expected = Object.assign(counters); - expected.pipelineTotalCount = NumberLong(expected.pipelineTotalCount + 1); - let sbeCounters = expected.slotBasedExecutionCounters; switch (joinStrategy) { case lookupStrategy.nestedLoopJoin: - sbeCounters.nestedLoopJoin = NumberLong(sbeCounters.nestedLoopJoin + 1); + expected.nestedLoopJoin = NumberLong(expected.nestedLoopJoin + 1); break; case lookupStrategy.indexedLoopJoin: - sbeCounters.indexedLoopJoin = NumberLong(sbeCounters.indexedLoopJoin + 1); + expected.indexedLoopJoin = NumberLong(expected.indexedLoopJoin + 1); break; case lookupStrategy.hashLookup: - sbeCounters.hashLookup = NumberLong(sbeCounters.hashLookup + 1); - sbeCounters.hashLookupSpillToDisk = - NumberLong(sbeCounters.hashLookupSpillToDisk + spillToDisk); + expected.hashLookup = NumberLong(expected.hashLookup + 1); + expected.hashLookupSpillToDisk = + NumberLong(expected.hashLookupSpillToDisk + spillToDisk); break; } return expected; diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h index 6418883a605..d0e5d13313d 100644 --- a/src/mongo/db/curop.h +++ b/src/mongo/db/curop.h @@ -277,9 +277,6 @@ public: // Indicates whether this operation used the common query framework (CQF). bool cqfUsed{false}; - // Tracks whether an aggregation query has a lookup stage regardless of the engine used. - bool pipelineUsesLookup{false}; - // Tracks the amount of indexed loop joins in a pushed down lookup stage. int indexedLoopJoin{0}; diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index f05ffb88d16..42244a92098 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -185,7 +185,6 @@ std::vector> extractSbeCompatibleSt // $lookup pushdown logic. if (auto lookupStage = dynamic_cast(itr->get())) { - CurOp::get(expCtx->opCtx)->debug().pipelineUsesLookup = true; if (disallowLookupPushdown) { break; } diff --git a/src/mongo/db/stats/counters.h b/src/mongo/db/stats/counters.h index b1661392574..dcd9d432be5 100644 --- a/src/mongo/db/stats/counters.h +++ b/src/mongo/db/stats/counters.h @@ -367,24 +367,18 @@ public: LookupPushdownCounters() = default; void incrementLookupCounters(OpDebug& debug) { - if (debug.pipelineUsesLookup) { - totalLookup.increment(); - } nestedLoopJoin.increment(debug.nestedLoopJoin); indexedLoopJoin.increment(debug.indexedLoopJoin); hashLookup.increment(debug.hashLookup); hashLookupSpillToDisk.increment(debug.hashLookupSpillToDisk); } - // Counter tracking pipelines that have a lookup stage regardless of the engine used. - CounterMetric totalLookup{"query.lookup.pipelineTotalCount"}; // Counters for lookup join strategies. - CounterMetric nestedLoopJoin{"query.lookup.slotBasedExecutionCounters.nestedLoopJoin"}; - CounterMetric indexedLoopJoin{"query.lookup.slotBasedExecutionCounters.indexedLoopJoin"}; - CounterMetric hashLookup{"query.lookup.slotBasedExecutionCounters.hashLookup"}; + CounterMetric nestedLoopJoin{"query.lookup.nestedLoopJoin"}; + CounterMetric indexedLoopJoin{"query.lookup.indexedLoopJoin"}; + CounterMetric hashLookup{"query.lookup.hashLookup"}; // Counter tracking hashLookup spills in lookup stages that get pushed down. - CounterMetric hashLookupSpillToDisk{ - "query.lookup.slotBasedExecutionCounters.hashLookupSpillToDisk"}; + CounterMetric hashLookupSpillToDisk{"query.lookup.hashLookupSpillToDisk"}; }; extern LookupPushdownCounters lookupPushdownCounters; -- cgit v1.2.1