Skip to content

Commit

Permalink
simplify options tagging (arangodb#10974)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteemann authored Jan 27, 2020
1 parent aa0df9c commit e445742
Show file tree
Hide file tree
Showing 56 changed files with 336 additions and 245 deletions.
2 changes: 1 addition & 1 deletion arangod/Actions/ActionFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void ActionFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
"allow change of database in REST actions, only needed for "
"unittests",
new BooleanParameter(&_allowUseDatabase),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden));
}

void ActionFeature::start() {
Expand Down
45 changes: 29 additions & 16 deletions arangod/Agency/AgencyFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,73 +80,86 @@ void AgencyFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
options->addSection("agency", "Configure the agency");

options->addOption("--agency.activate", "Activate agency",
new BooleanParameter(&_activated));
new BooleanParameter(&_activated),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.size", "number of agents", new UInt64Parameter(&_size));
options->addOption("--agency.size", "number of agents",
new UInt64Parameter(&_size),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.pool-size", "number of agent pool",
new UInt64Parameter(&_poolSize));
new UInt64Parameter(&_poolSize),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption(
"--agency.election-timeout-min",
"minimum timeout before an agent calls for new election (in seconds)",
new DoubleParameter(&_minElectionTimeout));
new DoubleParameter(&_minElectionTimeout),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption(
"--agency.election-timeout-max",
"maximum timeout before an agent calls for new election (in seconds)",
new DoubleParameter(&_maxElectionTimeout));
new DoubleParameter(&_maxElectionTimeout),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.endpoint", "agency endpoints",
new VectorParameter<StringParameter>(&_agencyEndpoints));
new VectorParameter<StringParameter>(&_agencyEndpoints),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.my-address",
"which address to advertise to the outside",
new StringParameter(&_agencyMyAddress));
new StringParameter(&_agencyMyAddress),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.supervision",
"perform arangodb cluster supervision",
new BooleanParameter(&_supervision));
new BooleanParameter(&_supervision),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.supervision-frequency",
"arangodb cluster supervision frequency (in seconds)",
new DoubleParameter(&_supervisionFrequency));
new DoubleParameter(&_supervisionFrequency),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption(
"--agency.supervision-grace-period",
"supervision time, after which a server is considered to have failed (in seconds)",
new DoubleParameter(&_supervisionGracePeriod));
new DoubleParameter(&_supervisionGracePeriod),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption(
"--agency.supervision-ok-threshold",
"supervision time, after which a server is considered to be bad [s]",
new DoubleParameter(&_supervisionOkThreshold));
new DoubleParameter(&_supervisionOkThreshold),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.compaction-step-size",
"step size between state machine compactions",
new UInt64Parameter(&_compactionStepSize),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::Hidden, arangodb::options::Flags::OnAgent));

options->addOption("--agency.compaction-keep-size",
"keep as many indices before compaction point",
new UInt64Parameter(&_compactionKeepSize));
new UInt64Parameter(&_compactionKeepSize),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnAgent));

options->addOption("--agency.wait-for-sync",
"wait for hard disk syncs on every persistence call "
"(required in production)",
new BooleanParameter(&_waitForSync),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::Hidden, arangodb::options::Flags::OnAgent));

options->addOption("--agency.max-append-size",
"maximum size of appendEntries document (# log entries)",
new UInt64Parameter(&_maxAppendSize),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::Hidden, arangodb::options::Flags::OnAgent));

options->addOption("--agency.disaster-recovery-id",
"allows for specification of the id for this agent; "
"dangerous option for disaster recover only!",
new StringParameter(&_recoveryId),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::Hidden, arangodb::options::Flags::OnAgent));
}

void AgencyFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/OptimizerRulesFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void OptimizerRulesFeature::collectOptions(std::shared_ptr<arangodb::options::Pr
options->addOption("--query.optimizer-rules",
"enable or disable specific optimizer rules (use rule name prefixed with '-' for disabling, '+' for enabling)",
new arangodb::options::VectorParameter<arangodb::options::StringParameter>(&_optimizerRules),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden))
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden))
.setIntroducedIn(30600);

