summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2016-11-30 09:57:33 -0500
committerEric Milkie <milkie@10gen.com>2016-12-01 11:13:38 -0500
commit6f904c0c49a3a86559b96f99365a36cf942e5779 (patch)
tree361aa010a3014f22955c60110a3302e6f5df32c4
parent412ba238fc3bbf58e4cbc17dcc2e5f3440c8e445 (diff)
downloadmongo-6f904c0c49a3a86559b96f99365a36cf942e5779.tar.gz
SERVER-27217 Allow nopreallocj to be specified in a YAML config file
(cherry picked from commit d6367145b2844b289b87c9b235e453e0f80c5f42)
-rw-r--r--src/mongo/db/mongod_options.cpp339
1 files changed, 177 insertions, 162 deletions
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index e8facbaa850..a380970fccf 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -44,9 +44,9 @@
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_helpers.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
-#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/logger/console_appender.h"
#include "mongo/logger/message_event_utf8_encoder.h"
+#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/ssl_options.h"
@@ -105,13 +105,13 @@ Status addMongodOptions(moe::OptionSection* options) {
// Way to enable or disable auth in JSON Config
general_options
.addOptionChaining(
- "security.authorization",
- "",
- moe::String,
- "How the database behaves with respect to authorization of clients. "
- "Options are \"disabled\", which means that authorization checks are not "
- "performed, and \"enabled\" which means that a client cannot perform actions it is "
- "not authorized to do.")
+ "security.authorization",
+ "",
+ moe::String,
+ "How the database behaves with respect to authorization of clients. "
+ "Options are \"disabled\", which means that authorization checks are not "
+ "performed, and \"enabled\" which means that a client cannot perform actions it is "
+ "not authorized to do.")
.setSources(moe::SourceYAMLConfig)
.format("(:?disabled)|(:?enabled)", "(disabled/enabled)");
@@ -136,35 +136,35 @@ Status addMongodOptions(moe::OptionSection* options) {
// Diagnostic Options
- general_options.addOptionChaining("diaglog",
- "diaglog",
- moe::Int,
- "DEPRECATED: 0=off 1=W 2=R 3=both 7=W+some reads")
+ general_options
+ .addOptionChaining(
+ "diaglog", "diaglog", moe::Int, "DEPRECATED: 0=off 1=W 2=R 3=both 7=W+some reads")
.hidden()
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining("operationProfiling.slowOpThresholdMs",
- "slowms",
- moe::Int,
- "value of slow for profile and console log")
+ general_options
+ .addOptionChaining("operationProfiling.slowOpThresholdMs",
+ "slowms",
+ moe::Int,
+ "value of slow for profile and console log")
.setDefault(moe::Value(100));
general_options.addOptionChaining("profile", "profile", moe::Int, "0=off 1=slow, 2=all")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining(
- "operationProfiling.mode", "", moe::String, "(off/slowOp/all)")
+ general_options
+ .addOptionChaining("operationProfiling.mode", "", moe::String, "(off/slowOp/all)")
.setSources(moe::SourceYAMLConfig)
.format("(:?off)|(:?slowOp)|(:?all)", "(off/slowOp/all)");
- general_options.addOptionChaining(
- "cpu", "cpu", moe::Switch, "periodically show cpu and iowait utilization")
+ general_options
+ .addOptionChaining(
+ "cpu", "cpu", moe::Switch, "periodically show cpu and iowait utilization")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining("sysinfo",
- "sysinfo",
- moe::Switch,
- "print some diagnostic system information")
+ general_options
+ .addOptionChaining(
+ "sysinfo", "sysinfo", moe::Switch, "print some diagnostic system information")
.setSources(moe::SourceAllLegacy);
// Storage Options
@@ -200,46 +200,50 @@ Status addMongodOptions(moe::OptionSection* options) {
moe::Switch,
"each database will be stored in a separate directory");
- general_options.addOptionChaining(
- "noIndexBuildRetry",
- "noIndexBuildRetry",
- moe::Switch,
- "don't retry any index builds that were interrupted by shutdown")
+ general_options
+ .addOptionChaining("noIndexBuildRetry",
+ "noIndexBuildRetry",
+ moe::Switch,
+ "don't retry any index builds that were interrupted by shutdown")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining(
- "storage.indexBuildRetry",
- "",
- moe::Bool,
- "don't retry any index builds that were interrupted by shutdown")
+ general_options
+ .addOptionChaining("storage.indexBuildRetry",
+ "",
+ moe::Bool,
+ "don't retry any index builds that were interrupted by shutdown")
.setSources(moe::SourceYAMLConfig);
- storage_options.addOptionChaining(
- "noprealloc",
- "noprealloc",
- moe::Switch,
- "disable data file preallocation - will often hurt performance")
+ storage_options
+ .addOptionChaining("noprealloc",
+ "noprealloc",
+ moe::Switch,
+ "disable data file preallocation - will often hurt performance")
.setSources(moe::SourceAllLegacy);
- storage_options.addOptionChaining(
- "storage.mmapv1.preallocDataFiles",
- "",
- moe::Bool,
- "disable data file preallocation - will often hurt performance",
- "storage.preallocDataFiles").setSources(moe::SourceYAMLConfig);
-
- storage_options.addOptionChaining("storage.mmapv1.nsSize",
- "nssize",
- moe::Int,
- ".ns file size (in MB) for new databases",
- "storage.nsSize").setDefault(moe::Value(16));
+ storage_options
+ .addOptionChaining("storage.mmapv1.preallocDataFiles",
+ "",
+ moe::Bool,
+ "disable data file preallocation - will often hurt performance",
+ "storage.preallocDataFiles")
+ .setSources(moe::SourceYAMLConfig);
- storage_options.addOptionChaining(
- "storage.mmapv1.quota.enforced",
- "quota",
- moe::Switch,
- "limits each database to a certain number of files (8 default)",
- "storage.quota.enforced").incompatibleWith("keyFile");
+ storage_options
+ .addOptionChaining("storage.mmapv1.nsSize",
+ "nssize",
+ moe::Int,
+ ".ns file size (in MB) for new databases",
+ "storage.nsSize")
+ .setDefault(moe::Value(16));
+
+ storage_options
+ .addOptionChaining("storage.mmapv1.quota.enforced",
+ "quota",
+ moe::Switch,
+ "limits each database to a certain number of files (8 default)",
+ "storage.quota.enforced")
+ .incompatibleWith("keyFile");
storage_options.addOptionChaining("storage.mmapv1.quota.maxFilesPerDB",
"quotaFiles",
@@ -253,10 +257,11 @@ Status addMongodOptions(moe::OptionSection* options) {
"use a smaller default file size",
"storage.smallFiles");
- storage_options.addOptionChaining("storage.syncPeriodSecs",
- "syncdelay",
- moe::Double,
- "seconds between disk syncs (0=never, but not recommended)")
+ storage_options
+ .addOptionChaining("storage.syncPeriodSecs",
+ "syncdelay",
+ moe::Double,
+ "seconds between disk syncs (0=never, but not recommended)")
.setDefault(moe::Value(60.0));
// Upgrade and repair are disallowed in JSON configs since they trigger very heavyweight
@@ -274,18 +279,19 @@ Status addMongodOptions(moe::OptionSection* options) {
// Javascript Options
- general_options.addOptionChaining(
- "noscripting", "noscripting", moe::Switch, "disable scripting engine")
+ general_options
+ .addOptionChaining("noscripting", "noscripting", moe::Switch, "disable scripting engine")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining(
- "security.javascriptEnabled", "", moe::Bool, "Enable javascript execution")
+ general_options
+ .addOptionChaining(
+ "security.javascriptEnabled", "", moe::Bool, "Enable javascript execution")
.setSources(moe::SourceYAMLConfig);
// Query Options
- general_options.addOptionChaining(
- "notablescan", "notablescan", moe::Switch, "do not allow table scans")
+ general_options
+ .addOptionChaining("notablescan", "notablescan", moe::Switch, "do not allow table scans")
.setSources(moe::SourceAllLegacy);
// Journaling Options
@@ -294,10 +300,11 @@ Status addMongodOptions(moe::OptionSection* options) {
storage_options.addOptionChaining("journal", "journal", moe::Switch, "enable journaling")
.setSources(moe::SourceAllLegacy);
- storage_options.addOptionChaining("nojournal",
- "nojournal",
- moe::Switch,
- "disable journaling (journaling is on by default for 64 bit)")
+ storage_options
+ .addOptionChaining("nojournal",
+ "nojournal",
+ moe::Switch,
+ "disable journaling (journaling is on by default for 64 bit)")
.setSources(moe::SourceAllLegacy);
storage_options.addOptionChaining("dur", "dur", moe::Switch, "enable journaling")
@@ -313,14 +320,16 @@ Status addMongodOptions(moe::OptionSection* options) {
.setSources(moe::SourceYAMLConfig);
// Two ways to set durability diagnostic options. durOptions is deprecated
- storage_options.addOptionChaining("storage.mmapv1.journal.debugFlags",
- "journalOptions",
- moe::Int,
- "journal diagnostic options",
- "storage.journal.debugFlags").incompatibleWith("durOptions");
-
- storage_options.addOptionChaining(
- "durOptions", "durOptions", moe::Int, "durability diagnostic options")
+ storage_options
+ .addOptionChaining("storage.mmapv1.journal.debugFlags",
+ "journalOptions",
+ moe::Int,
+ "journal diagnostic options",
+ "storage.journal.debugFlags")
+ .incompatibleWith("durOptions");
+
+ storage_options
+ .addOptionChaining("durOptions", "durOptions", moe::Int, "durability diagnostic options")
.hidden()
.setSources(moe::SourceAllLegacy)
.incompatibleWith("storage.mmapv1.journal.debugFlags");
@@ -332,12 +341,13 @@ Status addMongodOptions(moe::OptionSection* options) {
"storage.mmapv1.journal.commitIntervalMs");
// Deprecated option that we don't want people to use for performance reasons
- storage_options.addOptionChaining("nopreallocj",
- "nopreallocj",
- moe::Switch,
- "don't preallocate journal files")
+ storage_options
+ .addOptionChaining("storage.mmapv1.journal.nopreallocj",
+ "nopreallocj",
+ moe::Switch,
+ "don't preallocate journal files")
.hidden()
- .setSources(moe::SourceAllLegacy);
+ .setSources(moe::SourceAll);
#if defined(__linux__)
general_options.addOptionChaining(
@@ -357,33 +367,33 @@ Status addMongodOptions(moe::OptionSection* options) {
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining(
- "source", "source", moe::String, "when slave: specify master as <server:port>")
+ ms_options
+ .addOptionChaining(
+ "source", "source", moe::String, "when slave: specify master as <server:port>")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining("only",
- "only",
- moe::String,
- "when slave: specify a single database to replicate")
+ ms_options
+ .addOptionChaining(
+ "only", "only", moe::String, "when slave: specify a single database to replicate")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining(
- "slavedelay",
- "slavedelay",
- moe::Int,
- "specify delay (in seconds) to be used when applying master ops to slave")
+ ms_options
+ .addOptionChaining(
+ "slavedelay",
+ "slavedelay",
+ moe::Int,
+ "specify delay (in seconds) to be used when applying master ops to slave")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining("autoresync",
- "autoresync",
- moe::Switch,
- "automatically resync if slave data is stale")
+ ms_options
+ .addOptionChaining(
+ "autoresync", "autoresync", moe::Switch, "automatically resync if slave data is stale")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
@@ -397,21 +407,22 @@ Status addMongodOptions(moe::OptionSection* options) {
"size to use (in MB) for replication op log. default is 5% of disk space "
"(i.e. large is good)");
- rs_options.addOptionChaining("replication.replSet",
- "replSet",
- moe::String,
- "arg is <setname>[/<optionalseedhostlist>]")
+ rs_options
+ .addOptionChaining("replication.replSet",
+ "replSet",
+ moe::String,
+ "arg is <setname>[/<optionalseedhostlist>]")
.setSources(moe::SourceAllLegacy);
rs_options.addOptionChaining("replication.replSetName", "", moe::String, "arg is <setname>")
.setSources(moe::SourceYAMLConfig)
.format("[^/]+", "[replica set name with no \"/\"]");
- rs_options.addOptionChaining(
- "replication.secondaryIndexPrefetch",
- "replIndexPrefetch",
- moe::String,
- "specify index prefetching behavior (if secondary) [none|_id_only|all]")
+ rs_options
+ .addOptionChaining("replication.secondaryIndexPrefetch",
+ "replIndexPrefetch",
+ moe::String,
+ "specify index prefetching behavior (if secondary) [none|_id_only|all]")
.format("(:?none)|(:?_id_only)|(:?all)", "(none/_id_only/all)");
rs_options.addOptionChaining("replication.enableMajorityReadConcern",
@@ -421,70 +432,71 @@ Status addMongodOptions(moe::OptionSection* options) {
// Sharding Options
- sharding_options.addOptionChaining(
- "configsvr",
- "configsvr",
- moe::Switch,
- "declare this is a config db of a cluster; default port 27019; "
- "default dir /data/configdb")
+ sharding_options
+ .addOptionChaining("configsvr",
+ "configsvr",
+ moe::Switch,
+ "declare this is a config db of a cluster; default port 27019; "
+ "default dir /data/configdb")
.setSources(moe::SourceAllLegacy)
.incompatibleWith("shardsvr")
.incompatibleWith("nojournal");
- sharding_options.addOptionChaining("sharding.configsvrMode",
- "configsvrMode",
- moe::String,
- "Controls what config server protocol is in use. When set to"
- " \"sccc\" keeps server in legacy SyncClusterConnection mode"
- " even when the service is running as a replSet")
+ sharding_options
+ .addOptionChaining("sharding.configsvrMode",
+ "configsvrMode",
+ moe::String,
+ "Controls what config server protocol is in use. When set to"
+ " \"sccc\" keeps server in legacy SyncClusterConnection mode"
+ " even when the service is running as a replSet")
.setSources(moe::SourceAll);
- sharding_options.addOptionChaining(
- "shardsvr",
- "shardsvr",
- moe::Switch,
- "declare this is a shard db of a cluster; default port 27018")
+ sharding_options
+ .addOptionChaining("shardsvr",
+ "shardsvr",
+ moe::Switch,
+ "declare this is a shard db of a cluster; default port 27018")
.setSources(moe::SourceAllLegacy)
.incompatibleWith("configsvr");
sharding_options
.addOptionChaining(
- "sharding.clusterRole",
- "",
- moe::String,
- "Choose what role this mongod has in a sharded cluster. Possible values are:\n"
- " \"configsvr\": Start this node as a config server. Starts on port 27019 by "
- "default."
- " \"shardsvr\": Start this node as a shard server. Starts on port 27018 by "
- "default.")
+ "sharding.clusterRole",
+ "",
+ moe::String,
+ "Choose what role this mongod has in a sharded cluster. Possible values are:\n"
+ " \"configsvr\": Start this node as a config server. Starts on port 27019 by "
+ "default."
+ " \"shardsvr\": Start this node as a shard server. Starts on port 27018 by "
+ "default.")
.setSources(moe::SourceYAMLConfig)
.format("(:?configsvr)|(:?shardsvr)", "(configsvr/shardsvr)");
- sharding_options.addOptionChaining(
- "noMoveParanoia",
- "noMoveParanoia",
- moe::Switch,
- "turn off paranoid saving of data for the moveChunk command; default")
+ sharding_options
+ .addOptionChaining("noMoveParanoia",
+ "noMoveParanoia",
+ moe::Switch,
+ "turn off paranoid saving of data for the moveChunk command; default")
.hidden()
.setSources(moe::SourceAllLegacy)
.incompatibleWith("moveParanoia");
- sharding_options.addOptionChaining(
- "moveParanoia",
- "moveParanoia",
- moe::Switch,
- "turn on paranoid saving of data during the moveChunk command "
- "(used for internal system diagnostics)")
+ sharding_options
+ .addOptionChaining("moveParanoia",
+ "moveParanoia",
+ moe::Switch,
+ "turn on paranoid saving of data during the moveChunk command "
+ "(used for internal system diagnostics)")
.hidden()
.setSources(moe::SourceAllLegacy)
.incompatibleWith("noMoveParanoia");
- sharding_options.addOptionChaining(
- "sharding.archiveMovedChunks",
- "",
- moe::Bool,
- "config file option to turn on paranoid saving of data during the "
- "moveChunk command (used for internal system diagnostics)")
+ sharding_options
+ .addOptionChaining("sharding.archiveMovedChunks",
+ "",
+ moe::Bool,
+ "config file option to turn on paranoid saving of data during the "
+ "moveChunk command (used for internal system diagnostics)")
.hidden()
.setSources(moe::SourceYAMLConfig);
@@ -504,18 +516,20 @@ Status addMongodOptions(moe::OptionSection* options) {
// The following are legacy options that are disallowed in the JSON config file
- options->addOptionChaining(
- "fastsync",
- "fastsync",
- moe::Switch,
- "indicate that this instance is starting from a dbpath snapshot of the repl peer")
+ options
+ ->addOptionChaining(
+ "fastsync",
+ "fastsync",
+ moe::Switch,
+ "indicate that this instance is starting from a dbpath snapshot of the repl peer")
.hidden()
.setSources(moe::SourceAllLegacy);
- options->addOptionChaining("pretouch",
- "pretouch",
- moe::Int,
- "n pretouch threads for applying master/slave operations")
+ options
+ ->addOptionChaining("pretouch",
+ "pretouch",
+ moe::Int,
+ "n pretouch threads for applying master/slave operations")
.hidden()
.setSources(moe::SourceAllLegacy);
@@ -528,8 +542,8 @@ Status addMongodOptions(moe::OptionSection* options) {
.positional(1, 3)
.setSources(moe::SourceAllLegacy);
- options->addOptionChaining(
- "cacheSize", "cacheSize", moe::Long, "cache size (in MB) for rec store")
+ options
+ ->addOptionChaining("cacheSize", "cacheSize", moe::Long, "cache size (in MB) for rec store")
.hidden()
.setSources(moe::SourceAllLegacy);
@@ -1145,7 +1159,8 @@ Status storeMongodOptions(const moe::Environment& params, const std::vector<std:
if (x <= 0) {
return Status(ErrorCodes::BadValue,
str::stream() << "bad --oplogSize, arg must be greater than 0,"
- "found: " << x);
+ "found: "
+ << x);
}
// note a small size such as x==1 is ok for an arbiter.
if (x > 1000 && sizeof(void*) == 4) {