summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/plan_cache_util.h
diff options
context:
space:
mode:
authorAdrian Gonzalez <adriangonzalezmontemayor@gmail.com>2023-03-23 15:57:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-01 01:00:29 +0000
commit8177dc0ecccc852f65519dcca19edb7556ceecb3 (patch)
tree79dc12fd603442f7f0052fa3b8aef30e25e39a7a /src/mongo/db/exec/plan_cache_util.h
parent480606fd747a45ca1768bff3ee5eb8fd604030a6 (diff)
downloadmongo-8177dc0ecccc852f65519dcca19edb7556ceecb3.tar.gz
SERVER-74960 Filter out QE plans from planCacheStats
Diffstat (limited to 'src/mongo/db/exec/plan_cache_util.h')
-rw-r--r--src/mongo/db/exec/plan_cache_util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/exec/plan_cache_util.h b/src/mongo/db/exec/plan_cache_util.h
index b1744fbeb61..1567c8161b4 100644
--- a/src/mongo/db/exec/plan_cache_util.h
+++ b/src/mongo/db/exec/plan_cache_util.h
@@ -29,10 +29,12 @@
#pragma once
+#include "mongo/db/curop.h"
#include "mongo/db/exec/plan_stats.h"
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/query/collection_query_info.h"
#include "mongo/db/query/multiple_collection_accessor.h"
+#include "mongo/db/query/plan_cache.h"
#include "mongo/db/query/plan_cache_debug_info.h"
#include "mongo/db/query/plan_cache_key_factory.h"
#include "mongo/db/query/plan_explainer_factory.h"
@@ -187,6 +189,7 @@ void updatePlanCache(
winningPlan.solution->cacheData->indexFilterApplied =
winningPlan.solution->indexFilterApplied;
auto& collection = collections.getMainCollection();
+ auto isSensitive = CurOp::get(opCtx)->debug().shouldOmitDiagnosticInformation;
uassertStatusOK(CollectionQueryInfo::get(collection)
.getPlanCache()
->set(plan_cache_key_factory::make<PlanCacheKey>(query, collection),
@@ -194,6 +197,8 @@ void updatePlanCache(
*rankingDecision,
opCtx->getServiceContext()->getPreciseClockSource()->now(),
&callbacks,
+ isSensitive ? PlanSecurityLevel::kSensitive
+ : PlanSecurityLevel::kNotSensitive,
boost::none /* worksGrowthCoefficient */));
};
@@ -217,12 +222,15 @@ void updatePlanCache(
sbe::CachedSbePlan,
plan_cache_debug_info::DebugInfoSBE>
callbacks{query, buildDebugInfoFn};
+
+ auto isSensitive = CurOp::get(opCtx)->debug().shouldOmitDiagnosticInformation;
uassertStatusOK(sbe::getPlanCache(opCtx).set(
plan_cache_key_factory::make(query, collections),
std::move(cachedPlan),
*rankingDecision,
opCtx->getServiceContext()->getPreciseClockSource()->now(),
&callbacks,
+ isSensitive ? PlanSecurityLevel::kSensitive : PlanSecurityLevel::kNotSensitive,
boost::none /* worksGrowthCoefficient */));
} else {
static_assert(std::is_same_v<PlanStageType, PlanStage*>);