options->addOption("--query.parallelize-gather-writes",
Expand Down
2 changes: 1 addition & 1 deletion arangod/Cache/CacheManagerFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void CacheManagerFeature::collectOptions(std::shared_ptr<options::ProgramOptions

options->addOption("--cache.size", "size of cache in bytes",
new UInt64Parameter(&_cacheSize),
arangodb::options::makeFlags(arangodb::options::Flags::Dynamic));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic));

options->addOption("--cache.rebalancing-interval",
"microseconds between rebalancing attempts",
Expand Down
52 changes: 34 additions & 18 deletions arangod/Cluster/ClusterFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ void ClusterFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
"path to log directory for the cluster", true);
options->addObsoleteOption("--cluster.arangod-path",
"path to the arangod for the cluster", true);
options->addObsoleteOption("--cluster.my-local-info",
"this server's local info", false);
options->addObsoleteOption("--cluster.my-id", "this server's id", false);


options->addOption(
"--cluster.require-persisted-id",
Expand All @@ -100,68 +104,80 @@ void ClusterFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {

options->addOption("--cluster.agency-endpoint",
"agency endpoint to connect to",
new VectorParameter<StringParameter>(&_agencyEndpoints));
new VectorParameter<StringParameter>(&_agencyEndpoints),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator, arangodb::options::Flags::OnDBServer));

options->addOption("--cluster.agency-prefix", "agency prefix",
new StringParameter(&_agencyPrefix),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));

options->addObsoleteOption("--cluster.my-local-info",
"this server's local info", false);
options->addObsoleteOption("--cluster.my-id", "this server's id", false);
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator, arangodb::options::Flags::OnDBServer));

options->addOption("--cluster.my-role", "this server's role",
new StringParameter(&_myRole));

options->addOption("--cluster.my-address",
"this server's endpoint (cluster internal)",
new StringParameter(&_myEndpoint));
new StringParameter(&_myEndpoint),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator, arangodb::options::Flags::OnDBServer));

options->addOption("--cluster.my-advertised-endpoint",
"this server's advertised endpoint (e.g. external IP "
"address or load balancer, optional)",
new StringParameter(&_myAdvertisedEndpoint));
new StringParameter(&_myAdvertisedEndpoint),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator, arangodb::options::Flags::OnDBServer));

options->addOption("--cluster.write-concern",
"write concern used for writes to new collections",
new UInt32Parameter(&_writeConcern)).setIntroducedIn(30600);
new UInt32Parameter(&_writeConcern),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator))
.setIntroducedIn(30600);

options->addOption("--cluster.system-replication-factor",
"default replication factor for system collections",
new UInt32Parameter(&_systemReplicationFactor));
new UInt32Parameter(&_systemReplicationFactor),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator));

options->addOption("--cluster.default-replication-factor",
"default replication factor for non-system collections",
new UInt32Parameter(&_defaultReplicationFactor)).setIntroducedIn(30600);
new UInt32Parameter(&_defaultReplicationFactor),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator))
.setIntroducedIn(30600);

options->addOption("--cluster.min-replication-factor",
"minimum replication factor for new collections",
new UInt32Parameter(&_minReplicationFactor)).setIntroducedIn(30600);
new UInt32Parameter(&_minReplicationFactor),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator))
.setIntroducedIn(30600);

options->addOption("--cluster.max-replication-factor",
"maximum replication factor for new collections (0 = unrestricted)",
new UInt32Parameter(&_maxReplicationFactor)).setIntroducedIn(30600);
new UInt32Parameter(&_maxReplicationFactor),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator))
.setIntroducedIn(30600);

options->addOption("--cluster.max-number-of-shards",
"maximum number of shards when creating new collections (0 = unrestricted)",
new UInt32Parameter(&_maxNumberOfShards)).setIntroducedIn(30501);
new UInt32Parameter(&_maxNumberOfShards),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator))
.setIntroducedIn(30501);

