summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorArun Banala <arun.banala@mongodb.com>2019-02-01 12:39:00 +0000
committerArun Banala <arun.banala@mongodb.com>2019-02-06 18:16:29 +0000
commit2b674c38879a8e3074924c0fe892c52ceec3ea0e (patch)
treef7c86597b1578451233d717edd402e7f9b6201dd /src/mongo
parent5cbcfe8b8a2444a7d5d6274ff90d7de32eef9adc (diff)
downloadmongo-2b674c38879a8e3074924c0fe892c52ceec3ea0e.tar.gz
SERVER-35402 Add validators where applicable in query_knobs.cpp
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/catalog/index_key_validate.cpp2
-rw-r--r--src/mongo/db/catalog/index_key_validate_test.cpp2
-rw-r--r--src/mongo/db/catalog/index_spec_validate_test.cpp2
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp2
-rw-r--r--src/mongo/db/exec/cached_plan.cpp2
-rw-r--r--src/mongo/db/exec/sort.cpp2
-rw-r--r--src/mongo/db/matcher/expression_parser.cpp2
-rw-r--r--src/mongo/db/matcher/schema/json_schema_parser_test.cpp2
-rw-r--r--src/mongo/db/ops/write_ops.h3
-rw-r--r--src/mongo/db/ops/write_ops_exec.cpp4
-rw-r--r--src/mongo/db/pipeline/document_source_change_stream.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_check_resume_token.h2
-rw-r--r--src/mongo/db/pipeline/document_source_lookup.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_lookup_test.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_merge_cursors_test.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_sort.h2
-rw-r--r--src/mongo/db/pipeline/pipeline.h2
-rw-r--r--src/mongo/db/pipeline/tee_buffer.h2
-rw-r--r--src/mongo/db/query/SConscript4
-rw-r--r--src/mongo/db/query/get_executor.cpp2
-rw-r--r--src/mongo/db/query/index_bounds_builder.cpp2
-rw-r--r--src/mongo/db/query/plan_cache.cpp2
-rw-r--r--src/mongo/db/query/plan_cache_test.cpp2
-rw-r--r--src/mongo/db/query/plan_enumerator.h2
-rw-r--r--src/mongo/db/query/plan_ranker.cpp2
-rw-r--r--src/mongo/db/query/plan_yield_policy.cpp2
-rw-r--r--src/mongo/db/query/planner_access.cpp2
-rw-r--r--src/mongo/db/query/query_knobs.cpp135
-rw-r--r--src/mongo/db/query/query_knobs.h144
-rw-r--r--src/mongo/db/query/query_knobs.idl307
-rw-r--r--src/mongo/db/query/query_planner_params.h2
-rw-r--r--src/mongo/db/query/query_planner_test_fixture.cpp2
-rw-r--r--src/mongo/db/repair_database.cpp2
-rw-r--r--src/mongo/db/repl/applier_helpers.cpp6
-rw-r--r--src/mongo/db/repl/sync_tail.cpp2
-rw-r--r--src/mongo/db/repl/sync_tail_test.cpp5
-rw-r--r--src/mongo/db/s/collection_range_deleter.cpp2
-rw-r--r--src/mongo/dbtests/plan_ranking.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_cached_plan.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_multiplan.cpp2
40 files changed, 352 insertions, 320 deletions
diff --git a/src/mongo/db/catalog/index_key_validate.cpp b/src/mongo/db/catalog/index_key_validate.cpp
index b9b9f9117a5..79f933005fe 100644
--- a/src/mongo/db/catalog/index_key_validate.cpp
+++ b/src/mongo/db/catalog/index_key_validate.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/service_context.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/catalog/index_key_validate_test.cpp b/src/mongo/db/catalog/index_key_validate_test.cpp
index c8f7c52ae62..79250881015 100644
--- a/src/mongo/db/catalog/index_key_validate_test.cpp
+++ b/src/mongo/db/catalog/index_key_validate_test.cpp
@@ -38,7 +38,7 @@
#include "mongo/bson/bsonmisc.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/db/catalog/index_spec_validate_test.cpp b/src/mongo/db/catalog/index_spec_validate_test.cpp
index 5f4530f4ef4..0f65b45c916 100644
--- a/src/mongo/db/catalog/index_spec_validate_test.cpp
+++ b/src/mongo/db/catalog/index_spec_validate_test.cpp
@@ -42,7 +42,7 @@
#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/query/collation/collator_interface_mock.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/query/query_test_service_context.h"
#include "mongo/db/server_options.h"
#include "mongo/unittest/ensure_fcv.h"
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index cb32f5c9349..b2ea369eb38 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/index_builder.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/database_sharding_state.h"
diff --git a/src/mongo/db/exec/cached_plan.cpp b/src/mongo/db/exec/cached_plan.cpp
index ec7d1d3608f..7ec2804d17f 100644
--- a/src/mongo/db/exec/cached_plan.cpp
+++ b/src/mongo/db/exec/cached_plan.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/query/plan_cache.h"
#include "mongo/db/query/plan_ranker.h"
#include "mongo/db/query/plan_yield_policy.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/stage_builder.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp
index 6ddf5b4078e..e46eb55694e 100644
--- a/src/mongo/db/exec/sort.cpp
+++ b/src/mongo/db/exec/sort.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/index/btree_key_generator.h"
#include "mongo/db/index_names.h"
#include "mongo/db/query/find_common.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/stdx/memory.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp
index e75fa98d8e0..13e75b92859 100644
--- a/src/mongo/db/matcher/expression_parser.cpp
+++ b/src/mongo/db/matcher/expression_parser.cpp
@@ -68,7 +68,7 @@
#include "mongo/db/matcher/schema/expression_internal_schema_xor.h"
#include "mongo/db/matcher/schema/json_schema_parser.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/string_map.h"
diff --git a/src/mongo/db/matcher/schema/json_schema_parser_test.cpp b/src/mongo/db/matcher/schema/json_schema_parser_test.cpp
index 0c7fbb52f59..29a6f6e2c00 100644
--- a/src/mongo/db/matcher/schema/json_schema_parser_test.cpp
+++ b/src/mongo/db/matcher/schema/json_schema_parser_test.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/bson/bson_helper.h"
#include "mongo/db/matcher/expression_always_boolean.h"
#include "mongo/db/matcher/schema/json_schema_parser.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
diff --git a/src/mongo/db/ops/write_ops.h b/src/mongo/db/ops/write_ops.h
index a8a233c0128..a9939d0e5f7 100644
--- a/src/mongo/db/ops/write_ops.h
+++ b/src/mongo/db/ops/write_ops.h
@@ -62,6 +62,9 @@ namespace write_ops {
// used if the protocol changes to avoid the 16MB limit on reply size.
constexpr size_t kMaxWriteBatchSize = 100'000;
+// Limit the size that we write without yielding to 16MB / 64 (max expected number of indexes)
+constexpr size_t insertVectorMaxBytes = 256 * 1024;
+
/**
* Retrieves the statement id for the write at the specified position in the write batch entries
* array.
diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp
index a273dd31e95..7607384169b 100644
--- a/src/mongo/db/ops/write_ops_exec.cpp
+++ b/src/mongo/db/ops/write_ops_exec.cpp
@@ -60,7 +60,6 @@
#include "mongo/db/ops/write_ops_retryability.h"
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/plan_summary_stats.h"
-#include "mongo/db/query/query_knobs.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/retryable_writes_stats.h"
@@ -523,6 +522,7 @@ WriteResult performInserts(OperationContext* opCtx,
size_t bytesInBatch = 0;
std::vector<InsertStatement> batch;
const size_t maxBatchSize = internalInsertMaxBatchSize.load();
+ const size_t maxBatchBytes = write_ops::insertVectorMaxBytes;
batch.reserve(std::min(wholeOp.getDocuments().size(), maxBatchSize));
for (auto&& doc : wholeOp.getDocuments()) {
@@ -547,7 +547,7 @@ WriteResult performInserts(OperationContext* opCtx,
BSONObj toInsert = fixedDoc.getValue().isEmpty() ? doc : std::move(fixedDoc.getValue());
batch.emplace_back(stmtId, toInsert);
bytesInBatch += batch.back().doc.objsize();
- if (!isLastDoc && batch.size() < maxBatchSize && bytesInBatch < insertVectorMaxBytes)
+ if (!isLastDoc && batch.size() < maxBatchSize && bytesInBatch < maxBatchBytes)
continue; // Add more to batch before inserting.
}
diff --git a/src/mongo/db/pipeline/document_source_change_stream.cpp b/src/mongo/db/pipeline/document_source_change_stream.cpp
index 74ac3842377..cf424c8c877 100644
--- a/src/mongo/db/pipeline/document_source_change_stream.cpp
+++ b/src/mongo/db/pipeline/document_source_change_stream.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/pipeline/expression.h"
#include "mongo/db/pipeline/lite_parsed_document_source.h"
#include "mongo/db/pipeline/resume_token.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/repl/oplog_entry.h"
#include "mongo/db/repl/oplog_entry_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
diff --git a/src/mongo/db/pipeline/document_source_check_resume_token.h b/src/mongo/db/pipeline/document_source_check_resume_token.h
index 7489e156029..d919f19fa62 100644
--- a/src/mongo/db/pipeline/document_source_check_resume_token.h
+++ b/src/mongo/db/pipeline/document_source_check_resume_token.h
@@ -36,7 +36,7 @@
#include "mongo/db/pipeline/document_source_change_stream_gen.h"
#include "mongo/db/pipeline/document_source_sort.h"
#include "mongo/db/pipeline/resume_token.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
namespace mongo {
/**
diff --git a/src/mongo/db/pipeline/document_source_lookup.cpp b/src/mongo/db/pipeline/document_source_lookup.cpp
index 692717c6966..370a4636c3a 100644
--- a/src/mongo/db/pipeline/document_source_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source_lookup.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/pipeline/expression.h"
#include "mongo/db/pipeline/expression_context.h"
#include "mongo/db/pipeline/value.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/stdx/memory.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_lookup_test.cpp b/src/mongo/db/pipeline/document_source_lookup_test.cpp
index 64e12231227..df388dcd455 100644
--- a/src/mongo/db/pipeline/document_source_lookup_test.cpp
+++ b/src/mongo/db/pipeline/document_source_lookup_test.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/pipeline/field_path.h"
#include "mongo/db/pipeline/stub_mongo_process_interface.h"
#include "mongo/db/pipeline/value.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/repl/storage_interface_mock.h"
#include "mongo/db/server_options.h"
diff --git a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp
index 6a423c4e116..b312641e08a 100644
--- a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp
+++ b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp
@@ -42,7 +42,7 @@
#include "mongo/db/pipeline/expression_context.h"
#include "mongo/db/query/cursor_response.h"
#include "mongo/db/query/getmore_request.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/query/query_request.h"
#include "mongo/executor/network_interface_mock.h"
#include "mongo/executor/task_executor.h"
diff --git a/src/mongo/db/pipeline/document_source_sort.h b/src/mongo/db/pipeline/document_source_sort.h
index 4ee2584bc45..4a07cc64f37 100644
--- a/src/mongo/db/pipeline/document_source_sort.h
+++ b/src/mongo/db/pipeline/document_source_sort.h
@@ -34,7 +34,7 @@
#include "mongo/db/pipeline/document_source.h"
#include "mongo/db/pipeline/document_source_limit.h"
#include "mongo/db/pipeline/expression.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/sorter/sorter.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/pipeline.h b/src/mongo/db/pipeline/pipeline.h
index ea2c92000dc..c156354f328 100644
--- a/src/mongo/db/pipeline/pipeline.h
+++ b/src/mongo/db/pipeline/pipeline.h
@@ -40,7 +40,7 @@
#include "mongo/db/pipeline/dependencies.h"
#include "mongo/db/pipeline/value.h"
#include "mongo/db/query/explain_options.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/executor/task_executor.h"
#include "mongo/s/query/async_results_merger_params_gen.h"
#include "mongo/stdx/functional.h"
diff --git a/src/mongo/db/pipeline/tee_buffer.h b/src/mongo/db/pipeline/tee_buffer.h
index 898265419e7..dec9448ef63 100644
--- a/src/mongo/db/pipeline/tee_buffer.h
+++ b/src/mongo/db/pipeline/tee_buffer.h
@@ -36,7 +36,7 @@
#include "mongo/db/pipeline/document.h"
#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/util/intrusive_counter.h"
namespace mongo {
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"
diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp
index 20808127c4f..b45e3ad1298 100644
--- a/src/mongo/db/repair_database.cpp
+++ b/src/mongo/db/repair_database.cpp
@@ -54,7 +54,7 @@
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/logical_clock.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/util/log.h"
#include "mongo/util/scopeguard.h"
diff --git a/src/mongo/db/repl/applier_helpers.cpp b/src/mongo/db/repl/applier_helpers.cpp
index ec8633cf6bb..8ecd76ffa30 100644
--- a/src/mongo/db/repl/applier_helpers.cpp
+++ b/src/mongo/db/repl/applier_helpers.cpp
@@ -38,7 +38,7 @@
#include <iterator>
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/ops/write_ops.h"
#include "mongo/db/repl/oplog_entry.h"
#include "mongo/db/repl/sync_tail.h"
#include "mongo/util/assert_util.h"
@@ -50,7 +50,7 @@ namespace repl {
namespace {
// Must not create too large an object.
-const auto kInsertGroupMaxBatchSize = insertVectorMaxBytes;
+const auto kInsertGroupMaxBatchSize = write_ops::insertVectorMaxBytes;
// Limit number of ops in a single group.
constexpr auto kInsertGroupMaxBatchCount = 64;
@@ -99,7 +99,7 @@ StatusWith<InsertGroup::ConstIterator> InsertGroup::groupAndApplyInserts(ConstIt
std::vector<BSONObj> toInsert;
// Make sure to include the first op in the batch size.
- auto batchSize = entry.getObject().objsize();
+ size_t batchSize = entry.getObject().objsize();
auto batchCount = OperationPtrs::size_type(1);
auto batchNamespace = entry.getNss();
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index ef39d869278..e7b666ff784 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -59,7 +59,7 @@
#include "mongo/db/logical_session_id.h"
#include "mongo/db/multi_key_path_tracker.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/repl/applier_helpers.h"
#include "mongo/db/repl/apply_ops.h"
#include "mongo/db/repl/bgsync.h"
diff --git a/src/mongo/db/repl/sync_tail_test.cpp b/src/mongo/db/repl/sync_tail_test.cpp
index 96c77646196..71c55ac584f 100644
--- a/src/mongo/db/repl/sync_tail_test.cpp
+++ b/src/mongo/db/repl/sync_tail_test.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/jsobj.h"
+#include "mongo/db/ops/write_ops.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/bgsync.h"
#include "mongo/db/repl/drop_pending_collection_reaper.h"
@@ -759,7 +760,7 @@ TEST_F(SyncTailTest, MultiSyncApplyLimitsBatchSizeWhenGroupingInsertOperations)
auto createOp = makeCreateCollectionOplogEntry({Timestamp(Seconds(seconds++), 0), 1LL}, nss);
// Create a sequence of insert ops that are too large to fit in one group.
- int maxBatchSize = insertVectorMaxBytes;
+ int maxBatchSize = write_ops::insertVectorMaxBytes;
int opsPerBatch = 3;
int opSize = maxBatchSize / opsPerBatch - 500; // Leave some room for other oplog fields.
@@ -807,7 +808,7 @@ TEST_F(SyncTailTest, MultiSyncApplyAppliesOpIndividuallyWhenOpIndividuallyExceed
NamespaceString nss("test." + _agent.getSuiteName() + "_" + _agent.getTestName());
auto createOp = makeCreateCollectionOplogEntry({Timestamp(Seconds(seconds++), 0), 1LL}, nss);
- int maxBatchSize = insertVectorMaxBytes;
+ int maxBatchSize = write_ops::insertVectorMaxBytes;
// Create an insert op that exceeds the maximum batch size by itself.
auto insertOpLarge = makeSizedInsertOp(nss, maxBatchSize, seconds++);
auto insertOpSmall = makeSizedInsertOp(nss, 100, seconds++);
diff --git a/src/mongo/db/s/collection_range_deleter.cpp b/src/mongo/db/s/collection_range_deleter.cpp
index 42d9e5cca23..4f98f91f88e 100644
--- a/src/mongo/db/s/collection_range_deleter.cpp
+++ b/src/mongo/db/s/collection_range_deleter.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/query/plan_yield_policy.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/repl/repl_client_info.h"
#include "mongo/db/s/collection_sharding_runtime.h"
diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp
index 61b6671976a..73aeb34137d 100644
--- a/src/mongo/dbtests/plan_ranking.cpp
+++ b/src/mongo/dbtests/plan_ranking.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/json.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/query/get_executor.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/stage_builder.h"
diff --git a/src/mongo/dbtests/query_stage_cached_plan.cpp b/src/mongo/dbtests/query_stage_cached_plan.cpp
index 94e20f10f98..79cf93942c7 100644
--- a/src/mongo/dbtests/query_stage_cached_plan.cpp
+++ b/src/mongo/dbtests/query_stage_cached_plan.cpp
@@ -46,7 +46,7 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/plan_cache.h"
#include "mongo/db/query/plan_yield_policy.h"
-#include "mongo/db/query/query_knobs.h"
+#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/query/query_planner_params.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/dbtests/query_stage_multiplan.cpp b/src/mongo/dbtests/query_stage_multiplan.cpp
index db4c0de5a32..1774a2f8677 100644
--- a/src/mongo/dbtests/query_stage_multiplan.cpp
+++ b/src/mongo/dbtests/query_stage_multiplan.cpp
@@ -49,7 +49,7 @@
#include "mongo/db/query/mock_yield_policies.h"
#include "mongo/db/query/plan_executor.h"
#include "mongo/db/query/plan_summary_stats.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/stage_builder.h"