diff options
author | Arun Banala <arun.banala@mongodb.com> | 2019-02-01 12:39:00 +0000 |
---|---|---|
committer | Arun Banala <arun.banala@mongodb.com> | 2019-02-06 18:16:29 +0000 |
commit | 2b674c38879a8e3074924c0fe892c52ceec3ea0e (patch) | |
tree | f7c86597b1578451233d717edd402e7f9b6201dd /src/mongo/db/query | |
parent | 5cbcfe8b8a2444a7d5d6274ff90d7de32eef9adc (diff) | |
download | mongo-2b674c38879a8e3074924c0fe892c52ceec3ea0e.tar.gz |
SERVER-35402 Add validators where applicable in query_knobs.cpp
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/SConscript | 4 | ||||
-rw-r--r-- | src/mongo/db/query/get_executor.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/index_bounds_builder.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/plan_enumerator.h | 2 | ||||
-rw-r--r-- | src/mongo/db/query/plan_ranker.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/plan_yield_policy.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/planner_access.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/query_knobs.cpp | 135 | ||||
-rw-r--r-- | src/mongo/db/query/query_knobs.h | 144 | ||||
-rw-r--r-- | src/mongo/db/query/query_knobs.idl | 307 | ||||
-rw-r--r-- | src/mongo/db/query/query_planner_params.h | 2 | ||||
-rw-r--r-- | src/mongo/db/query/query_planner_test_fixture.cpp | 2 |
14 files changed, 319 insertions, 291 deletions
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript index 1e95b6b1e74..4f386a8659a 100644 --- a/src/mongo/db/query/SConscript +++ b/src/mongo/db/query/SConscript @@ -189,10 +189,10 @@ env.Library( env.Library( target="query_knobs", source=[ - "query_knobs.cpp" + env.Idlc('query_knobs.idl')[0] ], LIBDEPS_PRIVATE=[ - '$BUILD_DIR/mongo/db/server_parameters' + '$BUILD_DIR/mongo/idl/server_parameter' ] ) diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 549d752d440..fe773ca31a1 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -71,7 +71,7 @@ #include "mongo/db/query/planner_analysis.h" #include "mongo/db/query/planner_ixselect.h" #include "mongo/db/query/planner_wildcard_helpers.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner.h" #include "mongo/db/query/query_planner_common.h" #include "mongo/db/query/query_settings.h" diff --git a/src/mongo/db/query/index_bounds_builder.cpp b/src/mongo/db/query/index_bounds_builder.cpp index 6d0e245cc19..75491c83944 100644 --- a/src/mongo/db/query/index_bounds_builder.cpp +++ b/src/mongo/db/query/index_bounds_builder.cpp @@ -49,7 +49,7 @@ #include "mongo/db/query/indexability.h" #include "mongo/db/query/planner_ixselect.h" #include "mongo/db/query/planner_wildcard_helpers.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" #include "third_party/s2/s2cell.h" diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index 3ea3cf871d7..6ffc5d604e3 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -48,7 +48,7 @@ #include "mongo/db/query/canonical_query_encoder.h" #include "mongo/db/query/collation/collator_interface.h" #include "mongo/db/query/plan_ranker.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_solution.h" #include "mongo/util/assert_util.h" #include "mongo/util/hex.h" diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp index fde92088aa1..a4cae2338cc 100644 --- a/src/mongo/db/query/plan_cache_test.cpp +++ b/src/mongo/db/query/plan_cache_test.cpp @@ -46,7 +46,7 @@ #include "mongo/db/query/canonical_query_encoder.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/query/plan_ranker.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner.h" #include "mongo/db/query/query_planner_test_lib.h" #include "mongo/db/query/query_solution.h" diff --git a/src/mongo/db/query/plan_enumerator.h b/src/mongo/db/query/plan_enumerator.h index f8a3b587031..68391cdd93f 100644 --- a/src/mongo/db/query/plan_enumerator.h +++ b/src/mongo/db/query/plan_enumerator.h @@ -37,7 +37,7 @@ #include "mongo/db/query/canonical_query.h" #include "mongo/db/query/index_entry.h" #include "mongo/db/query/index_tag.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/stdx/unordered_map.h" namespace mongo { diff --git a/src/mongo/db/query/plan_ranker.cpp b/src/mongo/db/query/plan_ranker.cpp index 897e664e7f1..cf0b9234185 100644 --- a/src/mongo/db/query/plan_ranker.cpp +++ b/src/mongo/db/query/plan_ranker.cpp @@ -42,7 +42,7 @@ #include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/query/explain.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_solution.h" #include "mongo/db/server_options.h" #include "mongo/db/server_parameters.h" diff --git a/src/mongo/db/query/plan_yield_policy.cpp b/src/mongo/db/query/plan_yield_policy.cpp index 030d5102733..1cc62a9afd2 100644 --- a/src/mongo/db/query/plan_yield_policy.cpp +++ b/src/mongo/db/query/plan_yield_policy.cpp @@ -36,7 +36,7 @@ #include "mongo/db/curop.h" #include "mongo/db/curop_failpoint_helpers.h" #include "mongo/db/operation_context.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_yield.h" #include "mongo/db/service_context.h" #include "mongo/util/fail_point_service.h" diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp index fee744329ed..3bb7f088b69 100644 --- a/src/mongo/db/query/planner_access.cpp +++ b/src/mongo/db/query/planner_access.cpp @@ -48,7 +48,7 @@ #include "mongo/db/query/index_tag.h" #include "mongo/db/query/indexability.h" #include "mongo/db/query/planner_wildcard_helpers.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner.h" #include "mongo/db/query/query_planner_common.h" #include "mongo/stdx/memory.h" diff --git a/src/mongo/db/query/query_knobs.cpp b/src/mongo/db/query/query_knobs.cpp deleted file mode 100644 index 8ce2f7a084d..00000000000 --- a/src/mongo/db/query/query_knobs.cpp +++ /dev/null @@ -1,135 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/db/query/query_knobs.h" - -#include "mongo/bson/util/builder.h" -#include "mongo/db/server_options.h" -#include "mongo/db/server_parameters.h" - -namespace mongo { - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlanEvaluationWorks, int, 10000); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlanEvaluationCollFraction, double, 0.3); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlanEvaluationMaxResults, int, 101); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryCacheSize, int, 5000); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryCacheFeedbacksStored, int, 20); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryCacheEvictionRatio, double, 10.0); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryCacheWorksGrowthCoefficient, double, 2.0) - ->withValidator([](const double& newVal) { - if (newVal <= 1.0) { - return Status(ErrorCodes::BadValue, - "internalQueryCacheWorksGrowthCoefficient must be > 1.0"); - } - return Status::OK(); - }); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryCacheDisableInactiveEntries, bool, false); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryCacheListPlansNewOutput, bool, false); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlannerMaxIndexedSolutions, int, 64); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryEnumerationMaxOrSolutions, int, 10); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryEnumerationMaxIntersectPerAnd, int, 3); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryForceIntersectionPlans, bool, false); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlannerEnableIndexIntersection, bool, true); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlannerEnableHashIntersection, bool, false); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlanOrChildrenIndependently, bool, true); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryMaxScansToExplode, int, 200); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryExecMaxBlockingSortBytes, int, 32 * 1024 * 1024); - -// Yield every 128 cycles or 10ms. -MONGO_EXPORT_SERVER_PARAMETER(internalQueryExecYieldIterations, int, 128); -MONGO_EXPORT_SERVER_PARAMETER(internalQueryExecYieldPeriodMS, int, 10); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryFacetBufferSizeBytes, int, 100 * 1024 * 1024); - -MONGO_EXPORT_SERVER_PARAMETER(internalDocumentSourceSortMaxBlockingSortBytes, - long long, - 100 * 1024 * 1024) - ->withValidator([](const long long& newVal) { - if (newVal <= 0) { - return Status(ErrorCodes::BadValue, - "internalDocumentSourceSortMaxBlockingSortBytes must be > 0"); - } - return Status::OK(); - }); - -MONGO_EXPORT_SERVER_PARAMETER(internalLookupStageIntermediateDocumentMaxSizeBytes, - long long, - 100 * 1024 * 1024) - ->withValidator([](const long long& newVal) { - if (newVal < BSONObjMaxInternalSize) { - return Status(ErrorCodes::BadValue, - "internalLookupStageIntermediateDocumentMaxSizeBytes must be >= " + - std::to_string(BSONObjMaxInternalSize)); - } - return Status::OK(); - }); - -MONGO_EXPORT_SERVER_PARAMETER(internalDocumentSourceGroupMaxMemoryBytes, - long long, - 100 * 1024 * 1024) - ->withValidator([](const long long& newVal) { - if (newVal <= 0) { - return Status(ErrorCodes::BadValue, - "internalDocumentSourceGroupMaxMemoryBytes must be > 0"); - } - return Status::OK(); - }); - -MONGO_EXPORT_SERVER_PARAMETER(internalInsertMaxBatchSize, - int, - internalQueryExecYieldIterations.load() / 2); - -MONGO_EXPORT_SERVER_PARAMETER(internalDocumentSourceCursorBatchSizeBytes, int, 4 * 1024 * 1024); - -MONGO_EXPORT_SERVER_PARAMETER(internalDocumentSourceLookupCacheSizeBytes, int, 100 * 1024 * 1024); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryPlannerGenerateCoveredWholeIndexScans, bool, false); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryIgnoreUnknownJSONSchemaKeywords, bool, false); - -MONGO_EXPORT_SERVER_PARAMETER(internalQueryProhibitBlockingMergeOnMongoS, bool, false); -} // namespace mongo diff --git a/src/mongo/db/query/query_knobs.h b/src/mongo/db/query/query_knobs.h deleted file mode 100644 index 976bb1a4ec3..00000000000 --- a/src/mongo/db/query/query_knobs.h +++ /dev/null @@ -1,144 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include "mongo/platform/atomic_proxy.h" -#include "mongo/platform/atomic_word.h" - -namespace mongo { - -// -// multi-plan ranking -// - -// Max number of times we call work() on plans before comparing them, -// for small collections. -extern AtomicWord<int> internalQueryPlanEvaluationWorks; - -// For large collections, the number times we work() candidate plans is -// taken as this fraction of the collection size. -extern AtomicDouble internalQueryPlanEvaluationCollFraction; - -// Stop working plans once a plan returns this many results. -extern AtomicWord<int> internalQueryPlanEvaluationMaxResults; - -// Do we give a big ranking bonus to intersection plans? -extern AtomicWord<bool> internalQueryForceIntersectionPlans; - -// Do we have ixisect on at all? -extern AtomicWord<bool> internalQueryPlannerEnableIndexIntersection; - -// Do we use hash-based intersection for rooted $and queries? -extern AtomicWord<bool> internalQueryPlannerEnableHashIntersection; - -// -// plan cache -// - -// How many entries in the cache? -extern AtomicWord<int> internalQueryCacheSize; - -// How many feedback entries do we collect before possibly evicting from the cache based on bad -// performance? -extern AtomicWord<int> internalQueryCacheFeedbacksStored; - -// How many times more works must we perform in order to justify plan cache eviction -// and replanning? -extern AtomicDouble internalQueryCacheEvictionRatio; - -// How quickly the the 'works' value in an inactive cache entry will grow. It grows -// exponentially. The value of this server parameter is the base. -extern AtomicDouble internalQueryCacheWorksGrowthCoefficient; - -// Whether or not cache entries can be marked as "inactive." -extern AtomicWord<bool> internalQueryCacheDisableInactiveEntries; - -// Whether or not planCacheListPlans uses the new output format. -extern AtomicWord<bool> internalQueryCacheListPlansNewOutput; - -// -// Planning and enumeration. -// - -// How many indexed solutions will QueryPlanner::plan output? -extern AtomicWord<int> internalQueryPlannerMaxIndexedSolutions; - -// How many solutions will the enumerator consider at each OR? -extern AtomicWord<int> internalQueryEnumerationMaxOrSolutions; - -// How many intersections will the enumerator consider at each AND? -extern AtomicWord<int> internalQueryEnumerationMaxIntersectPerAnd; - -// Do we want to plan each child of the OR independently? -extern AtomicWord<bool> internalQueryPlanOrChildrenIndependently; - -// How many index scans are we willing to produce in order to obtain a sort order -// during explodeForSort? -extern AtomicWord<int> internalQueryMaxScansToExplode; - -// Allow the planner to generate covered whole index scans, rather than falling back to a COLLSCAN. -extern AtomicWord<bool> internalQueryPlannerGenerateCoveredWholeIndexScans; - -// Ignore unknown JSON Schema keywords. -extern AtomicWord<bool> internalQueryIgnoreUnknownJSONSchemaKeywords; - -// -// Query execution. -// - -extern AtomicWord<int> internalQueryExecMaxBlockingSortBytes; - -// Yield after this many "should yield?" checks. -extern AtomicWord<int> internalQueryExecYieldIterations; - -// Yield if it's been at least this many milliseconds since we last yielded. -extern AtomicWord<int> internalQueryExecYieldPeriodMS; - -// Limit the size that we write without yielding to 16MB / 64 (max expected number of indexes) -const int64_t insertVectorMaxBytes = 256 * 1024; - -// The number of bytes to buffer at once during a $facet stage. -extern AtomicWord<int> internalQueryFacetBufferSizeBytes; - -extern AtomicWord<long long> internalDocumentSourceSortMaxBlockingSortBytes; - -extern AtomicWord<long long> internalLookupStageIntermediateDocumentMaxSizeBytes; - -extern AtomicWord<long long> internalDocumentSourceGroupMaxMemoryBytes; - -extern AtomicWord<int> internalInsertMaxBatchSize; - -extern AtomicWord<int> internalDocumentSourceCursorBatchSizeBytes; - -extern AtomicWord<int> internalDocumentSourceLookupCacheSizeBytes; - -extern AtomicWord<bool> internalQueryProhibitBlockingMergeOnMongoS; -} // namespace mongo diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl new file mode 100644 index 00000000000..6e362f12e6e --- /dev/null +++ b/src/mongo/db/query/query_knobs.idl @@ -0,0 +1,307 @@ +# Copyright (C) 2019-present MongoDB, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the Server Side Public License, version 1, +# as published by MongoDB, Inc. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Server Side Public License for more details. +# +# You should have received a copy of the Server Side Public License +# along with this program. If not, see +# <http://www.mongodb.com/licensing/server-side-public-license>. +# +# As a special exception, the copyright holders give permission to link the +# code of portions of this program with the OpenSSL library under certain +# conditions as described in each individual source file and distribute +# linked combinations including the program with the OpenSSL library. You +# must comply with the Server Side Public License in all respects for +# all of the code used other than as permitted herein. If you modify file(s) +# with this exception, you may extend this exception to your version of the +# file(s), but you are not obligated to do so. If you do not wish to do so, +# delete this exception statement from your version. If you delete this +# exception statement from all source files in the program, then also delete +# it in the license file. +# + +global: + cpp_namespace: "mongo" + cpp_includes: + - "mongo/platform/atomic_proxy.h" + - "mongo/platform/atomic_word.h" + +server_parameters: + + # + # multi-plan ranking + # + internalQueryPlanEvaluationWorks: + description: "Max number of times we call work() on plans before comparing them, for small collections." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlanEvaluationWorks" + cpp_vartype: AtomicWord<int> + default: 10000 + validator: + gt: 0 + + internalQueryPlanEvaluationCollFraction: + description: "For large collections, the number times we work() candidate plans is taken as this fraction of the collection size." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlanEvaluationCollFraction" + cpp_vartype: AtomicDouble + default: 0.3 + validator: + gte: 0.0 + lte: 1.0 + + internalQueryPlanEvaluationMaxResults: + description: "Stop working plans once a plan returns this many results." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlanEvaluationMaxResults" + cpp_vartype: AtomicWord<int> + default: 101 + validator: + gte: 0 + + internalQueryForceIntersectionPlans: + description: "Do we give a big ranking bonus to intersection plans?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryForceIntersectionPlans" + cpp_vartype: AtomicWord<bool> + default: false + + internalQueryPlannerEnableIndexIntersection: + description: "Do we have ixisect on at all?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlannerEnableIndexIntersection" + cpp_vartype: AtomicWord<bool> + default: true + + internalQueryPlannerEnableHashIntersection: + description: "Do we use hash-based intersection for rooted $and queries?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlannerEnableHashIntersection" + cpp_vartype: AtomicWord<bool> + default: false + + # + # Plan cache + # + internalQueryCacheSize: + description: "How many entries in the cache?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryCacheSize" + cpp_vartype: AtomicWord<int> + default: 5000 + validator: + gte: 0 + + internalQueryCacheFeedbacksStored: + description: "How many feedback entries do we collect before possibly evicting from the cache based on bad performance?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryCacheFeedbacksStored" + cpp_vartype: AtomicWord<int> + default: 20 + validator: + gte: 0 + + internalQueryCacheEvictionRatio: + description: "How many times more works must we perform in order to justify plan cache eviction and replanning?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryCacheEvictionRatio" + cpp_vartype: AtomicDouble + default: 10.0 + validator: + gte: 0.0 + + internalQueryCacheWorksGrowthCoefficient: + description: "How quickly the the 'works' value in an inactive cache entry will grow. It grows exponentially. The value of this server parameter is the base." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryCacheWorksGrowthCoefficient" + cpp_vartype: AtomicDouble + default: 2.0 + validator: + gt: 1.0 + + internalQueryCacheDisableInactiveEntries: + description: "Whether or not cache entries can be marked as 'inactive'." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryCacheDisableInactiveEntries" + cpp_vartype: AtomicWord<bool> + default: false + + internalQueryCacheListPlansNewOutput: + description: "Whether or not planCacheListPlans uses the new output format." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryCacheListPlansNewOutput" + cpp_vartype: AtomicWord<bool> + default: false + + # + # Planning and enumeration + # + internalQueryPlannerMaxIndexedSolutions: + description: "How many indexed solutions will QueryPlanner::plan output?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlannerMaxIndexedSolutions" + cpp_vartype: AtomicWord<int> + default: 64 + validator: + gte: 0 + + internalQueryEnumerationMaxOrSolutions: + description: "How many solutions will the enumerator consider at each OR?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryEnumerationMaxOrSolutions" + cpp_vartype: AtomicWord<int> + default: 10 + validator: + gte: 0 + + internalQueryEnumerationMaxIntersectPerAnd: + description: "How many intersections will the enumerator consider at each AND?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryEnumerationMaxIntersectPerAnd" + cpp_vartype: AtomicWord<int> + default: 3 + validator: + gte: 0 + + internalQueryPlanOrChildrenIndependently: + description: "Do we want to plan each child of the OR independently?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlanOrChildrenIndependently" + cpp_vartype: AtomicWord<bool> + default: true + + internalQueryMaxScansToExplode: + description: "How many index scans are we willing to produce in order to obtain a sort order during explodeForSort?" + set_at: [ startup, runtime ] + cpp_varname: "internalQueryMaxScansToExplode" + cpp_vartype: AtomicWord<int> + default: 200 + validator: + gte: 0 + + internalQueryPlannerGenerateCoveredWholeIndexScans: + description: "Allow the planner to generate covered whole index scans, rather than falling back to a COLLSCAN." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryPlannerGenerateCoveredWholeIndexScans" + cpp_vartype: AtomicWord<bool> + default: false + + internalQueryIgnoreUnknownJSONSchemaKeywords: + description: "Ignore unknown JSON Schema keywords." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryIgnoreUnknownJSONSchemaKeywords" + cpp_vartype: AtomicWord<bool> + default: false + + # + # Query execution + # + internalQueryExecMaxBlockingSortBytes: + description: "internal query execute maximum blocking sort in bytes." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryExecMaxBlockingSortBytes" + cpp_vartype: AtomicWord<int> + default: + expr: 32 * 1024 * 1024 + validator: + gte: 0 + + internalQueryExecYieldIterations: + description: "Yield after this many \"should yield?\" checks." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryExecYieldIterations" + cpp_vartype: AtomicWord<int> + default: 128 + + internalQueryExecYieldPeriodMS: + description: "Yield if it's been at least this many milliseconds since we last yielded." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryExecYieldPeriodMS" + cpp_vartype: AtomicWord<int> + default: 10 + validator: + gte: 0 + + internalQueryFacetBufferSizeBytes: + description: "The number of bytes to buffer at once during a $facet stage." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryFacetBufferSizeBytes" + cpp_vartype: AtomicWord<int> + default: + expr: 100 * 1024 * 1024 + validator: + gt: 0 + + internalDocumentSourceSortMaxBlockingSortBytes: + description: "The maximum size of the dataset that we are prepared to sort in-memory." + set_at: [ startup, runtime ] + cpp_varname: "internalDocumentSourceSortMaxBlockingSortBytes" + cpp_vartype: AtomicWord<long long> + default: + expr: 100 * 1024 * 1024 + validator: + gt: 0 + + internalLookupStageIntermediateDocumentMaxSizeBytes: + description: "Maximum size of the result set that we cache from the foreign collection during a $lookup." + set_at: [ startup, runtime ] + cpp_varname: "internalLookupStageIntermediateDocumentMaxSizeBytes" + cpp_vartype: AtomicWord<long long> + default: + expr: 100 * 1024 * 1024 + validator: + gte: { expr: BSONObjMaxInternalSize} + + internalDocumentSourceGroupMaxMemoryBytes: + description: "Maximum size of the data that the $group aggregation stage will cache in-memory before spilling to disk." + set_at: [ startup, runtime ] + cpp_varname: "internalDocumentSourceGroupMaxMemoryBytes" + cpp_vartype: AtomicWord<long long> + default: + expr: 100 * 1024 * 1024 + validator: + gt: 0 + + internalInsertMaxBatchSize: + description: "Maximum number of documents that we will insert in a single batch." + set_at: [ startup, runtime ] + cpp_varname: "internalInsertMaxBatchSize" + cpp_vartype: AtomicWord<int> + default: + expr: internalQueryExecYieldIterations.load() / 2 + is_constexpr: false + validator: + gt: 0 + + internalDocumentSourceCursorBatchSizeBytes: + description: "Maximum amount of data that DocumentSourceCursor will cache from the underlying PlanExecutor before pipeline processing." + set_at: [ startup, runtime ] + cpp_varname: "internalDocumentSourceCursorBatchSizeBytes" + cpp_vartype: AtomicWord<int> + default: + expr: 4 * 1024 * 1024 + validator: + gte: 0 + + internalDocumentSourceLookupCacheSizeBytes: + description: "Maximum amount of non-correlated foreign-collection data that the $lookup stage will cache before abandoning the cache and executing the full pipeline on each iteration." + set_at: [ startup, runtime ] + cpp_varname: "internalDocumentSourceLookupCacheSizeBytes" + cpp_vartype: AtomicWord<int> + default: + expr: 100 * 1024 * 1024 + validator: + gte: 0 + + internalQueryProhibitBlockingMergeOnMongoS: + description: "If true, blocking stages such as $group or non-merging $sort will be prohibited from running on mongoS." + set_at: [ startup, runtime ] + cpp_varname: "internalQueryProhibitBlockingMergeOnMongoS" + cpp_vartype: AtomicWord<bool> + default: false diff --git a/src/mongo/db/query/query_planner_params.h b/src/mongo/db/query/query_planner_params.h index a0ab362be68..679e21b7737 100644 --- a/src/mongo/db/query/query_planner_params.h +++ b/src/mongo/db/query/query_planner_params.h @@ -34,7 +34,7 @@ #include "mongo/db/jsobj.h" #include "mongo/db/query/index_entry.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" namespace mongo { diff --git a/src/mongo/db/query/query_planner_test_fixture.cpp b/src/mongo/db/query/query_planner_test_fixture.cpp index 01c0823809f..d8e2d2016e5 100644 --- a/src/mongo/db/query/query_planner_test_fixture.cpp +++ b/src/mongo/db/query/query_planner_test_fixture.cpp @@ -40,7 +40,7 @@ #include "mongo/db/matcher/extensions_callback_noop.h" #include "mongo/db/namespace_string.h" #include "mongo/db/pipeline/expression_context_for_test.h" -#include "mongo/db/query/query_knobs.h" +#include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner.h" #include "mongo/db/query/query_planner_test_lib.h" #include "mongo/util/log.h" |