options->addOption("--cluster.force-one-shard",
"force one-shard mode for all new collections",
new BooleanParameter(&_forceOneShard)).setIntroducedIn(30600);
new BooleanParameter(&_forceOneShard),
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator))
.setIntroducedIn(30600);

options->addOption(
"--cluster.create-waits-for-sync-replication",
"active coordinator will wait for all replicas to create collection",
new BooleanParameter(&_createWaitsForSyncReplication),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::Hidden, arangodb::options::Flags::OnCoordinator, arangodb::options::Flags::OnDBServer));

options->addOption(
"--cluster.index-create-timeout",
"amount of time (in seconds) the coordinator will wait for an index to "
"be created before giving up",
new DoubleParameter(&_indexCreationTimeout),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::Hidden, arangodb::options::Flags::OnCoordinator));
}

void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
Expand All @@ -172,7 +188,7 @@ void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
LOG_TOPIC("33707", FATAL, arangodb::Logger::CLUSTER)
<< "The dispatcher feature isn't available anymore. Use "
<< "ArangoDBStarter for this now! See "
<< "https://github.com/arangodb-helper/ArangoDBStarter/ for more "
<< "https://github.com/arangodb-helper/arangodb/ for more "
<< "details.";
FATAL_ERROR_EXIT();
}
Expand Down
8 changes: 4 additions & 4 deletions arangod/Cluster/MaintenanceFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,25 @@ void MaintenanceFeature::collectOptions(std::shared_ptr<ProgramOptions> options)
"--server.maintenance-threads",
"maximum number of threads available for maintenance actions",
new UInt32Parameter(&_maintenanceThreadsMax),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden,
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden,
arangodb::options::Flags::Dynamic));

options->addOption(
"--server.maintenance-actions-block",
"minimum number of seconds finished Actions block duplicates",
new Int32Parameter(&_secondsActionsBlock),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden));

options->addOption(
"--server.maintenance-actions-linger",
"minimum number of seconds finished Actions remain in deque",
new Int32Parameter(&_secondsActionsLinger),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden));

options->addOption("--cluster.resign-leadership-on-shutdown",
"create resign leader ship job for this dbsever on shutdown",
new BooleanParameter(&_resignLeadershipOnShutdown),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden));

} // MaintenanceFeature::collectOptions

Expand Down
2 changes: 1 addition & 1 deletion arangod/Cluster/ReplicationTimeoutFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void ReplicationTimeoutFeature::collectOptions(std::shared_ptr<ProgramOptions> o
"all synchronous replication timeouts are increased by this amount per "
"4096 bytes (in seconds)",
new DoubleParameter(&timeoutPer4k),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden));
}

} // namespace arangodb
4 changes: 2 additions & 2 deletions arangod/GeneralServer/GeneralServerFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ void GeneralServerFeature::collectOptions(std::shared_ptr<ProgramOptions> option
options->addOption("--server.io-threads",
"Number of threads used to handle IO",
new UInt64Parameter(&_numIoThreads),
arangodb::options::makeFlags(arangodb::options::Flags::Dynamic));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic));

options->addSection("http", "HttpServer features");

options->addOption("--http.allow-method-override",
"allow HTTP method override using special headers",
new BooleanParameter(&_allowMethodOverride),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden));

options->addOption("--http.keep-alive-timeout",
"keep-alive timeout in seconds",
Expand Down
2 changes: 1 addition & 1 deletion arangod/GeneralServer/SslServerFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void SslServerFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
options->addOption("--ssl.options",
"ssl connection options, see OpenSSL documentation",
new UInt64Parameter(&_sslOptions),
arangodb::options::makeFlags(arangodb::options::Flags::Hidden));
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden));

options->addOption(
"--ssl.ecdh-curve",
Expand Down
Loading

0 comments on commit e445742

Please sign in to comment.