From 5da1a52746a85a54b2809e8901da707a35d78e22 Mon Sep 17 00:00:00 2001 From: David Storch Date: Wed, 4 Nov 2020 17:07:16 -0500 Subject: SERVER-51524 Rename internalQueryCacheSize to internalQueryCacheMaxEntriesPerCollection Retains "internalQueryCacheSize" as a deprecated alias. The new name better reflects the function of the parameter, as it controls the number of cache entries allowed for each collection's cache rather than the overall size of the cache in bytes. --- jstests/noPassthrough/query_knobs_validation.js | 6 ++++++ src/mongo/db/query/plan_cache.cpp | 2 +- src/mongo/db/query/query_knobs.idl | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/jstests/noPassthrough/query_knobs_validation.js b/jstests/noPassthrough/query_knobs_validation.js index bc71b3528b1..7cc00544b08 100644 --- a/jstests/noPassthrough/query_knobs_validation.js +++ b/jstests/noPassthrough/query_knobs_validation.js @@ -14,6 +14,8 @@ const expectedParamDefaults = { internalQueryPlanEvaluationWorks: 10000, internalQueryPlanEvaluationCollFraction: 0.3, internalQueryPlanEvaluationMaxResults: 101, + internalQueryCacheMaxEntriesPerCollection: 5000, + // This is a deprecated alias for "internalQueryCacheMaxEntriesPerCollection". internalQueryCacheSize: 5000, internalQueryCacheEvictionRatio: 10.0, internalQueryCacheWorksGrowthCoefficient: 2.0, @@ -88,6 +90,10 @@ assertSetParameterSucceeds("internalQueryPlanEvaluationMaxResults", 11); assertSetParameterSucceeds("internalQueryPlanEvaluationMaxResults", 0); assertSetParameterFails("internalQueryPlanEvaluationMaxResults", -1); +assertSetParameterSucceeds("internalQueryCacheMaxEntriesPerCollection", 1); +assertSetParameterSucceeds("internalQueryCacheMaxEntriesPerCollection", 0); +assertSetParameterFails("internalQueryCacheMaxEntriesPerCollection", -1); +// "internalQueryCacheSize" is a deprecated alias for "internalQueryCacheMaxEntriesPerCollection". assertSetParameterSucceeds("internalQueryCacheSize", 1); assertSetParameterSucceeds("internalQueryCacheSize", 0); assertSetParameterFails("internalQueryCacheSize", -1); diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index a3c3543b2f2..67e9020c369 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -431,7 +431,7 @@ std::string SolutionCacheData::toString() const { // PlanCache // -PlanCache::PlanCache() : PlanCache(internalQueryCacheSize.load()) {} +PlanCache::PlanCache() : PlanCache(internalQueryCacheMaxEntriesPerCollection.load()) {} PlanCache::PlanCache(size_t size) : _cache(size) {} diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl index b23967929b0..52651caa6f0 100644 --- a/src/mongo/db/query/query_knobs.idl +++ b/src/mongo/db/query/query_knobs.idl @@ -90,11 +90,12 @@ server_parameters: # Plan cache # - internalQueryCacheSize: + internalQueryCacheMaxEntriesPerCollection: description: "The maximum number of entries allowed in a given collection's plan cache." set_at: [ startup, runtime ] - cpp_varname: "internalQueryCacheSize" + cpp_varname: "internalQueryCacheMaxEntriesPerCollection" cpp_vartype: AtomicWord + deprecated_name: "internalQueryCacheSize" default: 5000 validator: gte: 0 -- cgit v1.2.1