summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/SConscript3
-rw-r--r--src/mongo/bson/bson_validate.cpp1
-rw-r--r--src/mongo/db/SConscript25
-rw-r--r--src/mongo/db/auth/authorization_manager_impl.cpp1
-rw-r--r--src/mongo/db/auth/authz_session_external_state_server_common.cpp1
-rw-r--r--src/mongo/db/auth/sasl_options_init.cpp1
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job.cpp1
-rw-r--r--src/mongo/db/catalog/SConscript1
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp1
-rw-r--r--src/mongo/db/catalog/collection_options.cpp1
-rw-r--r--src/mongo/db/catalog/database_impl.cpp1
-rw-r--r--src/mongo/db/catalog/multi_index_block.cpp1
-rw-r--r--src/mongo/db/catalog/namespace_uuid_cache.cpp1
-rw-r--r--src/mongo/db/cloner.cpp1
-rw-r--r--src/mongo/db/commands.cpp1
-rw-r--r--src/mongo/db/commands/dbcommands.cpp1
-rw-r--r--src/mongo/db/commands/dbcommands_d.cpp1
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.cpp1
-rw-r--r--src/mongo/db/commands/find_cmd.cpp1
-rw-r--r--src/mongo/db/commands/write_commands/write_commands.cpp1
-rw-r--r--src/mongo/db/concurrency/d_concurrency.cpp1
-rw-r--r--src/mongo/db/concurrency/write_conflict_exception.cpp1
-rw-r--r--src/mongo/db/cursor_manager.cpp1
-rw-r--r--src/mongo/db/cursor_server_params.cpp1
-rw-r--r--src/mongo/db/db.cpp1
-rw-r--r--src/mongo/db/db_raii.cpp1
-rw-r--r--src/mongo/db/free_mon/free_mon_mongod.cpp1
-rw-r--r--src/mongo/db/ftdc/SConscript1
-rw-r--r--src/mongo/db/ftdc/ftdc_mongos.cpp1
-rw-r--r--src/mongo/db/ftdc/ftdc_server.cpp1
-rw-r--r--src/mongo/db/initialize_operation_session_info.cpp1
-rw-r--r--src/mongo/db/initialize_server_global_state.cpp1
-rw-r--r--src/mongo/db/keys_collection_manager.cpp1
-rw-r--r--src/mongo/db/logical_clock.cpp1
-rw-r--r--src/mongo/db/logical_session_cache_factory_mongos.cpp1
-rw-r--r--src/mongo/db/logical_session_cache_impl.cpp1
-rw-r--r--src/mongo/db/logical_session_id.cpp1
-rw-r--r--src/mongo/db/query/explain.cpp1
-rw-r--r--src/mongo/db/query/expression_index.cpp1
-rw-r--r--src/mongo/db/query/find.cpp1
-rw-r--r--src/mongo/db/query/get_executor.cpp1
-rw-r--r--src/mongo/db/query/plan_ranker.cpp1
-rw-r--r--src/mongo/db/repl/initial_syncer_test.cpp1
-rw-r--r--src/mongo/db/repl/oplog.cpp1
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp1
-rw-r--r--src/mongo/db/repl/replication_info.cpp1
-rw-r--r--src/mongo/db/repl/rollback_impl.cpp1
-rw-r--r--src/mongo/db/repl/topology_coordinator.cpp1
-rw-r--r--src/mongo/db/s/sharding_state_recovery.cpp1
-rw-r--r--src/mongo/db/s/transaction_coordinator_test_fixture.cpp1
-rw-r--r--src/mongo/db/server_options_helpers.cpp1
-rw-r--r--src/mongo/db/server_options_server_helpers.cpp1
-rw-r--r--src/mongo/db/server_parameters.cpp130
-rw-r--r--src/mongo/db/server_parameters.h454
-rw-r--r--src/mongo/db/server_parameters_test.cpp272
-rw-r--r--src/mongo/db/snapshot_window_options.cpp1
-rw-r--r--src/mongo/db/stats/server_write_concern_metrics.cpp1
-rw-r--r--src/mongo/db/storage/storage_options.cpp1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp1
-rw-r--r--src/mongo/db/transaction_participant.cpp1
-rw-r--r--src/mongo/db/transaction_reaper.cpp1
-rw-r--r--src/mongo/db/ttl.cpp1
-rw-r--r--src/mongo/db/views/SConscript1
-rw-r--r--src/mongo/db/views/view_catalog.cpp1
-rw-r--r--src/mongo/executor/network_interface_factory.cpp1
-rw-r--r--src/mongo/executor/task_executor_pool.cpp1
-rw-r--r--src/mongo/idl/SConscript1
-rw-r--r--src/mongo/idl/server_parameter.cpp84
-rw-r--r--src/mongo/idl/server_parameter.h110
-rw-r--r--src/mongo/idl/server_parameter_with_storage.h5
-rw-r--r--src/mongo/s/async_requests_sender.cpp1
-rw-r--r--src/mongo/s/client/shard_remote.cpp1
-rw-r--r--src/mongo/s/commands/cluster_is_master_cmd.cpp1
-rw-r--r--src/mongo/s/commands/kill_sessions_remote.cpp1
-rw-r--r--src/mongo/s/query/cluster_cursor_cleanup_job.cpp1
-rw-r--r--src/mongo/s/sharding_initialization.cpp1
-rw-r--r--src/mongo/scripting/deadline_monitor.cpp1
-rw-r--r--src/mongo/scripting/mozjs/engine.cpp1
-rw-r--r--src/mongo/scripting/mozjs/implscope.cpp1
-rw-r--r--src/mongo/shell/shell_options.cpp1
-rw-r--r--src/mongo/transport/service_executor_adaptive.cpp1
-rw-r--r--src/mongo/transport/service_executor_reserved.cpp1
-rw-r--r--src/mongo/transport/service_executor_synchronous.cpp1
-rw-r--r--src/mongo/util/SConscript1
-rw-r--r--src/mongo/util/heap_profiler.cpp1
-rw-r--r--src/mongo/util/net/ssl_manager.cpp1
-rw-r--r--src/mongo/util/net/ssl_manager_openssl.cpp1
-rw-r--r--src/mongo/util/net/ssl_manager_windows.cpp1
-rw-r--r--src/mongo/util/tcmalloc_server_status_section.cpp1
-rw-r--r--src/mongo/util/tcmalloc_set_parameter.cpp1
91 files changed, 197 insertions, 969 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 2257c7a4874..47ab1f75b12 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -578,9 +578,6 @@ if not has_option('noshell') and usemozjs:
'executor/network_interface_thread_pool',
'executor/network_interface_factory'
],
- LIBDEPS_PRIVATE=[
- 'db/server_parameters',
- ],
# Because `::environ` is resolved in `/usr/lib/crt1.o` on FreeBSD, this library
# needs to be marked `incomplete` on FreeBSD.
LIBDEPS_TAGS=[] if not env.TargetOSIs('freebsd') else [
diff --git a/src/mongo/bson/bson_validate.cpp b/src/mongo/bson/bson_validate.cpp
index 58ca1e36b04..da7f1de0c1c 100644
--- a/src/mongo/bson/bson_validate.cpp
+++ b/src/mongo/bson/bson_validate.cpp
@@ -36,7 +36,6 @@
#include "mongo/bson/bson_validate.h"
#include "mongo/bson/oid.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/decimal128.h"
namespace mongo {
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index d2450be99b8..38dc0b2a8af 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -316,27 +316,6 @@ env.CppUnitTest(
)
env.Library(
- target="server_parameters",
- source=[
- "server_parameters.cpp",
- ],
- LIBDEPS=[
- "$BUILD_DIR/mongo/base",
- ],
-)
-
-env.CppUnitTest(
- target="server_parameters_test",
- source=[
- "server_parameters_test.cpp",
- ],
- LIBDEPS=[
- "server_parameters",
- '$BUILD_DIR/mongo/db/service_context',
- ],
-)
-
-env.Library(
target='update_index_data',
source=[
'update_index_data.cpp'
@@ -1319,7 +1298,7 @@ env.Library(
'$BUILD_DIR/mongo/crypto/sha256_block',
'$BUILD_DIR/mongo/crypto/sha_block_${MONGO_CRYPTO}',
'$BUILD_DIR/mongo/idl/idl_parser',
- 'server_parameters',
+ '$BUILD_DIR/mongo/idl/server_parameter',
],
)
@@ -1531,7 +1510,6 @@ env.Library(
'logical_session_id',
'logical_session_id_helpers',
'sessions_collection',
- 'server_parameters',
'service_liaison',
'kill_sessions',
],
@@ -1811,7 +1789,6 @@ env.Library(
LIBDEPS=[
'global_settings',
'logical_time',
- 'server_parameters',
'service_context',
],
)
diff --git a/src/mongo/db/auth/authorization_manager_impl.cpp b/src/mongo/db/auth/authorization_manager_impl.cpp
index 5230d3b03b4..d5a27073171 100644
--- a/src/mongo/db/auth/authorization_manager_impl.cpp
+++ b/src/mongo/db/auth/authorization_manager_impl.cpp
@@ -61,7 +61,6 @@
#include "mongo/db/global_settings.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/mongod_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/compiler.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/mutex.h"
diff --git a/src/mongo/db/auth/authz_session_external_state_server_common.cpp b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
index 04dc3dca10d..b9829fde37e 100644
--- a/src/mongo/db/auth/authz_session_external_state_server_common.cpp
+++ b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
@@ -38,7 +38,6 @@
#include "mongo/base/status.h"
#include "mongo/db/auth/enable_localhost_auth_bypass_parameter_gen.h"
#include "mongo/db/client.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/debug_util.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/auth/sasl_options_init.cpp b/src/mongo/db/auth/sasl_options_init.cpp
index 496b2dcfcda..7f95efd89a9 100644
--- a/src/mongo/db/auth/sasl_options_init.cpp
+++ b/src/mongo/db/auth/sasl_options_init.cpp
@@ -33,7 +33,6 @@
#include "mongo/db/auth/sasl_options_gen.h"
#include "mongo/base/status.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/socket_utils.h"
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp
index 03421abb084..893cc5ddae7 100644
--- a/src/mongo/db/auth/user_cache_invalidator_job.cpp
+++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp
@@ -42,7 +42,6 @@
#include "mongo/db/auth/user_cache_invalidator_job_parameters_gen.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/compiler.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/s/grid.h"
diff --git a/src/mongo/db/catalog/SConscript b/src/mongo/db/catalog/SConscript
index 8df3a14f64c..efc323713ce 100644
--- a/src/mongo/db/catalog/SConscript
+++ b/src/mongo/db/catalog/SConscript
@@ -22,7 +22,6 @@ env.Library(
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/command_generic_argument',
'$BUILD_DIR/mongo/db/query/collation/collator_interface',
- '$BUILD_DIR/mongo/db/server_parameters',
],
)
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index becb24e6b28..bb8cc7e4bb6 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -68,7 +68,6 @@
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/key_string.h"
#include "mongo/db/storage/record_store.h"
diff --git a/src/mongo/db/catalog/collection_options.cpp b/src/mongo/db/catalog/collection_options.cpp
index e742758e357..9ab9ffeb91b 100644
--- a/src/mongo/db/catalog/collection_options.cpp
+++ b/src/mongo/db/catalog/collection_options.cpp
@@ -38,7 +38,6 @@
#include "mongo/db/commands.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/db/query/collation/collator_interface.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index 7f07a23d029..3583d7e4c81 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -62,7 +62,6 @@
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/top.h"
#include "mongo/db/storage/recovery_unit.h"
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp
index 4e08e685548..e7d6ff713b1 100644
--- a/src/mongo/db/catalog/multi_index_block.cpp
+++ b/src/mongo/db/catalog/multi_index_block.cpp
@@ -49,7 +49,6 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/db/storage/write_unit_of_work.h"
#include "mongo/logger/redaction.h"
diff --git a/src/mongo/db/catalog/namespace_uuid_cache.cpp b/src/mongo/db/catalog/namespace_uuid_cache.cpp
index 3ecc4f412d8..be63a7ec643 100644
--- a/src/mongo/db/catalog/namespace_uuid_cache.cpp
+++ b/src/mongo/db/catalog/namespace_uuid_cache.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/catalog/database.h"
#include "mongo/db/catalog/namespace_uuid_cache_gen.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index b45da700515..f93eaa1ceb6 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -60,7 +60,6 @@
#include "mongo/db/ops/insert.h"
#include "mongo/db/repl/isself.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index 6dabe4252c9..0623517666b 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -52,7 +52,6 @@
#include "mongo/db/curop.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/rpc/factory.h"
#include "mongo/rpc/metadata/client_metadata_ismaster.h"
#include "mongo/rpc/op_msg_rpc_impls.h"
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index d888a065294..0aee8741361 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -84,7 +84,6 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/storage_stats.h"
#include "mongo/db/storage/storage_engine_init.h"
#include "mongo/db/write_concern.h"
diff --git a/src/mongo/db/commands/dbcommands_d.cpp b/src/mongo/db/commands/dbcommands_d.cpp
index 37fb3b9f13d..0cbf9cb0cbe 100644
--- a/src/mongo/db/commands/dbcommands_d.cpp
+++ b/src/mongo/db/commands/dbcommands_d.cpp
@@ -85,7 +85,6 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/storage_stats.h"
#include "mongo/db/write_concern.h"
#include "mongo/s/stale_exception.h"
diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp
index 23776fac640..a8b9504978e 100644
--- a/src/mongo/db/commands/feature_compatibility_version.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version.cpp
@@ -46,7 +46,6 @@
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/sharding_state.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/db/wire_version.h"
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index b0bdcba8d65..03f8b605a6f 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -49,7 +49,6 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/s/collection_sharding_state.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/stats/server_read_concern_metrics.h"
diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp
index df205c914b0..75879251925 100644
--- a/src/mongo/db/commands/write_commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands/write_commands.cpp
@@ -48,7 +48,6 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/storage/duplicate_key_error_info.h"
#include "mongo/db/transaction_participant.h"
diff --git a/src/mongo/db/concurrency/d_concurrency.cpp b/src/mongo/db/concurrency/d_concurrency.cpp
index b7101b023bc..ec12f4846cf 100644
--- a/src/mongo/db/concurrency/d_concurrency.cpp
+++ b/src/mongo/db/concurrency/d_concurrency.cpp
@@ -38,7 +38,6 @@
#include "mongo/db/concurrency/global_lock_acquisition_tracker.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/mutex.h"
diff --git a/src/mongo/db/concurrency/write_conflict_exception.cpp b/src/mongo/db/concurrency/write_conflict_exception.cpp
index 61f5aa5512f..6f0e39d8585 100644
--- a/src/mongo/db/concurrency/write_conflict_exception.cpp
+++ b/src/mongo/db/concurrency/write_conflict_exception.cpp
@@ -30,7 +30,6 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kWrite
#include "mongo/db/concurrency/write_conflict_exception.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/log.h"
#include "mongo/util/log_and_backoff.h"
#include "mongo/util/stacktrace.h"
diff --git a/src/mongo/db/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp
index 44925ac026c..a577689f4dc 100644
--- a/src/mongo/db/cursor_manager.cpp
+++ b/src/mongo/db/cursor_manager.cpp
@@ -49,7 +49,6 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/query/plan_executor.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/platform/random.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/db/cursor_server_params.cpp b/src/mongo/db/cursor_server_params.cpp
index b6038539c6b..c59f7c1f3b7 100644
--- a/src/mongo/db/cursor_server_params.cpp
+++ b/src/mongo/db/cursor_server_params.cpp
@@ -32,7 +32,6 @@
#include "mongo/db/cursor_server_params.h"
#include "mongo/db/cursor_server_params_gen.h"
-#include "mongo/db/server_parameters.h"
namespace mongo {
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 33c961238f9..dee5b039ff3 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -120,7 +120,6 @@
#include "mongo/db/s/sharding_initialization_mongod.h"
#include "mongo/db/s/sharding_state_recovery.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/service_entry_point_mongod.h"
#include "mongo/db/session_killer.h"
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index 1cba6635cf0..baa855f8059 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -39,7 +39,6 @@
#include "mongo/db/db_raii_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/s/collection_sharding_state.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/transaction_participant.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/free_mon/free_mon_mongod.cpp b/src/mongo/db/free_mon/free_mon_mongod.cpp
index 0dda68695c8..b8988ad53ea 100644
--- a/src/mongo/db/free_mon/free_mon_mongod.cpp
+++ b/src/mongo/db/free_mon/free_mon_mongod.cpp
@@ -58,7 +58,6 @@
#include "mongo/db/ftdc/ftdc_server.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/executor/network_interface_factory.h"
#include "mongo/executor/thread_pool_task_executor.h"
diff --git a/src/mongo/db/ftdc/SConscript b/src/mongo/db/ftdc/SConscript
index 14743514166..f342e3b079a 100644
--- a/src/mongo/db/ftdc/SConscript
+++ b/src/mongo/db/ftdc/SConscript
@@ -52,7 +52,6 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/commands',
- '$BUILD_DIR/mongo/db/server_parameters',
'$BUILD_DIR/mongo/util/processinfo',
'ftdc'
] + platform_libs,
diff --git a/src/mongo/db/ftdc/ftdc_mongos.cpp b/src/mongo/db/ftdc/ftdc_mongos.cpp
index dd3981b7662..6e70f3013a8 100644
--- a/src/mongo/db/ftdc/ftdc_mongos.cpp
+++ b/src/mongo/db/ftdc/ftdc_mongos.cpp
@@ -36,7 +36,6 @@
#include "mongo/db/ftdc/controller.h"
#include "mongo/db/ftdc/ftdc_server.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/stdx/thread.h"
#include "mongo/util/log.h"
#include "mongo/util/synchronized_value.h"
diff --git a/src/mongo/db/ftdc/ftdc_server.cpp b/src/mongo/db/ftdc/ftdc_server.cpp
index e55370f12a8..142ef262751 100644
--- a/src/mongo/db/ftdc/ftdc_server.cpp
+++ b/src/mongo/db/ftdc/ftdc_server.cpp
@@ -44,7 +44,6 @@
#include "mongo/db/ftdc/ftdc_server_gen.h"
#include "mongo/db/ftdc/ftdc_system_stats.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/synchronized_value.h"
diff --git a/src/mongo/db/initialize_operation_session_info.cpp b/src/mongo/db/initialize_operation_session_info.cpp
index c483334e229..9be38b08946 100644
--- a/src/mongo/db/initialize_operation_session_info.cpp
+++ b/src/mongo/db/initialize_operation_session_info.cpp
@@ -35,7 +35,6 @@
#include "mongo/db/logical_session_cache.h"
#include "mongo/db/logical_session_id_helpers.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
namespace mongo {
diff --git a/src/mongo/db/initialize_server_global_state.cpp b/src/mongo/db/initialize_server_global_state.cpp
index 243101a38ab..1cfcc8af7b3 100644
--- a/src/mongo/db/initialize_server_global_state.cpp
+++ b/src/mongo/db/initialize_server_global_state.cpp
@@ -48,7 +48,6 @@
#include "mongo/base/init.h"
#include "mongo/config.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/logger/console_appender.h"
#include "mongo/logger/logger.h"
#include "mongo/logger/message_event.h"
diff --git a/src/mongo/db/keys_collection_manager.cpp b/src/mongo/db/keys_collection_manager.cpp
index 9e559e5d781..bc539af60a1 100644
--- a/src/mongo/db/keys_collection_manager.cpp
+++ b/src/mongo/db/keys_collection_manager.cpp
@@ -38,7 +38,6 @@
#include "mongo/db/logical_clock.h"
#include "mongo/db/logical_time.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/concurrency/idle_thread_block.h"
diff --git a/src/mongo/db/logical_clock.cpp b/src/mongo/db/logical_clock.cpp
index 8bf4a7e155c..fbd87f49421 100644
--- a/src/mongo/db/logical_clock.cpp
+++ b/src/mongo/db/logical_clock.cpp
@@ -37,7 +37,6 @@
#include "mongo/base/status.h"
#include "mongo/db/global_settings.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/time_proof_service.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/logical_session_cache_factory_mongos.cpp b/src/mongo/db/logical_session_cache_factory_mongos.cpp
index ba3cceb2216..d8e00da1871 100644
--- a/src/mongo/db/logical_session_cache_factory_mongos.cpp
+++ b/src/mongo/db/logical_session_cache_factory_mongos.cpp
@@ -34,7 +34,6 @@
#include "mongo/db/logical_session_cache_factory_mongos.h"
#include "mongo/db/logical_session_cache_impl.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_liaison_mongos.h"
#include "mongo/db/sessions_collection_sharded.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/db/logical_session_cache_impl.cpp b/src/mongo/db/logical_session_cache_impl.cpp
index 13af0ea1c19..a0ab45c083a 100644
--- a/src/mongo/db/logical_session_cache_impl.cpp
+++ b/src/mongo/db/logical_session_cache_impl.cpp
@@ -38,7 +38,6 @@
#include "mongo/db/logical_session_id_helpers.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/s/operation_sharding_state.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/platform/atomic_word.h"
#include "mongo/util/duration.h"
diff --git a/src/mongo/db/logical_session_id.cpp b/src/mongo/db/logical_session_id.cpp
index 61d571a5765..64e67b7a1a7 100644
--- a/src/mongo/db/logical_session_id.cpp
+++ b/src/mongo/db/logical_session_id.cpp
@@ -30,7 +30,6 @@
#include "mongo/platform/basic.h"
#include "mongo/db/logical_session_id.h"
-#include "mongo/db/server_parameters.h"
namespace mongo {
diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp
index 901d734ed96..fc6c4fc8581 100644
--- a/src/mongo/db/query/explain.cpp
+++ b/src/mongo/db/query/explain.cpp
@@ -52,7 +52,6 @@
#include "mongo/db/query/query_settings.h"
#include "mongo/db/query/stage_builder.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/hex.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/socket_utils.h"
diff --git a/src/mongo/db/query/expression_index.cpp b/src/mongo/db/query/expression_index.cpp
index 0e37c62567e..c6c784be231 100644
--- a/src/mongo/db/query/expression_index.cpp
+++ b/src/mongo/db/query/expression_index.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/hasher.h"
#include "mongo/db/index/expression_params.h"
#include "mongo/db/query/expression_index_knobs_gen.h"
-#include "mongo/db/server_parameters.h"
#include "third_party/s2/s2cellid.h"
#include "third_party/s2/s2region.h"
#include "third_party/s2/s2regioncoverer.h"
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 0f3add4eb20..a4e02a58f47 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -56,7 +56,6 @@
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/top.h"
#include "mongo/db/storage/storage_options.h"
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index 4da59c72cb8..0d913500a80 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -80,7 +80,6 @@
#include "mongo/db/s/collection_sharding_state.h"
#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/oplog_hack.h"
#include "mongo/db/storage/storage_options.h"
diff --git a/src/mongo/db/query/plan_ranker.cpp b/src/mongo/db/query/plan_ranker.cpp
index 78002c6006e..baf92677727 100644
--- a/src/mongo/db/query/plan_ranker.cpp
+++ b/src/mongo/db/query/plan_ranker.cpp
@@ -44,7 +44,6 @@
#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"
#include "mongo/util/log.h"
namespace {
diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp
index 0285181bffb..6f4793aa4bc 100644
--- a/src/mongo/db/repl/initial_syncer_test.cpp
+++ b/src/mongo/db/repl/initial_syncer_test.cpp
@@ -67,7 +67,6 @@
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/scopeguard.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/unittest/barrier.h"
#include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index ab1e459bf17..3813ab4a581 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -80,7 +80,6 @@
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/timestamp_block.h"
#include "mongo/db/repl/transaction_oplog_application.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/counters.h"
#include "mongo/db/stats/server_write_concern_metrics.h"
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 9885d9c9ebf..9148387bac6 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -74,7 +74,6 @@
#include "mongo/db/repl/update_position_args.h"
#include "mongo/db/repl/vote_requester.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/server_transactions_metrics.h"
#include "mongo/db/transaction_participant.h"
#include "mongo/db/write_concern.h"
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index bda88bab094..0b32d093332 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -53,7 +53,6 @@
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/storage_interface.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/db/wire_version.h"
#include "mongo/executor/network_interface.h"
diff --git a/src/mongo/db/repl/rollback_impl.cpp b/src/mongo/db/repl/rollback_impl.cpp
index c0d82d2c9f3..93d303acac1 100644
--- a/src/mongo/db/repl/rollback_impl.cpp
+++ b/src/mongo/db/repl/rollback_impl.cpp
@@ -54,7 +54,6 @@
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/s/shard_identity_rollback_notifier.h"
#include "mongo/db/s/type_shard_identity.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/server_recovery.h"
#include "mongo/db/server_transactions_metrics.h"
#include "mongo/db/session_catalog_mongod.h"
diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp
index 9b8bf00e987..f625be671bd 100644
--- a/src/mongo/db/repl/topology_coordinator.cpp
+++ b/src/mongo/db/repl/topology_coordinator.cpp
@@ -55,7 +55,6 @@
#include "mongo/db/repl/repl_set_heartbeat_response.h"
#include "mongo/db/repl/repl_set_request_votes_args.h"
#include "mongo/db/repl/rslog.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/rpc/metadata/oplog_query_metadata.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/s/sharding_state_recovery.cpp b/src/mongo/db/s/sharding_state_recovery.cpp
index 2e72294ce53..504db05d472 100644
--- a/src/mongo/db/s/sharding_state_recovery.cpp
+++ b/src/mongo/db/s/sharding_state_recovery.cpp
@@ -48,7 +48,6 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/s/sharding_logging.h"
#include "mongo/db/s/sharding_state.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/write_concern.h"
#include "mongo/db/write_concern_options.h"
#include "mongo/s/client/shard_registry.h"
diff --git a/src/mongo/db/s/transaction_coordinator_test_fixture.cpp b/src/mongo/db/s/transaction_coordinator_test_fixture.cpp
index d7384e906ae..e33da68ab2b 100644
--- a/src/mongo/db/s/transaction_coordinator_test_fixture.cpp
+++ b/src/mongo/db/s/transaction_coordinator_test_fixture.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/commands/txn_cmds_gen.h"
#include "mongo/db/commands/txn_two_phase_commit_cmds_gen.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/s/catalog/sharding_catalog_client_mock.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp
index 733599e81d6..eb962a21b8c 100644
--- a/src/mongo/db/server_options_helpers.cpp
+++ b/src/mongo/db/server_options_helpers.cpp
@@ -46,7 +46,6 @@
#include "mongo/bson/util/builder.h"
#include "mongo/config.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/logger/log_component.h"
#include "mongo/logger/message_event_utf8_encoder.h"
#include "mongo/transport/message_compressor_registry.h"
diff --git a/src/mongo/db/server_options_server_helpers.cpp b/src/mongo/db/server_options_server_helpers.cpp
index b2c79f01e69..02bfa0b981a 100644
--- a/src/mongo/db/server_options_server_helpers.cpp
+++ b/src/mongo/db/server_options_server_helpers.cpp
@@ -46,7 +46,6 @@
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_base.h"
#include "mongo/db/server_options_helpers.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/logger/log_component.h"
#include "mongo/logger/message_event_utf8_encoder.h"
#include "mongo/transport/message_compressor_registry.h"
diff --git a/src/mongo/db/server_parameters.cpp b/src/mongo/db/server_parameters.cpp
deleted file mode 100644
index 74eb9616d54..00000000000
--- a/src/mongo/db/server_parameters.cpp
+++ /dev/null
@@ -1,130 +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.
- */
-
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kControl
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/base/parse_number.h"
-#include "mongo/client/replica_set_monitor.h"
-#include "mongo/db/server_parameters.h"
-#include "mongo/util/log.h"
-
-namespace mongo {
-
-using std::string;
-using std::vector;
-
-namespace {
-ServerParameterSet* GLOBAL = NULL;
-}
-
-ServerParameter::ServerParameter(StringData name, ServerParameterType spt)
- : ServerParameter(ServerParameterSet::getGlobal(),
- name,
- spt != ServerParameterType::kRuntimeOnly,
- spt != ServerParameterType::kStartupOnly) {}
-
-ServerParameter::ServerParameter(ServerParameterSet* sps,
- StringData name,
- bool allowedToChangeAtStartup,
- bool allowedToChangeAtRuntime)
- : _name(name.toString()),
- _allowedToChangeAtStartup(allowedToChangeAtStartup),
- _allowedToChangeAtRuntime(allowedToChangeAtRuntime) {
- if (sps) {
- sps->add(this);
- }
-}
-
-ServerParameter::ServerParameter(ServerParameterSet* sps, StringData name)
- : _name(name.toString()), _allowedToChangeAtStartup(true), _allowedToChangeAtRuntime(true) {
- if (sps) {
- sps->add(this);
- }
-}
-
-ServerParameter::~ServerParameter() {}
-
-ServerParameterSet* ServerParameterSet::getGlobal() {
- if (!GLOBAL) {
- GLOBAL = new ServerParameterSet();
- }
- return GLOBAL;
-}
-
-void ServerParameterSet::add(ServerParameter* sp) {
- ServerParameter*& x = _map[sp->name()];
- if (x) {
- severe() << "'" << x->name() << "' already exists in the server parameter set.";
- abort();
- }
- x = sp;
-}
-
-namespace {
-class DisabledTestParameter : public ServerParameter {
-public:
- DisabledTestParameter() = delete;
-
- DisabledTestParameter(ServerParameter* sp)
- : ServerParameter(
- nullptr, sp->name(), sp->allowedToChangeAtStartup(), sp->allowedToChangeAtRuntime()),
- _sp(sp) {
- setTestOnly();
- }
-
- void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) final {}
-
- Status setFromString(const std::string&) final {
- return {ErrorCodes::BadValue,
- str::stream() << "setParameter: '" << name()
- << "' is only supported with 'enableTestCommands=true'"};
- }
-
- Status set(const BSONElement& newValueElement) final {
- return setFromString("");
- }
-
-private:
- // Retain the original pointer to avoid ASAN complaining.
- ServerParameter* _sp;
-};
-} // namespace
-
-void ServerParameterSet::disableTestParameters() {
- for (auto& spit : _map) {
- auto*& sp = spit.second;
- if (sp->isTestOnly()) {
- sp = new DisabledTestParameter(sp);
- }
- }
-}
-
-} // namespace mongo
diff --git a/src/mongo/db/server_parameters.h b/src/mongo/db/server_parameters.h
deleted file mode 100644
index f0115f6c417..00000000000
--- a/src/mongo/db/server_parameters.h
+++ /dev/null
@@ -1,454 +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 <map>
-#include <string>
-#include <vector>
-
-#include "mongo/base/checked_cast.h"
-#include "mongo/base/static_assert.h"
-#include "mongo/base/status.h"
-#include "mongo/db/jsobj.h"
-#include "mongo/platform/atomic_proxy.h"
-#include "mongo/platform/atomic_word.h"
-#include "mongo/platform/compiler.h"
-#include "mongo/stdx/functional.h"
-#include "mongo/stdx/mutex.h"
-#include "mongo/util/stringutils.h"
-
-namespace mongo {
-
-class ServerParameterSet;
-class OperationContext;
-
-/**
- * Server Parameters can be set startup up and/or runtime.
- *
- * At startup, --setParameter ... or config file is used.
- * At runtime, { setParameter : 1, ...} is used.
- */
-enum class ServerParameterType {
-
- /**
- * Parameter can only be set via runCommand.
- */
- kRuntimeOnly,
-
- /**
- * Parameter can only be set via --setParameter, and is only read at startup after command-line
- * parameters, and the config file are processed.
- */
- kStartupOnly,
-
- /**
- * Parameter can be set at both startup and runtime.
- */
- kStartupAndRuntime,
-};
-
-/**
- * Lets you make server level settings easily configurable.
- * Hooks into (set|get)Parameter, as well as command line processing
- *
- * NOTE: ServerParameters set at runtime can be read or written to at anytime, and are not
- * thread-safe without atomic types or other concurrency techniques.
- */
-class ServerParameter {
-public:
- typedef std::map<std::string, ServerParameter*> Map;
-
- ServerParameter(StringData name, ServerParameterType spt);
- ServerParameter(ServerParameterSet* sps,
- StringData name,
- bool allowedToChangeAtStartup,
- bool allowedToChangeAtRuntime);
- ServerParameter(ServerParameterSet* sps, StringData name);
- virtual ~ServerParameter();
-
- std::string name() const {
- return _name;
- }
-
- /**
- * @return if you can set on command line or config file
- */
- bool allowedToChangeAtStartup() const {
- return _allowedToChangeAtStartup;
- }
-
- /**
- * @param if you can use (get|set)Parameter
- */
- bool allowedToChangeAtRuntime() const {
- return _allowedToChangeAtRuntime;
- }
-
-
- virtual void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) = 0;
-
- virtual Status set(const BSONElement& newValueElement) = 0;
-
- virtual Status setFromString(const std::string& str) = 0;
-
- bool isTestOnly() const {
- return _testOnly;
- }
-
- void setTestOnly() {
- _testOnly = true;
- }
-
-private:
- std::string _name;
- bool _allowedToChangeAtStartup;
- bool _allowedToChangeAtRuntime;
- bool _testOnly = false;
-};
-
-class ServerParameterSet {
-public:
- typedef std::map<std::string, ServerParameter*> Map;
-
- void add(ServerParameter* sp);
-
- const Map& getMap() const {
- return _map;
- }
-
- static ServerParameterSet* getGlobal();
-
- void disableTestParameters();
-
- template <typename T = ServerParameter>
- T* get(StringData name) {
- const auto& it = _map.find(name.toString());
- uassert(ErrorCodes::NoSuchKey,
- str::stream() << "Unknown server parameter: " << name,
- it != _map.end());
- return checked_cast<T*>(it->second);
- }
-
-private:
- Map _map;
-};
-
-/**
- * Lets you make server level settings easily configurable.
- * Hooks into (set|get)Parameter, as well as command line processing
- */
-template <typename T>
-class BoundServerParameter : public ServerParameter {
-private:
- using setter = stdx::function<Status(const T&)>;
- using getter = stdx::function<T()>;
- using SPT = ServerParameterType;
-
-public:
- BoundServerParameter(const std::string& name,
- const setter set,
- const getter get,
- SPT paramType = SPT::kStartupOnly)
- : ServerParameter(name, paramType), _setter(set), _getter(get) {}
-
- BoundServerParameter(ServerParameterSet* sps,
- const std::string& name,
- const setter set,
- const getter get,
- SPT paramType = SPT::kStartupOnly)
- : ServerParameter(sps,
- name,
- paramType == SPT::kStartupOnly || paramType == SPT::kStartupAndRuntime,
- paramType == SPT::kRuntimeOnly || paramType == SPT::kStartupAndRuntime),
- _setter(set),
- _getter(get) {}
- ~BoundServerParameter() override = default;
-
- void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) override {
- b.append(name, _getter());
- }
-
- Status set(const BSONElement& newValueElement) override {
- T newValue;
-
- if (!newValueElement.coerce(&newValue)) {
- return Status(ErrorCodes::BadValue, "Can't coerce value");
- }
-
- return _setter(newValue);
- }
-
- Status setFromString(const std::string& str) override;
-
-private:
- const setter _setter;
- const getter _getter;
-};
-
-template <>
-inline Status BoundServerParameter<bool>::setFromString(const std::string& str) {
- if ((str == "1") || (str == "true")) {
- return _setter(true);
- }
- if ((str == "0") || (str == "false")) {
- return _setter(false);
- }
- return Status(ErrorCodes::BadValue, "Value is not a valid boolean");
-}
-
-template <>
-inline Status BoundServerParameter<std::string>::setFromString(const std::string& str) {
- return _setter(str);
-}
-
-template <>
-inline Status BoundServerParameter<std::vector<std::string>>::setFromString(
- const std::string& str) {
- std::vector<std::string> v;
- splitStringDelim(str, &v, ',');
- return _setter(v);
-}
-
-template <typename T>
-inline Status BoundServerParameter<T>::setFromString(const std::string& str) {
- T value;
- Status status = parseNumberFromString(str, &value);
- if (!status.isOK()) {
- return status;
- }
- return _setter(value);
-}
-
-template <typename T>
-class LockedServerParameter : public BoundServerParameter<T> {
-private:
- using SPT = ServerParameterType;
-
-public:
- LockedServerParameter(const std::string& name,
- const T& initval,
- SPT paramType = SPT::kStartupAndRuntime)
- : LockedServerParameter(ServerParameterSet::getGlobal(), name, initval, paramType) {}
-
- LockedServerParameter(ServerParameterSet* sps,
- const std::string& name,
- const T& initval,
- SPT paramType = SPT::kStartupAndRuntime)
- : BoundServerParameter<T>(sps,
- name,
- [this](const T& v) { return setLocked(v); },
- [this]() { return getLocked(); },
- paramType),
- _value(initval) {}
- ~LockedServerParameter() override = default;
-
- Status setLocked(const T& value) {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
- _value = value;
- return Status::OK();
- }
-
- T getLocked() const {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
- return _value;
- }
-
-private:
- mutable stdx::mutex _mutex;
- T _value;
-};
-
-namespace server_parameter_detail {
-
-template <typename T, typename...>
-struct IsOneOf : std::false_type {};
-
-template <typename T, typename U0, typename... Us>
-struct IsOneOf<T, U0, Us...>
- : std::conditional_t<std::is_same<T, U0>::value, std::true_type, IsOneOf<T, Us...>> {};
-
-/**
- * Type trait for ServerParameterType to identify which types are safe to use at runtime because
- * they have std::atomic or equivalent types.
- */
-template <typename T>
-struct IsSafeRuntimeType : IsOneOf<T, bool, int, long long, double> {};
-
-/**
- * Get the type of storage to use for a given tuple of <type, ServerParameterType>.
- *
- * By default, we want std::atomic or equivalent types because they are thread-safe.
- * If the parameter is a startup only type, then there are no concurrency concerns since
- * server parameters are processed on the main thread while it is single-threaded during startup.
- */
-template <typename T, ServerParameterType paramType>
-struct StorageTraits {
- /**
- * For kStartupOnly parameters, we can use the type T as storage directly.
- * Otherwise if T is double, use AtomicDouble. Otherwise use AtomicWord<T>.
- */
- using value_type = std::conditional_t<
- paramType == ServerParameterType::kStartupOnly,
- T,
- std::conditional_t<std::is_same<T, double>::value, AtomicDouble, AtomicWord<T>>>;
-
- static T get(value_type* v) {
- return _get(v);
- }
-
- static void set(value_type* v, const T& newValue) {
- _set(v, newValue);
- }
-
-private:
- static T _get(AtomicDouble* v) {
- return v->load();
- }
- template <typename U>
- static T _get(AtomicWord<U>* v) {
- return v->load();
- }
- template <typename U>
- static T _get(U* v) {
- return *v;
- }
-
- static void _set(AtomicDouble* v, const T& newValue) {
- v->store(newValue);
- }
- template <typename U>
- static void _set(AtomicWord<U>* v, const T& newValue) {
- v->store(newValue);
- }
- template <typename U>
- static void _set(U* v, const T& newValue) {
- *v = newValue;
- }
-};
-
-} // namespace server_parameter_detail
-
-/**
- * Implementation of BoundServerParameter for reading and writing a server parameter with a given
- * name and type into a specific C++ variable.
- *
- * NOTE: ServerParameters set at runtime can be read or written to at anytime, and are not
- * thread-safe without atomic types or other concurrency techniques.
- */
-template <typename T, ServerParameterType paramType>
-class ExportedServerParameter : public BoundServerParameter<T> {
-public:
- MONGO_STATIC_ASSERT_MSG(paramType == ServerParameterType::kStartupOnly ||
- server_parameter_detail::IsSafeRuntimeType<T>::value,
- "This type is not supported as a runtime server parameter.");
-
- using storage_traits = server_parameter_detail::StorageTraits<T, paramType>;
- using storage_type = typename storage_traits::value_type;
- using validator_function = stdx::function<Status(const T&)>;
-
- /**
- * Construct an ExportedServerParameter in parameter set "sps", named "name", whose storage
- * is at "value".
- *
- * If allowedToChangeAtStartup is true, the parameter may be set at the command line,
- * e.g. via the --setParameter switch. If allowedToChangeAtRuntime is true, the parameter
- * may be set at runtime, e.g. via the setParameter command.
- */
- ExportedServerParameter(ServerParameterSet* sps, const std::string& name, storage_type* value)
- : BoundServerParameter<T>(sps,
- name,
- [this](const T& v) { return set(v); },
- [this] { return storage_traits::get(_value); },
- paramType),
- _value(value) {}
-
- // Don't let the template method hide our inherited method
- using BoundServerParameter<T>::set;
-
- virtual Status set(const T& newValue) {
- auto const status = validate(newValue);
- if (!status.isOK()) {
- return status;
- }
- storage_traits::set(_value, newValue);
- return Status::OK();
- }
-
- ExportedServerParameter* withValidator(validator_function validator) {
- invariant(!_validator);
- _validator = std::move(validator);
- return this;
- }
-
-protected:
- /**
- * Note that if a subclass overrides the validate member function, the validator provided via
- * withValidate will not be used.
- **/
- virtual Status validate(const T& potentialNewValue) {
- if (_validator) {
- return _validator(potentialNewValue);
- }
- return Status::OK();
- }
-
- storage_type* const _value; // owned elsewhere
- validator_function _validator;
-};
-
-} // namespace mongo
-
-#define MONGO_EXPORT_SERVER_PARAMETER_IMPL_(NAME, TYPE, INITIAL_VALUE, PARAM_TYPE) \
- ExportedServerParameter<TYPE, PARAM_TYPE>::storage_type NAME(INITIAL_VALUE); \
- MONGO_COMPILER_VARIABLE_UNUSED auto _exportedParameter_##NAME = \
- (new ExportedServerParameter<TYPE, PARAM_TYPE>( \
- ServerParameterSet::getGlobal(), #NAME, &NAME))
-
-/**
- * Create a global variable of type "TYPE" named "NAME" with the given INITIAL_VALUE. The
- * value may be set at startup or at runtime.
- */
-#define MONGO_EXPORT_SERVER_PARAMETER(NAME, TYPE, INITIAL_VALUE) \
- MONGO_EXPORT_SERVER_PARAMETER_IMPL_( \
- NAME, TYPE, INITIAL_VALUE, ServerParameterType::kStartupAndRuntime)
-
-/**
- * Like MONGO_EXPORT_SERVER_PARAMETER, but the value may only be set at startup.
- */
-#define MONGO_EXPORT_STARTUP_SERVER_PARAMETER(NAME, TYPE, INITIAL_VALUE) \
- MONGO_EXPORT_SERVER_PARAMETER_IMPL_( \
- NAME, TYPE, INITIAL_VALUE, ServerParameterType::kStartupOnly)
-
-/**
- * Like MONGO_EXPORT_SERVER_PARAMETER, but the value may only be set at runtime.
- */
-#define MONGO_EXPORT_RUNTIME_SERVER_PARAMETER(NAME, TYPE, INITIAL_VALUE) \
- MONGO_EXPORT_SERVER_PARAMETER_IMPL_( \
- NAME, TYPE, INITIAL_VALUE, ServerParameterType::kRuntimeOnly)
diff --git a/src/mongo/db/server_parameters_test.cpp b/src/mongo/db/server_parameters_test.cpp
deleted file mode 100644
index 6a4a094889b..00000000000
--- a/src/mongo/db/server_parameters_test.cpp
+++ /dev/null
@@ -1,272 +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/platform/basic.h"
-
-#include "mongo/unittest/unittest.h"
-
-#include "mongo/db/operation_context_noop.h"
-#include "mongo/db/server_parameters.h"
-
-namespace mongo {
-
-namespace {
-auto const getStr = [](ServerParameter& sp) {
- BSONObjBuilder b;
- sp.append(nullptr, b, "x");
- return b.obj().firstElement().String();
-};
-auto const getInt = [](ServerParameter& sp) {
- BSONObjBuilder b;
- sp.append(nullptr, b, "x");
- return b.obj().firstElement().Int();
-};
-auto const getBool = [](ServerParameter& sp) {
- BSONObjBuilder b;
- sp.append(nullptr, b, "x");
- return b.obj().firstElement().Bool();
-};
-
-using std::string;
-using std::vector;
-
-TEST(ServerParameters, boundInt) {
- int ival = 123;
- BoundServerParameter<int> bspi("bspl",
- [&ival](const int& v) {
- ival = v;
- return Status::OK();
- },
- [&ival] { return ival; },
- ServerParameterType::kStartupOnly);
- ASSERT_EQUALS(123, getInt(bspi));
-
- const struct {
- std::string setval;
- int expval;
- bool succeed;
- } setl[] = {
- {"234", 234, true},
- {"5.5", -1, false},
- {"345", 345, true},
- {"flowers", -1, false},
- {" 456", -1, false},
- {" 567 ", -1, false},
- {"678 ", -1, false},
- {"789-0", -1, false},
- };
- for (auto const& p : setl) {
- ASSERT_EQ(bspi.setFromString(p.setval).isOK(), p.succeed);
- if (p.succeed) {
- ASSERT_EQUALS(p.expval, ival);
- ASSERT_EQUALS(p.expval, getInt(bspi));
- }
- }
-}
-
-TEST(ServerParameter, boundBool) {
- bool bval = true;
- BoundServerParameter<bool> bspb("bspb",
- [&bval](const bool& v) {
- bval = v;
- return Status::OK();
- },
- [&bval] { return bval; },
- ServerParameterType::kStartupOnly);
- ASSERT_TRUE(getBool(bspb));
-
- struct {
- std::string setval;
- bool expval;
- bool succeed;
- } setb[] = {
- {"1", true, true},
- {"0", false, true},
- {"true", true, true},
- {"false", false, true},
-
- {"yes", false, false},
- {"no", false, false},
- {"", false, false},
- {"-1", false, false},
- };
- for (auto const& p : setb) {
- ASSERT_EQ(bspb.setFromString(p.setval).isOK(), p.succeed);
- if (p.succeed) {
- ASSERT_EQUALS(p.expval, bval);
- ASSERT_EQUALS(p.expval, getBool(bspb));
- }
- }
-}
-
-TEST(ServerParameters, boundStringExplicitLock) {
- stdx::mutex mut;
- std::string value("initial");
- BoundServerParameter<std::string> bspsel("bsp",
- [&value, &mut](const std::string& v) {
- stdx::unique_lock<stdx::mutex> lk(mut);
- value = v;
- return Status::OK();
- },
- [&value, &mut] {
- stdx::unique_lock<stdx::mutex> lk(mut);
- return value;
- });
-
- ASSERT_EQUALS("initial", getStr(bspsel));
-
- const std::string sets[] = {"first-set", "second-set", "third-set"};
- for (auto const& p : sets) {
- ASSERT_TRUE(bspsel.set(BSON("x" << p).firstElement()).isOK());
- ASSERT_EQUALS(p, getStr(bspsel));
- }
-}
-
-TEST(ServerParameters, boundIntLock) {
- LockedServerParameter<int> bspi("lsp", 1234);
- ASSERT_EQUALS(1234, getInt(bspi));
- ASSERT_EQUALS(1234, bspi.getLocked());
-
- std::ostringstream maxint;
- maxint << std::numeric_limits<int>::max();
- std::ostringstream lowint;
- lowint << (std::numeric_limits<int>::lowest() + 1);
-
- std::ostringstream toobig;
- toobig << std::numeric_limits<int>::max() << "0";
- std::ostringstream toosmall;
- toosmall << std::numeric_limits<int>::lowest() << "0";
-
- const struct {
- std::string setstr;
- int setint;
- bool succeed;
- } sets[] = {
- {"5678", 5678, true},
- {"67", 67, true},
- {maxint.str(), std::numeric_limits<int>::max(), true},
- {lowint.str(), std::numeric_limits<int>::lowest() + 1, true},
- {toobig.str(), -1, false},
- {toosmall.str(), -1, false},
- {"flowers", -1, false},
- {"123.456", -1, false},
- {"123-456", -1, false},
- {" 123", -1, false},
- {" 123 ", -1, false},
- {"123 ", -1, false},
- };
- for (auto const& p : sets) {
- ASSERT_EQ(bspi.setFromString(p.setstr).isOK(), p.succeed);
- if (p.succeed) {
- ASSERT_EQUALS(p.setint, getInt(bspi));
- ASSERT_EQUALS(p.setint, bspi.getLocked());
- }
- }
-
- const int seti[] = {
- -1, 0, 1, std::numeric_limits<int>::lowest() + 1, std::numeric_limits<int>::max()};
- for (auto const& p : seti) {
- ASSERT_TRUE(bspi.setLocked(p).isOK());
- ASSERT_EQUALS(p, getInt(bspi));
- ASSERT_EQUALS(p, bspi.getLocked());
- }
-}
-
-TEST(ServerParameters, Simple1) {
- AtomicWord<int> f(5);
- ExportedServerParameter<int, ServerParameterType::kStartupAndRuntime> ff(NULL, "ff", &f);
- ASSERT_EQUALS("ff", ff.name());
-
- ASSERT_TRUE(ff.set(6).isOK());
- ASSERT_EQUALS(6, f.load());
-
- ASSERT_TRUE(ff.set(BSON("x" << 7).firstElement()).isOK());
- ASSERT_EQUALS(7, f.load());
-
- ASSERT_TRUE(ff.setFromString("8").isOK());
- ASSERT_EQUALS(8, f.load());
-}
-
-TEST(ServerParameters, Vector1) {
- vector<string> v;
-
- ExportedServerParameter<vector<string>, ServerParameterType::kStartupOnly> vv(NULL, "vv", &v);
-
- BSONObj x = BSON("x" << BSON_ARRAY("a"
- << "b"
- << "c"));
- ASSERT_TRUE(vv.set(x.firstElement()).isOK());
-
- ASSERT_EQUALS(3U, v.size());
- ASSERT_EQUALS("a", v[0]);
- ASSERT_EQUALS("b", v[1]);
- ASSERT_EQUALS("c", v[2]);
-
- BSONObjBuilder b;
-
- OperationContextNoop opCtx;
- vv.append(&opCtx, b, vv.name());
-
- BSONObj y = b.obj();
- ASSERT(x.firstElement().woCompare(y.firstElement(), false) == 0);
-
-
- ASSERT_TRUE(vv.setFromString("d,e").isOK());
- ASSERT_EQUALS(2U, v.size());
- ASSERT_EQUALS("d", v[0]);
- ASSERT_EQUALS("e", v[1]);
-}
-
-TEST(ServerParameters, Validators) {
- AtomicWord<int> myVal(0);
- ExportedServerParameter<int, ServerParameterType::kRuntimeOnly> myParam(
- nullptr, "myVal", &myVal);
- myParam.withValidator([](const int& newVal) {
- if (newVal < 0) {
- return Status(ErrorCodes::BadValue, "Must be positive");
- }
- return Status::OK();
- });
-
- ASSERT_OK(myParam.set(10));
- ASSERT_EQUALS(10, myVal.load());
- ASSERT_EQUALS(ErrorCodes::BadValue, myParam.set(-1));
- ASSERT_EQUALS(10, myVal.load());
-}
-
-MONGO_EXPORT_SERVER_PARAMETER(oddTestParameter, int, 123)
- ->withValidator([](const int& newVal) {
- if ((newVal & 1) == 0) {
- return Status(ErrorCodes::BadValue, "must be odd");
- }
- return Status::OK();
- });
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/db/snapshot_window_options.cpp b/src/mongo/db/snapshot_window_options.cpp
index 3f78d832704..62f4011d08e 100644
--- a/src/mongo/db/snapshot_window_options.cpp
+++ b/src/mongo/db/snapshot_window_options.cpp
@@ -31,7 +31,6 @@
#include "mongo/db/snapshot_window_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/compiler.h"
#include "mongo/util/options_parser/startup_option_init.h"
diff --git a/src/mongo/db/stats/server_write_concern_metrics.cpp b/src/mongo/db/stats/server_write_concern_metrics.cpp
index 8f7cda65398..d5bdbb02bd4 100644
--- a/src/mongo/db/stats/server_write_concern_metrics.cpp
+++ b/src/mongo/db/stats/server_write_concern_metrics.cpp
@@ -34,7 +34,6 @@
#include "mongo/db/commands/server_status.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/stats/server_write_concern_metrics_gen.h"
diff --git a/src/mongo/db/storage/storage_options.cpp b/src/mongo/db/storage/storage_options.cpp
index 66fcc48e229..12d142ad2f2 100644
--- a/src/mongo/db/storage/storage_options.cpp
+++ b/src/mongo/db/storage/storage_options.cpp
@@ -31,7 +31,6 @@
#include "mongo/db/storage/storage_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/compiler.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
index 0320f1ad435..fb33870e114 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/global_settings.h"
#include "mongo/db/repl/repl_settings.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/storage/journal_listener.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_parameters_gen.h"
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
index 4b768ea9c33..d64f654f8e4 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
@@ -38,7 +38,6 @@
#include "mongo/base/simple_string_data_comparator.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/snapshot_window_options.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h"
diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp
index 2b3bb949970..0fcae49bafb 100644
--- a/src/mongo/db/transaction_participant.cpp
+++ b/src/mongo/db/transaction_participant.cpp
@@ -52,7 +52,6 @@
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/retryable_writes_stats.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/server_recovery.h"
#include "mongo/db/server_transactions_metrics.h"
#include "mongo/db/session.h"
diff --git a/src/mongo/db/transaction_reaper.cpp b/src/mongo/db/transaction_reaper.cpp
index bc5277f69f7..7876bb35c24 100644
--- a/src/mongo/db/transaction_reaper.cpp
+++ b/src/mongo/db/transaction_reaper.cpp
@@ -39,7 +39,6 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/ops/write_ops.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/session_txn_record_gen.h"
#include "mongo/db/sessions_collection.h"
#include "mongo/db/transaction_reaper_gen.h"
diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp
index ddbbba429f5..931e0617082 100644
--- a/src/mongo/db/ttl.cpp
+++ b/src/mongo/db/ttl.cpp
@@ -52,7 +52,6 @@
#include "mongo/db/ops/insert.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/ttl_collection_cache.h"
#include "mongo/db/ttl_gen.h"
#include "mongo/util/background.h"
diff --git a/src/mongo/db/views/SConscript b/src/mongo/db/views/SConscript
index 315fd179c1d..2636109617b 100644
--- a/src/mongo/db/views/SConscript
+++ b/src/mongo/db/views/SConscript
@@ -25,7 +25,6 @@ env.Library(
LIBDEPS=[
'resolved_view',
'$BUILD_DIR/mongo/base',
- '$BUILD_DIR/mongo/db/server_parameters',
'$BUILD_DIR/mongo/db/pipeline/aggregation',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
'$BUILD_DIR/mongo/db/query/collation/collator_factory_interface',
diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp
index dd9d2776d34..55b23bc09ef 100644
--- a/src/mongo/db/views/view_catalog.cpp
+++ b/src/mongo/db/views/view_catalog.cpp
@@ -49,7 +49,6 @@
#include "mongo/db/pipeline/pipeline.h"
#include "mongo/db/pipeline/stub_mongo_process_interface.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/storage/recovery_unit.h"
#include "mongo/db/views/resolved_view.h"
#include "mongo/db/views/view.h"
diff --git a/src/mongo/executor/network_interface_factory.cpp b/src/mongo/executor/network_interface_factory.cpp
index 420b93df94f..31482720c9f 100644
--- a/src/mongo/executor/network_interface_factory.cpp
+++ b/src/mongo/executor/network_interface_factory.cpp
@@ -34,7 +34,6 @@
#include "mongo/base/init.h"
#include "mongo/base/status.h"
#include "mongo/config.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/executor/connection_pool.h"
#include "mongo/executor/network_connection_hook.h"
#include "mongo/executor/network_interface_tl.h"
diff --git a/src/mongo/executor/task_executor_pool.cpp b/src/mongo/executor/task_executor_pool.cpp
index 759c25d39fd..e77e5eb665a 100644
--- a/src/mongo/executor/task_executor_pool.cpp
+++ b/src/mongo/executor/task_executor_pool.cpp
@@ -33,7 +33,6 @@
#include <algorithm>
-#include "mongo/db/server_parameters.h"
#include "mongo/executor/connection_pool_stats.h"
#include "mongo/executor/task_executor.h"
#include "mongo/executor/task_executor_pool_parameters_gen.h"
diff --git a/src/mongo/idl/SConscript b/src/mongo/idl/SConscript
index f320ffdff3c..0ce5bf975dc 100644
--- a/src/mongo/idl/SConscript
+++ b/src/mongo/idl/SConscript
@@ -36,7 +36,6 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
- '$BUILD_DIR/mongo/db/server_parameters',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/util/options_parser/options_parser',
diff --git a/src/mongo/idl/server_parameter.cpp b/src/mongo/idl/server_parameter.cpp
index c2e4255bed1..76c64725a64 100644
--- a/src/mongo/idl/server_parameter.cpp
+++ b/src/mongo/idl/server_parameter.cpp
@@ -43,6 +43,51 @@ MONGO_INITIALIZER_GROUP(EndServerParameterRegistration,
("BeginServerParameterRegistration"),
("BeginStartupOptionHandling"))
+ServerParameter::ServerParameter(StringData name, ServerParameterType spt)
+ : ServerParameter(ServerParameterSet::getGlobal(),
+ name,
+ spt != SPT::kRuntimeOnly,
+ spt != SPT::kStartupOnly) {}
+
+ServerParameter::ServerParameter(ServerParameterSet* sps,
+ StringData name,
+ bool allowedToChangeAtStartup,
+ bool allowedToChangeAtRuntime)
+ : _name(name.toString()),
+ _allowedToChangeAtStartup(allowedToChangeAtStartup),
+ _allowedToChangeAtRuntime(allowedToChangeAtRuntime) {
+ if (sps) {
+ sps->add(this);
+ }
+}
+
+ServerParameter::ServerParameter(ServerParameterSet* sps, StringData name)
+ : _name(name.toString()), _allowedToChangeAtStartup(true), _allowedToChangeAtRuntime(true) {
+ if (sps) {
+ sps->add(this);
+ }
+}
+
+namespace {
+ServerParameterSet* gGlobalServerParameterSet = nullptr;
+} // namespace
+
+ServerParameterSet* ServerParameterSet::getGlobal() {
+ if (!gGlobalServerParameterSet) {
+ gGlobalServerParameterSet = new ServerParameterSet();
+ }
+ return gGlobalServerParameterSet;
+}
+
+void ServerParameterSet::add(ServerParameter* sp) {
+ ServerParameter*& x = _map[sp->name()];
+ if (x) {
+ severe() << "'" << x->name() << "' already exists in the server parameter set.";
+ abort();
+ }
+ x = sp;
+}
+
IDLServerParameterDeprecatedAlias::IDLServerParameterDeprecatedAlias(StringData name,
ServerParameter* sp)
: ServerParameter(ServerParameterSet::getGlobal(),
@@ -75,4 +120,43 @@ Status IDLServerParameterDeprecatedAlias::setFromString(const std::string& str)
return _sp->setFromString(str);
}
+namespace {
+class DisabledTestParameter : public ServerParameter {
+public:
+ DisabledTestParameter() = delete;
+
+ DisabledTestParameter(ServerParameter* sp)
+ : ServerParameter(
+ nullptr, sp->name(), sp->allowedToChangeAtStartup(), sp->allowedToChangeAtRuntime()),
+ _sp(sp) {
+ setTestOnly();
+ }
+
+ void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) final {}
+
+ Status setFromString(const std::string&) final {
+ return {ErrorCodes::BadValue,
+ str::stream() << "setParameter: '" << name()
+ << "' is only supported with 'enableTestCommands=true'"};
+ }
+
+ Status set(const BSONElement& newValueElement) final {
+ return setFromString("");
+ }
+
+private:
+ // Retain the original pointer to avoid ASAN complaining.
+ ServerParameter* _sp;
+};
+} // namespace
+
+void ServerParameterSet::disableTestParameters() {
+ for (auto& spit : _map) {
+ auto*& sp = spit.second;
+ if (sp->isTestOnly()) {
+ sp = new DisabledTestParameter(sp);
+ }
+ }
+}
+
} // namespace mongo
diff --git a/src/mongo/idl/server_parameter.h b/src/mongo/idl/server_parameter.h
index 794bde5761e..7325e4ee5a1 100644
--- a/src/mongo/idl/server_parameter.h
+++ b/src/mongo/idl/server_parameter.h
@@ -35,14 +35,13 @@
* rather parameters should be defined in .idl files.
*/
-#include <functional>
#include <string>
+#include "mongo/base/checked_cast.h"
#include "mongo/base/init.h"
#include "mongo/base/status.h"
#include "mongo/bson/bsonelement.h"
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/server_parameters.h"
#define MONGO_SERVER_PARAMETER_REGISTER(name) \
MONGO_INITIALIZER_GENERAL( \
@@ -51,6 +50,113 @@
namespace mongo {
/**
+ * Server Parameters can be set startup up and/or runtime.
+ *
+ * At startup, --setParameter ... or config file is used.
+ * At runtime, { setParameter : 1, ...} is used.
+ */
+enum class ServerParameterType {
+
+ /**
+ * Parameter can only be set via runCommand.
+ */
+ kRuntimeOnly,
+
+ /**
+ * Parameter can only be set via --setParameter, and is only read at startup after command-line
+ * parameters, and the config file are processed.
+ */
+ kStartupOnly,
+
+ /**
+ * Parameter can be set at both startup and runtime.
+ */
+ kStartupAndRuntime,
+};
+
+class ServerParameterSet;
+class OperationContext;
+
+class ServerParameter {
+public:
+ using Map = std::map<std::string, ServerParameter*>;
+
+ ServerParameter(StringData name, ServerParameterType spt);
+ ServerParameter(ServerParameterSet* sps,
+ StringData name,
+ bool allowedToChangeAtStartup,
+ bool allowedToChangeAtRuntime);
+ ServerParameter(ServerParameterSet* sps, StringData name);
+ virtual ~ServerParameter() = default;
+
+ std::string name() const {
+ return _name;
+ }
+
+ /**
+ * @return if you can set on command line or config file
+ */
+ bool allowedToChangeAtStartup() const {
+ return _allowedToChangeAtStartup;
+ }
+
+ /**
+ * @param if you can use (get|set)Parameter
+ */
+ bool allowedToChangeAtRuntime() const {
+ return _allowedToChangeAtRuntime;
+ }
+
+
+ virtual void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) = 0;
+
+ virtual Status set(const BSONElement& newValueElement) = 0;
+
+ virtual Status setFromString(const std::string& str) = 0;
+
+ bool isTestOnly() const {
+ return _testOnly;
+ }
+
+ void setTestOnly() {
+ _testOnly = true;
+ }
+
+private:
+ std::string _name;
+ bool _allowedToChangeAtStartup;
+ bool _allowedToChangeAtRuntime;
+ bool _testOnly = false;
+};
+
+class ServerParameterSet {
+public:
+ using Map = ServerParameter::Map;
+
+ void add(ServerParameter* sp);
+
+ const Map& getMap() const {
+ return _map;
+ }
+
+ static ServerParameterSet* getGlobal();
+
+ void disableTestParameters();
+
+ template <typename T = ServerParameter>
+ T* get(StringData name) {
+ const auto& it = _map.find(name.toString());
+ uassert(ErrorCodes::NoSuchKey,
+ str::stream() << "Unknown server parameter: " << name,
+ it != _map.end());
+ return checked_cast<T*>(it->second);
+ }
+
+private:
+ Map _map;
+};
+
+/**
* Proxy instance for deprecated aliases of set parameters.
*/
class IDLServerParameterDeprecatedAlias : public ServerParameter {
diff --git a/src/mongo/idl/server_parameter_with_storage.h b/src/mongo/idl/server_parameter_with_storage.h
index 16fa7d82789..81b1517135e 100644
--- a/src/mongo/idl/server_parameter_with_storage.h
+++ b/src/mongo/idl/server_parameter_with_storage.h
@@ -42,7 +42,10 @@
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonelement.h"
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/server_parameters.h"
+#include "mongo/idl/server_parameter.h"
+#include "mongo/platform/atomic_proxy.h"
+#include "mongo/platform/atomic_word.h"
+#include "mongo/util/stringutils.h"
#include "mongo/util/synchronized_value.h"
namespace mongo {
diff --git a/src/mongo/s/async_requests_sender.cpp b/src/mongo/s/async_requests_sender.cpp
index b574606b4ae..03cb8ad6d54 100644
--- a/src/mongo/s/async_requests_sender.cpp
+++ b/src/mongo/s/async_requests_sender.cpp
@@ -34,7 +34,6 @@
#include "mongo/s/async_requests_sender.h"
#include "mongo/client/remote_command_targeter.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/executor/remote_command_request.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/s/client/shard_registry.h"
diff --git a/src/mongo/s/client/shard_remote.cpp b/src/mongo/s/client/shard_remote.cpp
index 88647aa706f..3a16f44752f 100644
--- a/src/mongo/s/client/shard_remote.cpp
+++ b/src/mongo/s/client/shard_remote.cpp
@@ -47,7 +47,6 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/query/query_request.h"
#include "mongo/db/repl/read_concern_args.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
diff --git a/src/mongo/s/commands/cluster_is_master_cmd.cpp b/src/mongo/s/commands/cluster_is_master_cmd.cpp
index cbf979a4092..f345ea41297 100644
--- a/src/mongo/s/commands/cluster_is_master_cmd.cpp
+++ b/src/mongo/s/commands/cluster_is_master_cmd.cpp
@@ -35,7 +35,6 @@
#include "mongo/db/logical_session_id.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/ops/write_ops.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/wire_version.h"
#include "mongo/rpc/metadata/client_metadata.h"
#include "mongo/rpc/metadata/client_metadata_ismaster.h"
diff --git a/src/mongo/s/commands/kill_sessions_remote.cpp b/src/mongo/s/commands/kill_sessions_remote.cpp
index c522630a70e..57f1d015ce6 100644
--- a/src/mongo/s/commands/kill_sessions_remote.cpp
+++ b/src/mongo/s/commands/kill_sessions_remote.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/client.h"
#include "mongo/db/kill_sessions_common.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/executor/async_multicaster.h"
#include "mongo/executor/task_executor_pool.h"
diff --git a/src/mongo/s/query/cluster_cursor_cleanup_job.cpp b/src/mongo/s/query/cluster_cursor_cleanup_job.cpp
index 20ccc78b1f8..ad88d2e9b89 100644
--- a/src/mongo/s/query/cluster_cursor_cleanup_job.cpp
+++ b/src/mongo/s/query/cluster_cursor_cleanup_job.cpp
@@ -33,7 +33,6 @@
#include "mongo/db/client.h"
#include "mongo/db/cursor_server_params.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
#include "mongo/util/concurrency/idle_thread_block.h"
diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp
index e0d6dc2896f..ed2ab869604 100644
--- a/src/mongo/s/sharding_initialization.cpp
+++ b/src/mongo/s/sharding_initialization.cpp
@@ -42,7 +42,6 @@
#include "mongo/db/logical_clock.h"
#include "mongo/db/logical_time_validator.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/time_proof_service.h"
#include "mongo/executor/connection_pool.h"
diff --git a/src/mongo/scripting/deadline_monitor.cpp b/src/mongo/scripting/deadline_monitor.cpp
index e0fd43d3a9f..964ae42ebfc 100644
--- a/src/mongo/scripting/deadline_monitor.cpp
+++ b/src/mongo/scripting/deadline_monitor.cpp
@@ -32,7 +32,6 @@
#include "mongo/scripting/deadline_monitor.h"
#include "mongo/scripting/deadline_monitor_gen.h"
-#include "mongo/db/server_parameters.h"
namespace mongo {
diff --git a/src/mongo/scripting/mozjs/engine.cpp b/src/mongo/scripting/mozjs/engine.cpp
index c2010b4cf37..1cb2e6ca3c3 100644
--- a/src/mongo/scripting/mozjs/engine.cpp
+++ b/src/mongo/scripting/mozjs/engine.cpp
@@ -36,7 +36,6 @@
#include <js/Initialization.h>
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/scripting/mozjs/engine_gen.h"
#include "mongo/scripting/mozjs/implscope.h"
#include "mongo/scripting/mozjs/proxyscope.h"
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp
index deec06f424d..12e695da6a8 100644
--- a/src/mongo/scripting/mozjs/implscope.cpp
+++ b/src/mongo/scripting/mozjs/implscope.cpp
@@ -39,7 +39,6 @@
#include "mongo/base/error_codes.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/decimal128.h"
#include "mongo/platform/stack_locator.h"
#include "mongo/scripting/jsexception.h"
diff --git a/src/mongo/shell/shell_options.cpp b/src/mongo/shell/shell_options.cpp
index 4f65f4270fc..61820b12325 100644
--- a/src/mongo/shell/shell_options.cpp
+++ b/src/mongo/shell/shell_options.cpp
@@ -43,7 +43,6 @@
#include "mongo/config.h"
#include "mongo/db/auth/sasl_command_constants.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/rpc/protocol.h"
#include "mongo/shell/shell_utils.h"
#include "mongo/transport/message_compressor_registry.h"
diff --git a/src/mongo/transport/service_executor_adaptive.cpp b/src/mongo/transport/service_executor_adaptive.cpp
index 94d834d14ee..19c1df24d90 100644
--- a/src/mongo/transport/service_executor_adaptive.cpp
+++ b/src/mongo/transport/service_executor_adaptive.cpp
@@ -36,7 +36,6 @@
#include <array>
#include <random>
-#include "mongo/db/server_parameters.h"
#include "mongo/transport/service_entry_point_utils.h"
#include "mongo/transport/service_executor_gen.h"
#include "mongo/transport/service_executor_task_names.h"
diff --git a/src/mongo/transport/service_executor_reserved.cpp b/src/mongo/transport/service_executor_reserved.cpp
index 142c40e31c4..24820ab1d91 100644
--- a/src/mongo/transport/service_executor_reserved.cpp
+++ b/src/mongo/transport/service_executor_reserved.cpp
@@ -33,7 +33,6 @@
#include "mongo/transport/service_executor_reserved.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/stdx/thread.h"
#include "mongo/transport/service_entry_point_utils.h"
#include "mongo/transport/service_executor_gen.h"
diff --git a/src/mongo/transport/service_executor_synchronous.cpp b/src/mongo/transport/service_executor_synchronous.cpp
index c5b63daa71f..4191899e763 100644
--- a/src/mongo/transport/service_executor_synchronous.cpp
+++ b/src/mongo/transport/service_executor_synchronous.cpp
@@ -33,7 +33,6 @@
#include "mongo/transport/service_executor_synchronous.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/stdx/thread.h"
#include "mongo/transport/service_entry_point_utils.h"
#include "mongo/transport/service_executor_gen.h"
diff --git a/src/mongo/util/SConscript b/src/mongo/util/SConscript
index a5674b3eb18..4b9f6f3254e 100644
--- a/src/mongo/util/SConscript
+++ b/src/mongo/util/SConscript
@@ -404,7 +404,6 @@ if env['MONGO_ALLOCATOR'] == 'tcmalloc':
'heap_profiler.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/server_parameters',
'$BUILD_DIR/mongo/transport/service_executor',
],
LIBDEPS_PRIVATE=[
diff --git a/src/mongo/util/heap_profiler.cpp b/src/mongo/util/heap_profiler.cpp
index 449a2f71f37..be7910856a2 100644
--- a/src/mongo/util/heap_profiler.cpp
+++ b/src/mongo/util/heap_profiler.cpp
@@ -35,7 +35,6 @@
#include "mongo/base/static_assert.h"
#include "mongo/config.h"
#include "mongo/db/commands/server_status.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/log.h"
#include "mongo/util/stacktrace.h"
#include "mongo/util/tcmalloc_parameters_gen.h"
diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp
index b93ebe84a4a..85fc0ccd36b 100644
--- a/src/mongo/util/net/ssl_manager.cpp
+++ b/src/mongo/util/net/ssl_manager.cpp
@@ -42,7 +42,6 @@
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/config.h"
#include "mongo/db/commands/server_status.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/overflow_arithmetic.h"
#include "mongo/transport/session.h"
#include "mongo/util/hex.h"
diff --git a/src/mongo/util/net/ssl_manager_openssl.cpp b/src/mongo/util/net/ssl_manager_openssl.cpp
index 4e10e61265d..09336136a47 100644
--- a/src/mongo/util/net/ssl_manager_openssl.cpp
+++ b/src/mongo/util/net/ssl_manager_openssl.cpp
@@ -47,7 +47,6 @@
#include "mongo/base/secure_allocator.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/config.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/atomic_word.h"
#include "mongo/stdx/memory.h"
#include "mongo/transport/session.h"
diff --git a/src/mongo/util/net/ssl_manager_windows.cpp b/src/mongo/util/net/ssl_manager_windows.cpp
index 5a3aa50d545..b6914461c05 100644
--- a/src/mongo/util/net/ssl_manager_windows.cpp
+++ b/src/mongo/util/net/ssl_manager_windows.cpp
@@ -46,7 +46,6 @@
#include "mongo/bson/util/builder.h"
#include "mongo/config.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/platform/atomic_word.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/concurrency/mutex.h"
diff --git a/src/mongo/util/tcmalloc_server_status_section.cpp b/src/mongo/util/tcmalloc_server_status_section.cpp
index 2ec7d897b33..1066183755a 100644
--- a/src/mongo/util/tcmalloc_server_status_section.cpp
+++ b/src/mongo/util/tcmalloc_server_status_section.cpp
@@ -40,7 +40,6 @@
#include "mongo/base/init.h"
#include "mongo/db/commands/server_status.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/transport/service_entry_point.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/util/tcmalloc_set_parameter.cpp b/src/mongo/util/tcmalloc_set_parameter.cpp
index f650d9b7e07..07eb2ba7ef0 100644
--- a/src/mongo/util/tcmalloc_set_parameter.cpp
+++ b/src/mongo/util/tcmalloc_set_parameter.cpp
@@ -43,7 +43,6 @@
#include "mongo/base/status.h"
#include "mongo/base/status_with.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/processinfo.h"
#include "mongo/util/tcmalloc_parameters_gen.h"