summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage')
-rw-r--r--src/mongo/db/storage/SConscript6
-rw-r--r--src/mongo/db/storage/storage_options.cpp52
-rw-r--r--src/mongo/db/storage/storage_options.h2
-rw-r--r--src/mongo/db/storage/storage_parameters.idl59
4 files changed, 65 insertions, 54 deletions
diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript
index 648faadb60a..faebb4daaa8 100644
--- a/src/mongo/db/storage/SConscript
+++ b/src/mongo/db/storage/SConscript
@@ -84,9 +84,13 @@ env.Library(
target='storage_options',
source=[
'storage_options.cpp',
+ env.Idlc('storage_parameters.idl')[0],
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/server_parameters',
+ '$BUILD_DIR/mongo/base',
+ ],
+ LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/idl/server_parameter',
],
)
diff --git a/src/mongo/db/storage/storage_options.cpp b/src/mongo/db/storage/storage_options.cpp
index c91f12eee02..66fcc48e229 100644
--- a/src/mongo/db/storage/storage_options.cpp
+++ b/src/mongo/db/storage/storage_options.cpp
@@ -71,56 +71,4 @@ const char* StorageGlobalParams::kDefaultDbPath = "/data/db";
const char* StorageGlobalParams::kDefaultConfigDbPath = "/data/configdb";
#endif
-const int StorageGlobalParams::kMaxJournalCommitIntervalMs = 500;
-
-namespace {
-/**
- * Specify whether all queries must use indexes.
- * If 1, MongoDB will not execute queries that require a table scan and will return an error.
- * NOT recommended for production use.
- */
-ExportedServerParameter<bool, ServerParameterType::kStartupAndRuntime> NoTableScanSetting(
- ServerParameterSet::getGlobal(), "notablescan", &storageGlobalParams.noTableScan);
-
-/**
- * Specify the interval in seconds between fsync operations where mongod flushes its
- * working memory to disk. By default, mongod flushes memory to disk every 60 seconds.
- * In almost every situation you should not set this value and use the default setting.
- */
-MONGO_COMPILER_VARIABLE_UNUSED auto _exportedSyncdelay =
- (new ExportedServerParameter<double, ServerParameterType::kStartupAndRuntime>(
- ServerParameterSet::getGlobal(), "syncdelay", &storageGlobalParams.syncdelay))
- -> withValidator([](const double& potentialNewValue) {
- if (potentialNewValue < 0.0 ||
- potentialNewValue > StorageGlobalParams::kMaxSyncdelaySecs) {
- return Status(ErrorCodes::BadValue,
- str::stream() << "syncdelay must be between 0 and "
- << StorageGlobalParams::kMaxSyncdelaySecs
- << ", but attempted to set to: "
- << potentialNewValue);
- }
- return Status::OK();
- });
-
-/**
- * Specify an integer between 1 and kMaxJournalCommitInterval signifying the number of milliseconds
- * (ms) between journal commits.
- */
-MONGO_COMPILER_VARIABLE_UNUSED auto _exportedJournalCommitInterval =
- (new ExportedServerParameter<int, ServerParameterType::kRuntimeOnly>(
- ServerParameterSet::getGlobal(),
- "journalCommitInterval",
- &storageGlobalParams.journalCommitIntervalMs))
- -> withValidator([](const int& potentialNewValue) {
- if (potentialNewValue < 1 ||
- potentialNewValue > StorageGlobalParams::kMaxJournalCommitIntervalMs) {
- return Status(ErrorCodes::BadValue,
- str::stream() << "journalCommitInterval must be between 1 and "
- << StorageGlobalParams::kMaxJournalCommitIntervalMs
- << ", but attempted to set to: "
- << potentialNewValue);
- }
- return Status::OK();
- });
-} // namespace
} // namespace mongo
diff --git a/src/mongo/db/storage/storage_options.h b/src/mongo/db/storage/storage_options.h
index cc77ecad564..733808ce3c1 100644
--- a/src/mongo/db/storage/storage_options.h
+++ b/src/mongo/db/storage/storage_options.h
@@ -77,7 +77,7 @@ struct StorageGlobalParams {
bool dur; // --dur durability (now --journal)
// --journalCommitInterval
- static const int kMaxJournalCommitIntervalMs;
+ static constexpr int kMaxJournalCommitIntervalMs = 500;
AtomicWord<int> journalCommitIntervalMs;
// --notablescan
diff --git a/src/mongo/db/storage/storage_parameters.idl b/src/mongo/db/storage/storage_parameters.idl
new file mode 100644
index 00000000000..856407070d6
--- /dev/null
+++ b/src/mongo/db/storage/storage_parameters.idl
@@ -0,0 +1,59 @@
+# Copyright (C) 2019-present MongoDB, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the Server Side Public License, version 1,
+# as published by MongoDB, Inc.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# Server Side Public License for more details.
+#
+# You should have received a copy of the Server Side Public License
+# along with this program. If not, see
+# <http://www.mongodb.com/licensing/server-side-public-license>.
+#
+# As a special exception, the copyright holders give permission to link the
+# code of portions of this program with the OpenSSL library under certain
+# conditions as described in each individual source file and distribute
+# linked combinations including the program with the OpenSSL library. You
+# must comply with the Server Side Public License in all respects for
+# all of the code used other than as permitted herein. If you modify file(s)
+# with this exception, you may extend this exception to your version of the
+# file(s), but you are not obligated to do so. If you do not wish to do so,
+# delete this exception statement from your version. If you delete this
+# exception statement from all source files in the program, then also delete
+# it in the license file.
+#
+
+global:
+ cpp_namespace: "mongo"
+ cpp_includes:
+ - "mongo/bson/bson_depth.h"
+
+server_parameters:
+ notablescan:
+ # NOT recommended for production use.
+ description: >-
+ Whether all queries must use indexes.
+ If true, MongoDB will not execute queries that require a table scan and will return an error.
+ set_at: [ startup, runtime ]
+ cpp_varname: 'storageGlobalParams.noTableScan'
+ syncdelay:
+ # In almost every situation you should not set this value and use the default setting.
+ description: >-
+ Interval in seconds between fsync operations where mongod flushes its
+ working memory to disk. By default, mongod flushes memory to disk every 60 seconds.
+ set_at: [ startup, runtime ]
+ cpp_varname: 'storageGlobalParams.syncdelay'
+ validator:
+ gte: 0.0
+ lte: { expr: 'StorageGlobalParams::kMaxSyncdelaySecs' }
+ journalCommitInterval:
+ description: 'Number of milliseconds between journal commits'
+ set_at: runtime
+ cpp_varname: 'storageGlobalParams.journalCommitIntervalMs'
+ validator:
+ gte: 1
+ lte: { expr: 'StorageGlobalParams::kMaxJournalCommitIntervalMs' }
+