summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Witten <andrew.witten@mongodb.com>2022-12-09 20:34:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-19 01:52:53 +0000
commitb5dda11fcdb180aecc11312db8059bd6ef9febec (patch)
treefa85cfd1bd21964f032b2719d856092f9f8035bc /src
parentcf51c67481fc15a5da955369618daab3c2bd80df (diff)
downloadmongo-b5dda11fcdb180aecc11312db8059bd6ef9febec.tar.gz
SERVER-70369 add server parameter for num inserter/fetcher threads in chunk migration
(cherry picked from commit 887a6878ad584a9fcc54087112a4a2b4d39bb32e)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/s/sharding_runtime_d_params.h55
-rw-r--r--src/mongo/db/s/sharding_runtime_d_params.idl15
2 files changed, 69 insertions, 1 deletions
diff --git a/src/mongo/db/s/sharding_runtime_d_params.h b/src/mongo/db/s/sharding_runtime_d_params.h
new file mode 100644
index 00000000000..190e442a5fb
--- /dev/null
+++ b/src/mongo/db/s/sharding_runtime_d_params.h
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2022-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 "fmt/core.h"
+#include "mongo/base/status.h"
+#include "mongo/s/sharding_feature_flags_gen.h"
+#include "mongo/util/processinfo.h"
+
+namespace mongo {
+
+inline Status validateMigrationConcurrency(const int& migrationConcurrency) {
+ if (!mongo::feature_flags::gConcurrencyInChunkMigration.isEnabledAndIgnoreFCV()) {
+ return Status{ErrorCodes::InvalidOptions,
+ "Cannot set migration concurrency number without enabling migration "
+ "concurrency feature flag"};
+ }
+ int maxConcurrency = ProcessInfo::getNumCores();
+ if (migrationConcurrency <= 0 || migrationConcurrency > maxConcurrency) {
+ return Status{
+ ErrorCodes::InvalidOptions,
+ fmt::format(
+ "Migration concurrency level must be positive and less than the number of cores.")};
+ }
+ return Status::OK();
+}
+
+} // namespace mongo
diff --git a/src/mongo/db/s/sharding_runtime_d_params.idl b/src/mongo/db/s/sharding_runtime_d_params.idl
index aeb0c8b676a..271e2cf6882 100644
--- a/src/mongo/db/s/sharding_runtime_d_params.idl
+++ b/src/mongo/db/s/sharding_runtime_d_params.idl
@@ -27,8 +27,21 @@
global:
cpp_namespace: mongo
+ cpp_includes:
+ - "mongo/db/s/sharding_runtime_d_params.h"
server_parameters:
+ migrationConcurrency:
+ description: >-
+ The number of threads doing insertions on the recipient during a chunk migration and
+ also the number of _migrateClone requests that the recipient sends to the source in parallel.
+ set_at: [startup, runtime]
+ cpp_vartype: AtomicWord<int>
+ cpp_varname: migrationConcurrency
+ validator:
+ callback: validateMigrationConcurrency
+ default: 1
+
rangeDeleterBatchSize:
description: >-
The maximum number of documents in each batch to delete during the cleanup stage of chunk
@@ -57,7 +70,7 @@ server_parameters:
receiveChunkWaitForRangeDeleterTimeoutMS:
description: >-
- Amount of time in milliseconds an incoming migration will wait for an intersecting range
+ Amount of time in milliseconds an incoming migration will wait for an intersecting range
with data in it to be cleared up before failing.
set_at: [startup, runtime]
cpp_vartype: AtomicWord<int>