diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2019-02-21 13:54:32 -0500 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2019-02-25 10:49:55 -0500 |
commit | d53ffb71121f8b09c09768e85420d6836247bf47 (patch) | |
tree | 79dfeaf7fa972a5c2c7abbe1f7bea33ad9c6300b /src/mongo/db | |
parent | ca012419d8204bc1b09e093154cb4125a4a79f10 (diff) | |
download | mongo-d53ffb71121f8b09c09768e85420d6836247bf47.tar.gz |
SERVER-39635 SERVER-39636 SERVER-39637 SERVER-39640 IDL'ify server parameters in sharding_runtime_d_params.
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/s/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/db/s/collection_range_deleter.cpp | 18 | ||||
-rw-r--r-- | src/mongo/db/s/collection_sharding_runtime.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/s/migration_destination_manager.cpp | 27 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_runtime_d_params.idl | 92 |
5 files changed, 97 insertions, 49 deletions
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript index f9f93444cd4..0644f90e1ce 100644 --- a/src/mongo/db/s/SConscript +++ b/src/mongo/db/s/SConscript @@ -66,6 +66,7 @@ env.Library( 'sharding_statistics.cpp', 'split_chunk.cpp', 'split_vector.cpp', + env.Idlc('sharding_runtime_d_params.idl')[0], ], LIBDEPS=[ '$BUILD_DIR/mongo/db/catalog/multi_index_block', @@ -89,6 +90,7 @@ env.Library( ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/db/session_catalog', + '$BUILD_DIR/mongo/idl/server_parameter', ], ) diff --git a/src/mongo/db/s/collection_range_deleter.cpp b/src/mongo/db/s/collection_range_deleter.cpp index 50be3f9a395..06b73a37e8b 100644 --- a/src/mongo/db/s/collection_range_deleter.cpp +++ b/src/mongo/db/s/collection_range_deleter.cpp @@ -52,9 +52,9 @@ #include "mongo/db/query/query_planner.h" #include "mongo/db/repl/repl_client_info.h" #include "mongo/db/s/collection_sharding_runtime.h" +#include "mongo/db/s/sharding_runtime_d_params_gen.h" #include "mongo/db/s/sharding_state.h" #include "mongo/db/s/sharding_statistics.h" -#include "mongo/db/server_parameters.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/remove_saver.h" #include "mongo/db/write_concern.h" @@ -65,22 +65,6 @@ namespace mongo { -MONGO_EXPORT_SERVER_PARAMETER(rangeDeleterBatchSize, int, 0) - ->withValidator([](const int& newVal) { - if (newVal < 0) { - return Status(ErrorCodes::BadValue, "rangeDeleterBatchSize must not be negative"); - } - return Status::OK(); - }); - -MONGO_EXPORT_SERVER_PARAMETER(rangeDeleterBatchDelayMS, int, 20) - ->withValidator([](const int& newVal) { - if (newVal < 0) { - return Status(ErrorCodes::BadValue, "rangeDeleterBatchDelayMS must not be negative"); - } - return Status::OK(); - }); - namespace { using Deletion = CollectionRangeDeleter::Deletion; diff --git a/src/mongo/db/s/collection_sharding_runtime.cpp b/src/mongo/db/s/collection_sharding_runtime.cpp index 38999e3d7f3..c3dfb5618c4 100644 --- a/src/mongo/db/s/collection_sharding_runtime.cpp +++ b/src/mongo/db/s/collection_sharding_runtime.cpp @@ -35,19 +35,14 @@ #include "mongo/base/checked_cast.h" #include "mongo/db/catalog_raii.h" -#include "mongo/db/server_parameters.h" +#include "mongo/db/s/sharding_runtime_d_params_gen.h" #include "mongo/util/duration.h" #include "mongo/util/log.h" namespace mongo { -MONGO_EXPORT_SERVER_PARAMETER(migrationLockAcquisitionMaxWaitMS, int, 500); - namespace { -// How long to wait before starting cleanup of an emigrated chunk range -MONGO_EXPORT_SERVER_PARAMETER(orphanCleanupDelaySecs, int, 900); // 900s = 15m - /** * Returns whether the specified namespace is used for sharding-internal purposes only and can never * be marked as anything other than UNSHARDED, because the call sites which reference these diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index a749eb45d9d..def44ce2e83 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -52,9 +52,9 @@ #include "mongo/db/s/collection_sharding_state.h" #include "mongo/db/s/migration_util.h" #include "mongo/db/s/move_timing_helper.h" +#include "mongo/db/s/sharding_runtime_d_params_gen.h" #include "mongo/db/s/sharding_statistics.h" #include "mongo/db/s/start_chunk_clone_request.h" -#include "mongo/db/server_parameters.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/remove_saver.h" #include "mongo/s/catalog/type_chunk.h" @@ -717,31 +717,6 @@ void MigrationDestinationManager::_migrateThread() { _isActiveCV.notify_all(); } -// The maximum number of documents to insert in a single batch during migration clone. -// secondaryThrottle and migrateCloneInsertionBatchDelayMS apply between each batch. -// 0 or negative values (the default) means no limit to batch size. -// 1 corresponds to 3.4.16 (and earlier) behavior. -MONGO_EXPORT_SERVER_PARAMETER(migrateCloneInsertionBatchSize, int, 0) - ->withValidator([](const int& newVal) { - if (newVal < 0) { - return Status(ErrorCodes::BadValue, - "migrateCloneInsertionBatchSize must not be negative"); - } - return Status::OK(); - }); - -// Time in milliseconds between batches of insertions during migration clone. -// This is in addition to any time spent waiting for replication (secondaryThrottle). -// Defaults to 0, which means no wait. -MONGO_EXPORT_SERVER_PARAMETER(migrateCloneInsertionBatchDelayMS, int, 0) - ->withValidator([](const int& newVal) { - if (newVal < 0) { - return Status(ErrorCodes::BadValue, - "migrateCloneInsertionBatchDelayMS must not be negative"); - } - return Status::OK(); - }); - void MigrationDestinationManager::_migrateDriver(OperationContext* opCtx) { invariant(isActive()); invariant(_sessionId); diff --git a/src/mongo/db/s/sharding_runtime_d_params.idl b/src/mongo/db/s/sharding_runtime_d_params.idl new file mode 100644 index 00000000000..44f808d412a --- /dev/null +++ b/src/mongo/db/s/sharding_runtime_d_params.idl @@ -0,0 +1,92 @@ +# 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 + +server_parameters: + rangeDeleterBatchSize: + description: >- + The maximum number of documents in each batch to delete during the cleanup stage of chunk + migration (or the cleanupOrphaned command). The default value of 0 indicates that the + system chooses an appropriate value, generally 128 documents. + set_at: [startup, runtime] + cpp_vartype: AtomicWord<int> + cpp_varname: rangeDeleterBatchSize + validator: + gte: 0 + default: 0 + + rangeDeleterBatchDelayMS: + description: >- + The amount of time in milliseconds to wait before the next batch of deletion during the + cleanup stage of chunk migration (or the cleanupOrphaned command). + set_at: [startup, runtime] + cpp_vartype: AtomicWord<int> + cpp_varname: rangeDeleterBatchDelayMS + validator: + gte: 0 + default: 20 + + migrateCloneInsertionBatchSize: + description: >- + The maximum number of documents to insert in a single batch during the cloning step of + the migration process. The default value of 0 indicates no maximum number of documents + per batch. However, in practice, this results in batches that contain up to 16 MB of + documents. The value 1 corresponds to MongoDB 3.4.16 (and earlier) behavior. + set_at: [startup, runtime] + cpp_vartype: AtomicWord<int> + cpp_varname: migrateCloneInsertionBatchSize + validator: + gte: 0 + default: 0 + + migrateCloneInsertionBatchDelayMS: + description: >- + Time in milliseconds to wait between batches of insertions during cloning step of the + migration process. This wait is in addition to the secondaryThrottle. The default value + of 0 indicates no additional wait. + set_at: [startup, runtime] + cpp_vartype: AtomicWord<int> + cpp_varname: migrateCloneInsertionBatchDelayMS + validator: + gte: 0 + default: 0 + + migrationLockAcquisitionMaxWaitMS: + description: 'How long to wait to acquire collection lock for migration related operations.' + set_at: [startup, runtime] + cpp_vartype: AtomicWord<int> + cpp_varname: migrationLockAcquisitionMaxWaitMS + default: 500 + + orphanCleanupDelaySecs: + description: 'How long to wait before starting cleanup of an emigrated chunk range.' + set_at: [startup, runtime] + cpp_vartype: AtomicWord<int> + cpp_varname: orphanCleanupDelaySecs + default: 900 |