diff --git a/arangod/Actions/ActionFeature.cpp b/arangod/Actions/ActionFeature.cpp index dea3d6e8a243..e34b7dded6a2 100644 --- a/arangod/Actions/ActionFeature.cpp +++ b/arangod/Actions/ActionFeature.cpp @@ -51,7 +51,7 @@ void ActionFeature::collectOptions(std::shared_ptr 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() { diff --git a/arangod/Agency/AgencyFeature.cpp b/arangod/Agency/AgencyFeature.cpp index 3e8dab306688..a73badb35c9a 100644 --- a/arangod/Agency/AgencyFeature.cpp +++ b/arangod/Agency/AgencyFeature.cpp @@ -80,73 +80,86 @@ void AgencyFeature::collectOptions(std::shared_ptr 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(&_agencyEndpoints)); + new VectorParameter(&_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 options) { diff --git a/arangod/Aql/OptimizerRulesFeature.cpp b/arangod/Aql/OptimizerRulesFeature.cpp index 95cc63d2a481..e0f289a3ce20 100644 --- a/arangod/Aql/OptimizerRulesFeature.cpp +++ b/arangod/Aql/OptimizerRulesFeature.cpp @@ -62,7 +62,7 @@ void OptimizerRulesFeature::collectOptions(std::shared_ptraddOption("--query.optimizer-rules", "enable or disable specific optimizer rules (use rule name prefixed with '-' for disabling, '+' for enabling)", new arangodb::options::VectorParameter(&_optimizerRules), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30600); options->addOption("--query.parallelize-gather-writes", diff --git a/arangod/Cache/CacheManagerFeature.cpp b/arangod/Cache/CacheManagerFeature.cpp index d932b95ff69b..e9f95e084ff5 100644 --- a/arangod/Cache/CacheManagerFeature.cpp +++ b/arangod/Cache/CacheManagerFeature.cpp @@ -74,7 +74,7 @@ void CacheManagerFeature::collectOptions(std::shared_ptraddOption("--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", diff --git a/arangod/Cluster/ClusterFeature.cpp b/arangod/Cluster/ClusterFeature.cpp index 96fd686fa6b9..ca2897acb62b 100644 --- a/arangod/Cluster/ClusterFeature.cpp +++ b/arangod/Cluster/ClusterFeature.cpp @@ -87,6 +87,10 @@ void ClusterFeature::collectOptions(std::shared_ptr 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", @@ -100,68 +104,80 @@ void ClusterFeature::collectOptions(std::shared_ptr options) { options->addOption("--cluster.agency-endpoint", "agency endpoint to connect to", - new VectorParameter(&_agencyEndpoints)); + new VectorParameter(&_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 options) { @@ -172,7 +188,7 @@ void ClusterFeature::validateOptions(std::shared_ptr 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(); } diff --git a/arangod/Cluster/MaintenanceFeature.cpp b/arangod/Cluster/MaintenanceFeature.cpp index 8a6f0f8d61f0..d902de9b62ad 100644 --- a/arangod/Cluster/MaintenanceFeature.cpp +++ b/arangod/Cluster/MaintenanceFeature.cpp @@ -104,25 +104,25 @@ void MaintenanceFeature::collectOptions(std::shared_ptr 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 diff --git a/arangod/Cluster/ReplicationTimeoutFeature.cpp b/arangod/Cluster/ReplicationTimeoutFeature.cpp index c917a3268a7e..620a96b1629d 100644 --- a/arangod/Cluster/ReplicationTimeoutFeature.cpp +++ b/arangod/Cluster/ReplicationTimeoutFeature.cpp @@ -59,7 +59,7 @@ void ReplicationTimeoutFeature::collectOptions(std::shared_ptr 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 diff --git a/arangod/GeneralServer/GeneralServerFeature.cpp b/arangod/GeneralServer/GeneralServerFeature.cpp index cbf317a61545..eb1fe459702d 100644 --- a/arangod/GeneralServer/GeneralServerFeature.cpp +++ b/arangod/GeneralServer/GeneralServerFeature.cpp @@ -156,14 +156,14 @@ void GeneralServerFeature::collectOptions(std::shared_ptr 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", diff --git a/arangod/GeneralServer/SslServerFeature.cpp b/arangod/GeneralServer/SslServerFeature.cpp index b16524e1d698..93d0da9b10f7 100644 --- a/arangod/GeneralServer/SslServerFeature.cpp +++ b/arangod/GeneralServer/SslServerFeature.cpp @@ -109,7 +109,7 @@ void SslServerFeature::collectOptions(std::shared_ptr 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", diff --git a/arangod/MMFiles/MMFilesLogfileManager.cpp b/arangod/MMFiles/MMFilesLogfileManager.cpp index 20cb6197f9f8..0c2f7a11448e 100644 --- a/arangod/MMFiles/MMFilesLogfileManager.cpp +++ b/arangod/MMFiles/MMFilesLogfileManager.cpp @@ -165,14 +165,14 @@ void MMFilesLogfileManager::collectOptions(std::shared_ptr optio options->addOption("--wal.allow-oversize-entries", "allow entries that are bigger than '--wal.logfile-size'", new BooleanParameter(&_allowOversizeEntries), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--wal.use-mlock", "mlock WAL logfiles in memory (may require elevated privileges or " "limits)", new BooleanParameter(&_useMLock), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--wal.directory", "logfile directory", new StringParameter(&_directory)); @@ -194,7 +194,7 @@ void MMFilesLogfileManager::collectOptions(std::shared_ptr optio options->addOption("--wal.flush-timeout", "flush timeout (in milliseconds)", new UInt64Parameter(&_flushTimeout), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--wal.logfile-size", "size of each logfile (in bytes)", new UInt32Parameter(&_filesize)); @@ -209,7 +209,7 @@ void MMFilesLogfileManager::collectOptions(std::shared_ptr optio options->addOption("--wal.slots", "number of logfile slots to use", new UInt32Parameter(&_numberOfSlots), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--wal.sync-interval", @@ -221,13 +221,13 @@ void MMFilesLogfileManager::collectOptions(std::shared_ptr optio "throttle writes when at least this many operations are waiting for " "collection (set to 0 to deactivate write-throttling)", new UInt64Parameter(&_throttleWhenPending), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--wal.throttle-wait", "maximum wait time per operation when write-throttled (in milliseconds)", new UInt64Parameter(&_maxThrottleWait), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void MMFilesLogfileManager::validateOptions(std::shared_ptr options) { diff --git a/arangod/MMFiles/MMFilesPersistentIndexFeature.cpp b/arangod/MMFiles/MMFilesPersistentIndexFeature.cpp index 050e79dd1e48..87861942211f 100644 --- a/arangod/MMFiles/MMFilesPersistentIndexFeature.cpp +++ b/arangod/MMFiles/MMFilesPersistentIndexFeature.cpp @@ -86,10 +86,6 @@ MMFilesPersistentIndexFeature::~MMFilesPersistentIndexFeature() { } } -void MMFilesPersistentIndexFeature::collectOptions(std::shared_ptr options) {} - -void MMFilesPersistentIndexFeature::validateOptions(std::shared_ptr options) {} - void MMFilesPersistentIndexFeature::start() { Instance = this; diff --git a/arangod/MMFiles/MMFilesPersistentIndexFeature.h b/arangod/MMFiles/MMFilesPersistentIndexFeature.h index 45f96df2f335..bc0f863230ae 100644 --- a/arangod/MMFiles/MMFilesPersistentIndexFeature.h +++ b/arangod/MMFiles/MMFilesPersistentIndexFeature.h @@ -43,8 +43,6 @@ class MMFilesPersistentIndexFeature final : public application_features::Applica explicit MMFilesPersistentIndexFeature(application_features::ApplicationServer& server); ~MMFilesPersistentIndexFeature(); - void collectOptions(std::shared_ptr) override final; - void validateOptions(std::shared_ptr) override final; void start() override final; void unprepare() override final; @@ -71,4 +69,4 @@ class MMFilesPersistentIndexFeature final : public application_features::Applica } // namespace arangodb -#endif \ No newline at end of file +#endif diff --git a/arangod/Replication/ReplicationFeature.cpp b/arangod/Replication/ReplicationFeature.cpp index b55388107546..51df6bb5645a 100644 --- a/arangod/Replication/ReplicationFeature.cpp +++ b/arangod/Replication/ReplicationFeature.cpp @@ -72,7 +72,7 @@ void ReplicationFeature::collectOptions(std::shared_ptr options) "switch to enable or disable the automatic start " "of replication appliers", new BooleanParameter(&_replicationApplierAutoStart), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addSection("database", "Configure the database"); options->addOldOption("server.disable-replication-applier", @@ -82,7 +82,7 @@ void ReplicationFeature::collectOptions(std::shared_ptr options) options->addOption("--replication.automatic-failover", "Please use `--replication.active-failover` instead", new BooleanParameter(&_enableActiveFailover), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--replication.active-failover", "Enable active-failover during asynchronous replication", new BooleanParameter(&_enableActiveFailover)); @@ -90,7 +90,7 @@ void ReplicationFeature::collectOptions(std::shared_ptr options) options->addOption("--replication.max-parallel-tailing-invocations", "Maximum number of concurrently allowed WAL tailing invocations (0 = unlimited)", new UInt64Parameter(&_maxParallelTailingInvocations), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30500); options->addOption("--replication.connect-timeout", diff --git a/arangod/RestServer/BootstrapFeature.cpp b/arangod/RestServer/BootstrapFeature.cpp index cd8d82380a39..647650f4ce6c 100644 --- a/arangod/RestServer/BootstrapFeature.cpp +++ b/arangod/RestServer/BootstrapFeature.cpp @@ -87,7 +87,7 @@ BootstrapFeature::BootstrapFeature(application_features::ApplicationServer& serv void BootstrapFeature::collectOptions(std::shared_ptr options) { options->addOption("hund", "make ArangoDB bark on startup", new BooleanParameter(&_bark), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } // Local Helper functions diff --git a/arangod/RestServer/CheckVersionFeature.cpp b/arangod/RestServer/CheckVersionFeature.cpp index 3913899a01b6..f650dec3704e 100644 --- a/arangod/RestServer/CheckVersionFeature.cpp +++ b/arangod/RestServer/CheckVersionFeature.cpp @@ -75,7 +75,7 @@ void CheckVersionFeature::collectOptions(std::shared_ptr options options->addOption("--database.check-version", "checks the versions of the database and exit", new BooleanParameter(&_checkVersion), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); } diff --git a/arangod/RestServer/DatabaseFeature.cpp b/arangod/RestServer/DatabaseFeature.cpp index 2532dec70e77..c5dfbcb55dab 100644 --- a/arangod/RestServer/DatabaseFeature.cpp +++ b/arangod/RestServer/DatabaseFeature.cpp @@ -295,25 +295,25 @@ void DatabaseFeature::collectOptions(std::shared_ptr options) { "default wait-for-sync behavior, can be overwritten " "when creating a collection", new BooleanParameter(&_defaultWaitForSync), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--database.force-sync-properties", "force syncing of collection properties to disk, " "will use waitForSync value of collection when " "turned off", new BooleanParameter(&_forceSyncProperties), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--database.ignore-datafile-errors", "load collections even if datafiles may contain errors", new BooleanParameter(&_ignoreDatafileErrors), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--database.throw-collection-not-loaded-error", "throw an error when accessing a collection that is still loading", new AtomicBooleanParameter(&_throwCollectionNotLoadedError), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); // the following option was removed in 3.2 // index-creation is now automatically parallelized via the Boost ASIO thread diff --git a/arangod/RestServer/EndpointFeature.cpp b/arangod/RestServer/EndpointFeature.cpp index 73c6632bbd58..e480eb161b70 100644 --- a/arangod/RestServer/EndpointFeature.cpp +++ b/arangod/RestServer/EndpointFeature.cpp @@ -70,11 +70,11 @@ void EndpointFeature::collectOptions(std::shared_ptr options) { options->addOption("--tcp.reuse-address", "try to reuse TCP port(s)", new BooleanParameter(&_reuseAddress), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--tcp.backlog-size", "listen backlog size", new UInt64Parameter(&_backlogSize), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void EndpointFeature::validateOptions(std::shared_ptr) { diff --git a/arangod/RestServer/FlushFeature.cpp b/arangod/RestServer/FlushFeature.cpp index 8e1097319774..ed889f9eb8cd 100644 --- a/arangod/RestServer/FlushFeature.cpp +++ b/arangod/RestServer/FlushFeature.cpp @@ -73,7 +73,7 @@ void FlushFeature::collectOptions(std::shared_ptr options) { options->addOption("--server.flush-interval", "interval (in microseconds) for flushing data", new UInt64Parameter(&_flushInterval), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void FlushFeature::registerFlushSubscription(const std::shared_ptr& subscription) { diff --git a/arangod/RestServer/FortuneFeature.cpp b/arangod/RestServer/FortuneFeature.cpp index 2e29aa869bad..31baf312d536 100644 --- a/arangod/RestServer/FortuneFeature.cpp +++ b/arangod/RestServer/FortuneFeature.cpp @@ -73,7 +73,7 @@ FortuneFeature::FortuneFeature(application_features::ApplicationServer& server) void FortuneFeature::collectOptions(std::shared_ptr options) { options->addOption("fortune", "show fortune cookie on startup", new BooleanParameter(&_fortune), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void FortuneFeature::start() { diff --git a/arangod/RestServer/FrontendFeature.cpp b/arangod/RestServer/FrontendFeature.cpp index 16fad05abefb..771c60158dc5 100644 --- a/arangod/RestServer/FrontendFeature.cpp +++ b/arangod/RestServer/FrontendFeature.cpp @@ -45,7 +45,7 @@ void FrontendFeature::collectOptions(std::shared_ptr options) { options->addOption("--frontend.version-check", "alert the user if new versions are available", new BooleanParameter(&_versionCheck), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Default, arangodb::options::Flags::Hidden)); } void FrontendFeature::prepare() { diff --git a/arangod/RestServer/InitDatabaseFeature.cpp b/arangod/RestServer/InitDatabaseFeature.cpp index cc9fff538838..410dc41ed903 100644 --- a/arangod/RestServer/InitDatabaseFeature.cpp +++ b/arangod/RestServer/InitDatabaseFeature.cpp @@ -73,18 +73,18 @@ void InitDatabaseFeature::collectOptions(std::shared_ptr options options->addOption("--database.init-database", "initializes an empty database", new BooleanParameter(&_initDatabase), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption("--database.restore-admin", "resets the admin users and sets a new password", new BooleanParameter(&_restoreAdmin), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption("--database.password", "initial password of root user", new StringParameter(&_password), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void InitDatabaseFeature::validateOptions(std::shared_ptr options) { diff --git a/arangod/RestServer/MetricsFeature.cpp b/arangod/RestServer/MetricsFeature.cpp index 5ef7bc84ae16..15f24d4707a5 100644 --- a/arangod/RestServer/MetricsFeature.cpp +++ b/arangod/RestServer/MetricsFeature.cpp @@ -46,11 +46,6 @@ using namespace arangodb::application_features; using namespace arangodb::basics; using namespace arangodb::options; -// ----------------------------------------------------------------------------- -// --SECTION-- global variables -// ----------------------------------------------------------------------------- - - // ----------------------------------------------------------------------------- // --SECTION-- MetricsFeature // ----------------------------------------------------------------------------- @@ -69,7 +64,7 @@ void MetricsFeature::collectOptions(std::shared_ptr options) { options->addOption("--server.export-metrics-api", "turn metrics API on or off", new BooleanParameter(&_export), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30600); } diff --git a/arangod/RestServer/QueryRegistryFeature.cpp b/arangod/RestServer/QueryRegistryFeature.cpp index 6e8da01b8e00..ac87cfee6c35 100644 --- a/arangod/RestServer/QueryRegistryFeature.cpp +++ b/arangod/RestServer/QueryRegistryFeature.cpp @@ -133,12 +133,12 @@ void QueryRegistryFeature::collectOptions(std::shared_ptr option "seconds); if <= 0, value will default to 30 for " "single-server instances or 600 for cluster instances", new DoubleParameter(&_queryRegistryTTL), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--query.smart-joins", "enable smart joins query optimization", new BooleanParameter(&_smartJoins), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Enterprise)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Enterprise)) .setIntroducedIn(30405).setIntroducedIn(30500); } diff --git a/arangod/RestServer/ServerFeature.cpp b/arangod/RestServer/ServerFeature.cpp index b4dfc237c660..10b73e60a364 100644 --- a/arangod/RestServer/ServerFeature.cpp +++ b/arangod/RestServer/ServerFeature.cpp @@ -82,7 +82,7 @@ void ServerFeature::collectOptions(std::shared_ptr options) { options->addOption("--server.rest-server", "start a rest-server", new BooleanParameter(&_restServer), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addObsoleteOption( "--server.session-timeout", @@ -102,7 +102,7 @@ void ServerFeature::collectOptions(std::shared_ptr options) { options->addOption("--console.code-page", "Windows code page to use; defaults to UTF8", new UInt16Parameter(&_codePage), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); #endif } diff --git a/arangod/RestServer/UpgradeFeature.cpp b/arangod/RestServer/UpgradeFeature.cpp index bd83eed44757..f99993592d59 100644 --- a/arangod/RestServer/UpgradeFeature.cpp +++ b/arangod/RestServer/UpgradeFeature.cpp @@ -82,7 +82,7 @@ void UpgradeFeature::collectOptions(std::shared_ptr options) { options->addOption("--database.upgrade-check", "skip a database upgrade", new BooleanParameter(&_upgradeCheck), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } /// @brief This external is buried in RestServer/arangod.cpp. diff --git a/arangod/RocksDBEngine/RocksDBEngine.cpp b/arangod/RocksDBEngine/RocksDBEngine.cpp index e111ffa69c64..5bf6c387fd98 100644 --- a/arangod/RocksDBEngine/RocksDBEngine.cpp +++ b/arangod/RocksDBEngine/RocksDBEngine.cpp @@ -304,7 +304,7 @@ void RocksDBEngine::collectOptions(std::shared_ptr opti "initial timeout after which unused WAL files deletion kicks in after " "server start", new DoubleParameter(&_pruneWaitTimeInitial), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--rocksdb.throttle", "enable write-throttling", new BooleanParameter(&_useThrottle)); @@ -312,18 +312,18 @@ void RocksDBEngine::collectOptions(std::shared_ptr opti options->addOption("--rocksdb.create-sha-files", "enable generation of sha256 files for each .sst file", new BooleanParameter(&_createShaFiles), - arangodb::options::makeFlags(arangodb::options::Flags::Enterprise)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Enterprise)); options->addOption("--rocksdb.debug-logging", "true to enable rocksdb debug logging", new BooleanParameter(&_debugLogging), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--rocksdb.wal-archive-size-limit", "maximum total size (in bytes) of archived WAL files (0 = unlimited)", new UInt64Parameter(&_maxWalArchiveSizeLimit), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); #ifdef USE_ENTERPRISE collectEnterpriseOptions(options); diff --git a/arangod/Scheduler/SchedulerFeature.cpp b/arangod/Scheduler/SchedulerFeature.cpp index 330a4dfa046d..c5325eedaadf 100644 --- a/arangod/Scheduler/SchedulerFeature.cpp +++ b/arangod/Scheduler/SchedulerFeature.cpp @@ -96,12 +96,12 @@ void SchedulerFeature::collectOptions(std::shared_ptr o "= use system-specific default of ") + std::to_string(defaultNumberOfThreads()) + ")", new UInt64Parameter(&_nrMaximalThreads), - arangodb::options::makeFlags(arangodb::options::Flags::Dynamic)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic)); options->addOption("--server.minimal-threads", "minimum number of request handling threads to run", new UInt64Parameter(&_nrMinimalThreads), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--server.maximal-queue-size", "size of the priority 2 fifo", new UInt64Parameter(&_fifo2Size)); @@ -110,11 +110,11 @@ void SchedulerFeature::collectOptions(std::shared_ptr o "--server.scheduler-queue-size", "number of simultaneously queued requests inside the scheduler", new UInt64Parameter(&_queueSize), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--server.prio1-size", "size of the priority 1 fifo", new UInt64Parameter(&_fifo1Size), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); // obsolete options options->addObsoleteOption("--server.threads", "number of threads", true); @@ -123,14 +123,15 @@ void SchedulerFeature::collectOptions(std::shared_ptr o options->addOldOption("scheduler.threads", "server.maximal-threads"); } -void SchedulerFeature::validateOptions(std::shared_ptr) { +void SchedulerFeature::validateOptions(std::shared_ptr options) { auto const N = TRI_numberProcessors(); LOG_TOPIC("2ef39", DEBUG, arangodb::Logger::THREADS) << "Detected number of processors: " << N; TRI_ASSERT(N > 0); - if (_nrMaximalThreads > 8 * N) { + if (options->processingResult().touched("server.maximal-threads") && + _nrMaximalThreads > 8 * N) { LOG_TOPIC("0a92a", WARN, arangodb::Logger::THREADS) << "--server.maximal-threads (" << _nrMaximalThreads << ") is more than eight times the number of cores (" << N diff --git a/arangod/Statistics/StatisticsFeature.cpp b/arangod/Statistics/StatisticsFeature.cpp index 92f9c87fcbc1..5d0dba687835 100644 --- a/arangod/Statistics/StatisticsFeature.cpp +++ b/arangod/Statistics/StatisticsFeature.cpp @@ -165,11 +165,11 @@ void StatisticsFeature::collectOptions(std::shared_ptr options) options->addOption("--server.statistics", "turn statistics gathering on or off", new BooleanParameter(&_statistics), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--server.statistics-history", "turn storing statistics in database on or off", new BooleanParameter(&_statisticsHistory), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30409) .setIntroducedIn(30501); } diff --git a/arangod/StorageEngine/RocksDBOptionFeature.cpp b/arangod/StorageEngine/RocksDBOptionFeature.cpp index f5b652b82f71..8cc450cd6345 100644 --- a/arangod/StorageEngine/RocksDBOptionFeature.cpp +++ b/arangod/StorageEngine/RocksDBOptionFeature.cpp @@ -151,7 +151,7 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr option "--rocksdb.total-write-buffer-size", "maximum total size of in-memory write buffers (0 = unbounded)", new UInt64Parameter(&_totalWriteBufferSize), - arangodb::options::makeFlags(arangodb::options::Flags::Dynamic)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic)); options->addOption("--rocksdb.write-buffer-size", "amount of data to build up in memory before converting " @@ -176,7 +176,7 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr option "have surpassed a certain number of level-0 files and need to slowdown " "writes", new UInt64Parameter(&_delayedWriteRate), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOldOption("rocksdb.delayed_write_rate", "rocksdb.delayed-write-rate"); @@ -232,30 +232,30 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr option "that there are very few misses or the performance in the case of " "misses is not important", new BooleanParameter(&_optimizeFiltersForHits), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); #ifdef __linux__ options->addOption("--rocksdb.use-direct-reads", "use O_DIRECT for reading files", new BooleanParameter(&_useDirectReads), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoOs, arangodb::options::Flags::OsLinux, arangodb::options::Flags::Hidden)); options->addOption("--rocksdb.use-direct-io-for-flush-and-compaction", "use O_DIRECT for flush and compaction", new BooleanParameter(&_useDirectIoForFlushAndCompaction), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoOs, arangodb::options::Flags::OsLinux, arangodb::options::Flags::Hidden)); #endif options->addOption("--rocksdb.use-fsync", "issue an fsync when writing to disk (set to true " "for issuing fdatasync only)", new BooleanParameter(&_useFSync), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--rocksdb.max-background-jobs", "Maximum number of concurrent background jobs (compactions and flushes)", new Int32Parameter(&_maxBackgroundJobs), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Dynamic)); options->addOption("--rocksdb.max-subcompactions", @@ -287,7 +287,7 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr option options->addOption("--rocksdb.block-cache-size", "size of block cache in bytes", new UInt64Parameter(&_blockCacheSize), - arangodb::options::makeFlags(arangodb::options::Flags::Dynamic)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic)); options->addOption( "--rocksdb.block-cache-shard-bits", @@ -306,7 +306,7 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr option options->addOption("--rocksdb.recycle-log-file-num", "if true, keep a pool of log files around for recycling", new BooleanParameter(&_recycleLogFileNum), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--rocksdb.compaction-read-ahead-size", @@ -319,19 +319,19 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr option options->addOption("--rocksdb.use-file-logging", "use a file-base logger for RocksDB's own logs", new BooleanParameter(&_useFileLogging), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--rocksdb.wal-recovery-skip-corrupted", "skip corrupted records in WAL recovery", new BooleanParameter(&_skipCorrupted), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options ->addOption("--rocksdb.limit-open-files-at-startup", "limit the amount of .sst files RocksDB will inspect at " "startup, in order to startup reduce IO", new BooleanParameter(&_limitOpenFilesAtStartup), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30405) .setIntroducedIn(30500); @@ -340,7 +340,7 @@ void RocksDBOptionFeature::collectOptions(std::shared_ptr option "if true, allow RocksDB to use fallocate calls. if false, " "fallocate calls are bypassed", new BooleanParameter(&_allowFAllocate), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30405) .setIntroducedIn(30500); options diff --git a/arangod/V8Server/V8DealerFeature.cpp b/arangod/V8Server/V8DealerFeature.cpp index 83259df18f90..77ef882eab9f 100644 --- a/arangod/V8Server/V8DealerFeature.cpp +++ b/arangod/V8Server/V8DealerFeature.cpp @@ -133,13 +133,13 @@ void V8DealerFeature::collectOptions(std::shared_ptr options) { "--javascript.gc-frequency", "JavaScript time-based garbage collection frequency (each x seconds)", new DoubleParameter(&_gcFrequency), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--javascript.gc-interval", "JavaScript request-based garbage collection interval (each x requests)", new UInt64Parameter(&_gcInterval), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--javascript.app-path", "directory for Foxx applications", new StringParameter(&_appPath)); @@ -152,7 +152,7 @@ void V8DealerFeature::collectOptions(std::shared_ptr options) { options->addOption("--javascript.module-directory", "additional paths containing JavaScript modules", new VectorParameter(&_moduleDirectories), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--javascript.copy-installation", @@ -173,23 +173,23 @@ void V8DealerFeature::collectOptions(std::shared_ptr options) { "--javascript.v8-contexts-max-invocations", "maximum number of invocations for each V8 context before it is disposed", new UInt64Parameter(&_maxContextInvocations), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--javascript.v8-contexts-max-age", "maximum age for each V8 context (in seconds) before it is disposed", new DoubleParameter(&_maxContextAge), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--javascript.allow-admin-execute", "for testing purposes allow '_admin/execute', NEVER enable on production", new BooleanParameter(&_allowAdminExecute), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--javascript.enabled", "enable the V8 JavaScript engine", new BooleanParameter(&_enableJS), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void V8DealerFeature::validateOptions(std::shared_ptr options) { diff --git a/arangosh/Backup/BackupFeature.cpp b/arangosh/Backup/BackupFeature.cpp index be45d728190d..f46ec2fa973f 100644 --- a/arangosh/Backup/BackupFeature.cpp +++ b/arangosh/Backup/BackupFeature.cpp @@ -677,7 +677,7 @@ void BackupFeature::collectOptions(std::shared_ptr opti "operation to perform (may be specified as positional " "argument without '--operation')", new DiscreteValuesParameter(&_options.operation, ::Operations), - static_cast::type>(Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--allow-inconsistent", "whether to attempt to continue in face of errors; " @@ -716,29 +716,34 @@ void BackupFeature::collectOptions(std::shared_ptr opti options->addOption("--status-id", "returns the status of a transfer process " "(upload/download operation)", - new StringParameter(&_options.statusId)); + new StringParameter(&_options.statusId), + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Enterprise, arangodb::options::Flags::Command)); options->addOption("--rclone-config-file", "filename of the Rclone configuration file used for" "file transfer (upload/download operation)", - new StringParameter(&_options.rcloneConfigFile)); + new StringParameter(&_options.rcloneConfigFile), + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Enterprise)); options->addOption("--remote-path", "remote Rclone path of directory used to store or " "receive backups (upload/download operation)", - new StringParameter(&_options.remoteDirectory)); + new StringParameter(&_options.remoteDirectory), + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Enterprise)); options->addOption("--abort", "abort transfer with given status-id " "(upload/download operation)", - new BooleanParameter(&_options.abort)); + new BooleanParameter(&_options.abort), + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Enterprise, arangodb::options::Flags::Command)); options->addOption("--force", "abort transactions if needed to ensure a consistent snapshot. " "This option can destroy the atomicity of your transactions in the " "presence of intermediate commits! Use it with great care and only " "if you really need a consistent backup at all costs (create operation)", - new BooleanParameter(&_options.abortTransactionsIfNeeded)); + new BooleanParameter(&_options.abortTransactionsIfNeeded), + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Enterprise)); #endif /* options->addSection( diff --git a/arangosh/Benchmark/BenchFeature.cpp b/arangosh/Benchmark/BenchFeature.cpp index e42a86a506b0..7f3af5891a30 100644 --- a/arangosh/Benchmark/BenchFeature.cpp +++ b/arangosh/Benchmark/BenchFeature.cpp @@ -104,14 +104,14 @@ void BenchFeature::collectOptions(std::shared_ptr options) { "bucket width, dynamically calculated by default: " "(first measured time * 20) / num-intervals", new DoubleParameter(&_histogramIntervalSize), - arangodb::options::makeFlags(options::Flags::Dynamic)); + arangodb::options::makeDefaultFlags(options::Flags::Dynamic)); options->addOption("--histogram.num-intervals", "number of buckets (resolution)", new UInt64Parameter(&_histogramNumIntervals)); options->addOption("--histogram.percentiles", "which percentiles to calculate", new VectorParameter(&_percentiles), - arangodb::options::makeFlags(options::Flags::FlushOnFirst)); + arangodb::options::makeDefaultFlags(options::Flags::FlushOnFirst)); options->addOption("--async", "send asynchronous requests", new BooleanParameter(&_async)); diff --git a/arangosh/Import/ImportFeature.cpp b/arangosh/Import/ImportFeature.cpp index ad2720281ec7..f395a3a4c2e1 100644 --- a/arangosh/Import/ImportFeature.cpp +++ b/arangosh/Import/ImportFeature.cpp @@ -159,7 +159,7 @@ void ImportFeature::collectOptions(std::shared_ptr opti options->addOption("--separator", "field separator, used for csv and tsv. " "Defaults to a comma (csv) or a tabulation character (tsv)", new StringParameter(&_separator), - arangodb::options::makeFlags(arangodb::options::Flags::Dynamic)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic)); options->addOption("--progress", "show progress", new BooleanParameter(&_progress)); diff --git a/arangosh/Restore/RestoreFeature.cpp b/arangosh/Restore/RestoreFeature.cpp index 9f0aebe9fef3..3634011cb0b6 100644 --- a/arangosh/Restore/RestoreFeature.cpp +++ b/arangosh/Restore/RestoreFeature.cpp @@ -1285,7 +1285,7 @@ void RestoreFeature::collectOptions(std::shared_ptr opt "clean up duplicate attributes (use first specified value) in input " "documents instead of making the restore operation fail", new BooleanParameter(&_options.cleanupDuplicateAttributes), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30322) .setIntroducedIn(30402); @@ -1333,7 +1333,7 @@ void RestoreFeature::collectOptions(std::shared_ptr opt ->addOption("--default-number-of-shards", "default value for numberOfShards if not specified in dump", new UInt64Parameter(&_options.defaultNumberOfShards), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setDeprecatedIn(30322) .setDeprecatedIn(30402); @@ -1342,7 +1342,7 @@ void RestoreFeature::collectOptions(std::shared_ptr opt "--default-replication-factor", "default value for replicationFactor if not specified in dump", new UInt64Parameter(&_options.defaultReplicationFactor), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setDeprecatedIn(30322) .setDeprecatedIn(30402); } diff --git a/arangosh/Shell/ClientFeature.cpp b/arangosh/Shell/ClientFeature.cpp index 658dc4d6364d..c49554198f79 100644 --- a/arangosh/Shell/ClientFeature.cpp +++ b/arangosh/Shell/ClientFeature.cpp @@ -108,7 +108,7 @@ void ClientFeature::collectOptions(std::shared_ptr options) { options->addOption("--server.force-json", "force to not use VelocyPack for easier debugging", new BooleanParameter(&_forceJson), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30600); if (_allowJwtSecret) { @@ -123,7 +123,7 @@ void ClientFeature::collectOptions(std::shared_ptr options) { "connections - even when a new connection to another server is " "created", new BooleanParameter(&_askJwtSecret), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--server.jwt-secret-keyfile", "if this option is specified, the jwt secret will be loaded " @@ -133,7 +133,7 @@ void ClientFeature::collectOptions(std::shared_ptr options) { "connections - even when a new connection to another server is " "created", new StringParameter(&_jwtSecretFile), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } options->addOption("--server.connection-timeout", @@ -149,7 +149,7 @@ void ClientFeature::collectOptions(std::shared_ptr options) { "--server.max-packet-size", "maximum packet size (in bytes) for client/server communication", new UInt64Parameter(&_maxPacketSize), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); std::unordered_set const sslProtocols = availableSslProtocols(); @@ -160,7 +160,7 @@ void ClientFeature::collectOptions(std::shared_ptr options) { options->addOption("--console.code-page", "Windows code page to use; defaults to UTF8", new UInt16Parameter(&_codePage), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoOs, arangodb::options::Flags::OsWindows, arangodb::options::Flags::Hidden)); #endif } diff --git a/arangosh/Shell/ConsoleFeature.cpp b/arangosh/Shell/ConsoleFeature.cpp index 913579138b45..8d97a040c572 100644 --- a/arangosh/Shell/ConsoleFeature.cpp +++ b/arangosh/Shell/ConsoleFeature.cpp @@ -115,7 +115,7 @@ void ConsoleFeature::collectOptions(std::shared_ptr options) { options->addOption("--console.colors", "enable color support", new BooleanParameter(&_colors), - arangodb::options::makeFlags(arangodb::options::Flags::Dynamic)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic)); options->addOption("--console.auto-complete", "enable auto completion", new BooleanParameter(&_autoComplete)); @@ -137,7 +137,7 @@ void ConsoleFeature::collectOptions(std::shared_ptr options) { options->addOption("--console.pager-command", "pager command", new StringParameter(&_pagerCommand), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--console.prompt", diff --git a/arangosh/Shell/V8ShellFeature.cpp b/arangosh/Shell/V8ShellFeature.cpp index 7b043111d5d4..6033c663550f 100644 --- a/arangosh/Shell/V8ShellFeature.cpp +++ b/arangosh/Shell/V8ShellFeature.cpp @@ -97,11 +97,11 @@ void V8ShellFeature::collectOptions(std::shared_ptr options) { options->addOption("--javascript.startup-directory", "startup paths containing the JavaScript files", new StringParameter(&_startupDirectory), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--javascript.client-module", "client module to use at startup", new StringParameter(&_clientModule), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--javascript.copy-directory", @@ -112,7 +112,7 @@ void V8ShellFeature::collectOptions(std::shared_ptr options) { options->addOption("--javascript.module-directory", "additional paths containing JavaScript modules", new VectorParameter(&_moduleDirectories), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--javascript.current-module-directory", "add current directory to module path", diff --git a/lib/ApplicationFeatures/ApplicationServer.cpp b/lib/ApplicationFeatures/ApplicationServer.cpp index 80f2ac84116a..5ec155722545 100644 --- a/lib/ApplicationFeatures/ApplicationServer.cpp +++ b/lib/ApplicationFeatures/ApplicationServer.cpp @@ -293,13 +293,13 @@ void ApplicationServer::collectOptions() { _options->addOption("--dump-dependencies", "dump dependency graph", new BooleanParameter(&_dumpDependencies), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); _options->addOption("--dump-options", "dump configuration options in JSON format", new BooleanParameter(&_dumpOptions), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); apply( diff --git a/lib/ApplicationFeatures/ConfigFeature.cpp b/lib/ApplicationFeatures/ConfigFeature.cpp index f9928c4eb87f..50b7a0a3ef1b 100644 --- a/lib/ApplicationFeatures/ConfigFeature.cpp +++ b/lib/ApplicationFeatures/ConfigFeature.cpp @@ -67,16 +67,16 @@ void ConfigFeature::collectOptions(std::shared_ptr options) { // variable! options->addOption("--config", "the configuration file or 'none'", new StringParameter(&_file), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--define,-D", "define key=value for a @key@ entry in config file", new VectorParameter(&_defines), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--check-configuration", "check the configuration and exit", new BooleanParameter(&_checkConfiguration), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); } diff --git a/lib/ApplicationFeatures/DaemonFeature.cpp b/lib/ApplicationFeatures/DaemonFeature.cpp index 697f059f8933..495364584028 100644 --- a/lib/ApplicationFeatures/DaemonFeature.cpp +++ b/lib/ApplicationFeatures/DaemonFeature.cpp @@ -84,15 +84,15 @@ DaemonFeature::DaemonFeature(application_features::ApplicationServer& server) void DaemonFeature::collectOptions(std::shared_ptr options) { options->addOption("--daemon", "background the server, running it as daemon", new BooleanParameter(&_daemon), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoOs, arangodb::options::Flags::OsLinux, arangodb::options::Flags::OsMac, arangodb::options::Flags::Hidden)); options->addOption("--pid-file", "pid-file in daemon mode", new StringParameter(&_pidFile), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoOs, arangodb::options::Flags::OsLinux, arangodb::options::Flags::OsMac, arangodb::options::Flags::Hidden)); options->addOption("--working-directory", "working directory in daemon mode", new StringParameter(&_workingDirectory), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeFlags(arangodb::options::Flags::DefaultNoOs, arangodb::options::Flags::OsLinux, arangodb::options::Flags::OsMac, arangodb::options::Flags::Hidden)); } void DaemonFeature::validateOptions(std::shared_ptr options) { diff --git a/lib/ApplicationFeatures/LanguageFeature.cpp b/lib/ApplicationFeatures/LanguageFeature.cpp index 3d7b8bcb2a22..0d6a713a0674 100644 --- a/lib/ApplicationFeatures/LanguageFeature.cpp +++ b/lib/ApplicationFeatures/LanguageFeature.cpp @@ -104,7 +104,7 @@ LanguageFeature* LanguageFeature::instance() { return Instance; } void LanguageFeature::collectOptions(std::shared_ptr options) { options->addOption("--default-language", "ISO-639 language code", new StringParameter(&_language), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void* LanguageFeature::prepareIcu(std::string const& binaryPath, diff --git a/lib/ApplicationFeatures/MaxMapCountFeature.cpp b/lib/ApplicationFeatures/MaxMapCountFeature.cpp index de50a7526e85..7ce24a6739a3 100644 --- a/lib/ApplicationFeatures/MaxMapCountFeature.cpp +++ b/lib/ApplicationFeatures/MaxMapCountFeature.cpp @@ -37,14 +37,6 @@ using namespace arangodb; using namespace arangodb::basics; using namespace arangodb::options; -#ifdef __linux__ -// the option is only meaningful on Linux -bool MaxMapCountFeature::_doCheck = true; -#else -// and turned off elsewhere -bool MaxMapCountFeature::_doCheck = false; -#endif - MaxMapCountFeature::MaxMapCountFeature(application_features::ApplicationServer& server) : ApplicationFeature(server, "MaxMapCount") { setOptional(false); @@ -54,16 +46,9 @@ MaxMapCountFeature::MaxMapCountFeature(application_features::ApplicationServer& void MaxMapCountFeature::collectOptions(std::shared_ptr options) { options->addSection("server", "Server Options"); - if (_doCheck) { - options->addOption("--server.check-max-memory-mappings, mappings", - "check the maximum number of memory mappings at runtime", - new BooleanParameter(&_doCheck), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); - } else { - options->addObsoleteOption( - "--server.check-max-memory-mappings", - "check the maximum number of memory mappings at runtime", true); - } + options->addObsoleteOption( + "--server.check-max-memory-mappings", + "check the maximum number of memory mappings at startup", true); } uint64_t MaxMapCountFeature::actualMaxMappings() { @@ -71,37 +56,35 @@ uint64_t MaxMapCountFeature::actualMaxMappings() { // in case we cannot determine the number of max_map_count, we will // assume an effectively unlimited number of mappings - if (needsChecking()) { #ifdef __linux__ - // test max_map_count value in /proc/sys/vm - try { - std::string value = - basics::FileUtils::slurp("/proc/sys/vm/max_map_count"); - - maxMappings = basics::StringUtils::uint64(value); - } catch (...) { - // file not found or values not convertible into integers - } -#endif + // test max_map_count value in /proc/sys/vm + try { + std::string value = + basics::FileUtils::slurp("/proc/sys/vm/max_map_count"); + + maxMappings = basics::StringUtils::uint64(value); + } catch (...) { + // file not found or values not convertible into integers } +#endif return maxMappings; } uint64_t MaxMapCountFeature::minimumExpectedMaxMappings() { - uint64_t expected = 0; - - if (needsChecking()) { - expected = 65530; // Linux kernel default +#ifdef __linux__ + uint64_t expected = 65530; // Linux kernel default - uint64_t nproc = TRI_numberProcessors(); + uint64_t nproc = TRI_numberProcessors(); - // we expect at most 8 times the number of cores as the effective number of - // threads, and we want to allow at least 8000 mmaps per thread - if (nproc * 8 * 8000 > expected) { - expected = nproc * 8 * 8000; - } + // we expect at most 8 times the number of cores as the effective number of + // threads, and we want to allow at least 8000 mmaps per thread + if (nproc * 8 * 8000 > expected) { + expected = nproc * 8 * 8000; } return expected; +#else + return 0; +#endif } diff --git a/lib/ApplicationFeatures/MaxMapCountFeature.h b/lib/ApplicationFeatures/MaxMapCountFeature.h index 65863b08a1a9..5b718e163989 100644 --- a/lib/ApplicationFeatures/MaxMapCountFeature.h +++ b/lib/ApplicationFeatures/MaxMapCountFeature.h @@ -24,6 +24,7 @@ #define ARANGODB_APPLICATION_FEATURES_MAX_MAP_COUNT_FEATURE_H 1 #include "ApplicationFeatures/ApplicationFeature.h" +#include "Basics/Common.h" namespace arangodb { @@ -33,13 +34,16 @@ class MaxMapCountFeature final : public application_features::ApplicationFeature void collectOptions(std::shared_ptr) override final; - static bool needsChecking() { return _doCheck; } + static bool needsChecking() { +#ifdef __linux__ + return true; +#else + return false; +#endif + } static uint64_t actualMaxMappings(); static uint64_t minimumExpectedMaxMappings(); - - private: - static bool _doCheck; }; } // namespace arangodb diff --git a/lib/ApplicationFeatures/PrivilegeFeature.cpp b/lib/ApplicationFeatures/PrivilegeFeature.cpp index 2fd26bc2cf36..182014f1b241 100644 --- a/lib/ApplicationFeatures/PrivilegeFeature.cpp +++ b/lib/ApplicationFeatures/PrivilegeFeature.cpp @@ -68,23 +68,23 @@ void PrivilegeFeature::collectOptions(std::shared_ptr options) { #ifdef ARANGODB_HAVE_SETUID options->addOption("--uid", "switch to user-id after reading config files", new StringParameter(&_uid), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--server.uid", "switch to user-id after reading config files", new StringParameter(&_uid), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); #endif #ifdef ARANGODB_HAVE_SETGID options->addOption("--gid", "switch to group-id after reading config files", new StringParameter(&_gid), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--server.gid", "switch to group-id after reading config files", new StringParameter(&_gid), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); #endif } diff --git a/lib/ApplicationFeatures/SupervisorFeature.cpp b/lib/ApplicationFeatures/SupervisorFeature.cpp index 0995235363b5..a8a1daae3cb3 100644 --- a/lib/ApplicationFeatures/SupervisorFeature.cpp +++ b/lib/ApplicationFeatures/SupervisorFeature.cpp @@ -181,7 +181,7 @@ void SupervisorFeature::collectOptions(std::shared_ptr options) options->addOption("--supervisor", "background the server, starts a supervisor", new BooleanParameter(&_supervisor), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void SupervisorFeature::validateOptions(std::shared_ptr options) { diff --git a/lib/ApplicationFeatures/V8PlatformFeature.cpp b/lib/ApplicationFeatures/V8PlatformFeature.cpp index b83deee8ceee..06303aee9a83 100644 --- a/lib/ApplicationFeatures/V8PlatformFeature.cpp +++ b/lib/ApplicationFeatures/V8PlatformFeature.cpp @@ -164,7 +164,7 @@ void V8PlatformFeature::collectOptions(std::shared_ptr options) options->addOption("--javascript.v8-options", "options to pass to v8", new VectorParameter(&_v8Options), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--javascript.v8-max-heap", "maximal heap size (in MB)", new UInt64Parameter(&_v8MaxHeap)); diff --git a/lib/ApplicationFeatures/V8SecurityFeature.cpp b/lib/ApplicationFeatures/V8SecurityFeature.cpp index a5f380e81ba5..16b79947d764 100644 --- a/lib/ApplicationFeatures/V8SecurityFeature.cpp +++ b/lib/ApplicationFeatures/V8SecurityFeature.cpp @@ -175,7 +175,7 @@ void V8SecurityFeature::collectOptions(std::shared_ptr options) ->addOption("--javascript.allow-port-testing", "allow testing of ports from within JavaScript actions", new BooleanParameter(&_allowPortTesting), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30500); options @@ -183,7 +183,7 @@ void V8SecurityFeature::collectOptions(std::shared_ptr options) "allow execution and control of external processes from " "within JavaScript actions", new BooleanParameter(&_allowProcessControl), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setIntroducedIn(30500); options diff --git a/lib/ApplicationFeatures/VersionFeature.cpp b/lib/ApplicationFeatures/VersionFeature.cpp index 8cc3b9b8b72f..c2866a9e9678 100644 --- a/lib/ApplicationFeatures/VersionFeature.cpp +++ b/lib/ApplicationFeatures/VersionFeature.cpp @@ -43,7 +43,7 @@ VersionFeature::VersionFeature(application_features::ApplicationServer& server) void VersionFeature::collectOptions(std::shared_ptr options) { options->addOption("--version", "reports the version and exits", new BooleanParameter(&_printVersion), - arangodb::options::makeFlags(arangodb::options::Flags::Command)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Command)); } void VersionFeature::validateOptions(std::shared_ptr) { diff --git a/lib/ApplicationFeatures/WindowsServiceFeature.cpp b/lib/ApplicationFeatures/WindowsServiceFeature.cpp index baa4abad6f49..97c79011d10c 100644 --- a/lib/ApplicationFeatures/WindowsServiceFeature.cpp +++ b/lib/ApplicationFeatures/WindowsServiceFeature.cpp @@ -504,19 +504,19 @@ WindowsServiceFeature::WindowsServiceFeature(application_features::ApplicationSe void WindowsServiceFeature::collectOptions(std::shared_ptr options) { options->addOption("--start-service", "used to start as windows service", new BooleanParameter(&_startAsService), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption("--install-service", "used to register a service with windows", new BooleanParameter(&_installService), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption("--uninstall-service", "used to unregister a service with windows", new BooleanParameter(&_unInstallService), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption( @@ -524,33 +524,33 @@ void WindowsServiceFeature::collectOptions(std::shared_ptr optio "specify to ovrerride the protection to uninstall the service of another " "installation", new BooleanParameter(&_forceUninstall), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption("--servicectl-start", "command an already registered service to start", new BooleanParameter(&_startService), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption( "--servicectl-start-wait", "command an already registered service to start and wait till it's up", new BooleanParameter(&_startWaitService), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption("--servicectl-stop", "command an already registered service to stop", new BooleanParameter(&_stopService), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); options->addOption( "--servicectl-stop-wait", "command an already registered service to stop and wait till it's gone", new BooleanParameter(&_stopWaitService), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Command)); } diff --git a/lib/Logger/LoggerFeature.cpp b/lib/Logger/LoggerFeature.cpp index 49215bf82919..d83bb138b49c 100644 --- a/lib/Logger/LoggerFeature.cpp +++ b/lib/Logger/LoggerFeature.cpp @@ -88,14 +88,14 @@ void LoggerFeature::collectOptions(std::shared_ptr options) { options->addOption("--log", "the global or topic-specific log level", new VectorParameter(&_levels), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setDeprecatedIn(30500); options->addSection("log", "Configure the logging"); options->addOption("--log.color", "use colors for TTY logging", new BooleanParameter(&_useColor), - arangodb::options::makeFlags(arangodb::options::Flags::Dynamic)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Dynamic)); options->addOption("--log.escape", "escape characters when logging", new BooleanParameter(&_useEscaped)); @@ -110,12 +110,12 @@ void LoggerFeature::collectOptions(std::shared_ptr options) { options->addOption("--log.use-local-time", "use local timezone instead of UTC", new BooleanParameter(&_useLocalTime), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setDeprecatedIn(30500); options->addOption("--log.use-microtime", "use microtime instead", new BooleanParameter(&_useMicrotime), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setDeprecatedIn(30500); options->addOption("--log.time-format", "time format to use in logs", @@ -144,57 +144,57 @@ void LoggerFeature::collectOptions(std::shared_ptr options) { options->addOption("--log.prefix", "prefix log message with this string", new StringParameter(&_prefix), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--log.file", "shortcut for '--log.output file://'", new StringParameter(&_file), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--log.line-number", "append line number and file name", new BooleanParameter(&_lineNumber), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--log.shorten-filenames", "shorten filenames in log output (use with --log.line-number)", new BooleanParameter(&_shortenFilenames), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--log.thread", "show thread identifier in log message", new BooleanParameter(&_threadId), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--log.thread-name", "show thread name in log message", new BooleanParameter(&_threadName), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--log.performance", "shortcut for '--log.level performance=trace'", new BooleanParameter(&_performance), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)) + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)) .setDeprecatedIn(30500); options->addOption("--log.keep-logrotate", "keep the old log file after receiving a sighup", new BooleanParameter(&_keepLogRotate), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption("--log.foreground-tty", "also log to tty if backgrounded", new BooleanParameter(&_foregroundTty), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden, + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden, arangodb::options::Flags::Dynamic)); options->addOption("--log.force-direct", "do not start a seperate thread for logging", new BooleanParameter(&_forceDirect), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); options->addOption( "--log.request-parameters", "include full URLs and HTTP request parameters in trace logs", new BooleanParameter(&_logRequestParameters), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void LoggerFeature::loadOptions(std::shared_ptr, diff --git a/lib/ProgramOptions/Option.cpp b/lib/ProgramOptions/Option.cpp index 36279f4dcd5b..9e7e5aaad581 100644 --- a/lib/ProgramOptions/Option.cpp +++ b/lib/ProgramOptions/Option.cpp @@ -22,6 +22,8 @@ #include "Option.h" +#include "Basics/Exceptions.h" +#include "Basics/debugging.h" #include "ProgramOptions/Parameters.h" #include @@ -44,6 +46,15 @@ Option::Option(std::string const& value, std::string const& description, shorthand = stripShorthand(name.substr(pos + 1)); name = name.substr(0, pos); } +#ifdef ARANGODB_ENABLE_MAINTAINER_MODE + // at least one OS must be supported + if (!hasFlag(arangodb::options::Flags::OsLinux) && + !hasFlag(arangodb::options::Flags::OsMac) && + !hasFlag(arangodb::options::Flags::OsWindows) && + !hasFlag(arangodb::options::Flags::Obsolete)) { + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, std::string("option ") + value + " needs to be supported on at least one OS"); + } +#endif } void Option::toVPack(VPackBuilder& builder) const { diff --git a/lib/ProgramOptions/Option.h b/lib/ProgramOptions/Option.h index 2bbbe3ac7797..b294014ce0e4 100644 --- a/lib/ProgramOptions/Option.h +++ b/lib/ProgramOptions/Option.h @@ -33,29 +33,59 @@ class Builder; namespace options { /// @brief option flags. these can be bit-ORed to combine multiple flags -enum class Flags : uint8_t { - Normal = 0, // nothing special here - Hidden = 1, // the option is hidden by default, only made visible by - // --help-all or --help-. - Obsolete = 2, // the option is obsolete. setting it does not influence the - // program behavio - Enterprise = 4, // the option is only available in the Enterprise edition - Command = 8, // the option executes a special command, e.g. --version, - // --check-configuration, --dump-options - Dynamic = 16, // the option's default value is dynamic and depends on the - // target host configuration - FlushOnFirst = 32,// when we first see this parameter, we will flush the contents - // of its value before setting it. +enum class Flags : uint16_t { + None = 0, // nothing special here + Hidden = 1, // the option is hidden by default, only made visible by + // --help-all or --help-. + Obsolete = 2, // the option is obsolete. setting it does not influence the + // program behavior + Enterprise = 4, // the option is only available in the Enterprise edition + Command = 8, // the option executes a special command, e.g. --version, + // --check-configuration, --dump-options + Dynamic = 16, // the option's default value is dynamic and depends on the + // target host configuration + FlushOnFirst = 32, // when we first see this parameter, we will flush the contents + // of its default value before setting it. + + // operating systems + OsLinux = 64, // option can be used on Linux + OsWindows = 128, // option can be used on Windows + OsMac = 256, // option can be used on MacOS + + OsAll = OsLinux | OsWindows | OsMac, // option can be used on all OSes (linux + win + mac) + + // components + OnCoordinator = 512, // option can be used on coordinator + OnDBServer = 1024, // option can be used on database server + OnAgent = 2048, // option can be used on agent + + OnCluster = OnCoordinator | OnDBServer | OnAgent, + + OnSingle = 4096, // option can be used on single server + + OnAll = OnCluster | OnSingle, // option can be used everywhere + + // defaults + Default = OsAll | OnAll, // default options + + DefaultNoOs = Default & ~OsAll, // default, but not specifying any OSes + DefaultNoComponents = Default & ~OnAll, // default, but not specifying any components }; static constexpr inline std::underlying_type::type makeFlags() { - return static_cast::type>(Flags::Normal); + return static_cast::type>(Flags::None); } /// @brief helper for building flags template static constexpr inline std::underlying_type::type makeFlags(Flags flag, Args... args) { - return static_cast::type>(flag) + makeFlags(args...); + return (static_cast::type>(flag) | makeFlags(args...)); +} + +template +static constexpr inline std::underlying_type::type makeDefaultFlags(Flags flag, Args... args) { + return (static_cast::type>(Flags::Default) | + static_cast::type>(flag) | makeFlags(args...)); } struct Parameter; @@ -71,7 +101,8 @@ struct Option { void toVPack(arangodb::velocypack::Builder& builder) const; bool hasFlag(Flags flag) const { - return ((static_cast::type>(flag) & flags) != 0); + return (static_cast::type>(flag) & flags) == + static_cast::type>(flag); } // format a version string diff --git a/lib/ProgramOptions/ProgramOptions.cpp b/lib/ProgramOptions/ProgramOptions.cpp index 2b2c1fb32ac7..8b6f7592d83f 100644 --- a/lib/ProgramOptions/ProgramOptions.cpp +++ b/lib/ProgramOptions/ProgramOptions.cpp @@ -128,7 +128,7 @@ VPackBuilder ProgramOptions::toVPack(bool onlyTouched, bool detailed, builder.openObject(); walk( - [&builder, &filter, &detailed](Section const& section, Option const& option) { + [this, &builder, &filter, &detailed](Section const& section, Option const& option) { std::string full(option.fullName()); if (!filter(full)) { @@ -154,6 +154,40 @@ VPackBuilder ProgramOptions::toVPack(bool onlyTouched, bool detailed, VPackValue(section.enterpriseOnly || option.hasFlag(arangodb::options::Flags::Enterprise))); builder.add("requiresValue", VPackValue(option.parameter->requiresValue())); + + // OS support + builder.add("os", VPackValue(VPackValueType::Array)); + if (option.hasFlag(arangodb::options::Flags::OsLinux)) { + builder.add(VPackValue("linux")); + } + if (option.hasFlag(arangodb::options::Flags::OsMac)) { + builder.add(VPackValue("macos")); + } + if (option.hasFlag(arangodb::options::Flags::OsWindows)) { + builder.add(VPackValue("windows")); + } + builder.close(); + + // component support + std::cout << "PROG: " << _progname << std::endl; + if (_progname == "arangod") { + builder.add("component", VPackValue(VPackValueType::Array)); + if (option.hasFlag(arangodb::options::Flags::OnCoordinator)) { + builder.add(VPackValue("coordinator")); + } + if (option.hasFlag(arangodb::options::Flags::OnDBServer)) { + builder.add(VPackValue("dbserver")); + } + if (option.hasFlag(arangodb::options::Flags::OnAgent)) { + builder.add(VPackValue("agent")); + } + if (option.hasFlag(arangodb::options::Flags::OnSingle)) { + builder.add(VPackValue("single")); + } + builder.close(); + } + + // version the option was introduced in (unknown for some older options) builder.add(VPackValue("introducedIn")); if (option.hasIntroducedIn()) { builder.openArray(); @@ -164,6 +198,8 @@ VPackBuilder ProgramOptions::toVPack(bool onlyTouched, bool detailed, } else { builder.add(VPackValue(VPackValueType::Null)); } + + // version the option was deprecated in (not set for still-active options) builder.add(VPackValue("deprecatedIn")); if (option.hasDeprecatedIn()) { builder.openArray(); @@ -174,10 +210,12 @@ VPackBuilder ProgramOptions::toVPack(bool onlyTouched, bool detailed, } else { builder.add(VPackValue(VPackValueType::Null)); } + std::string values = option.parameter->description(); if (!values.empty()) { builder.add("values", VPackValue(values)); } + if (!option.hasFlag(arangodb::options::Flags::Command)) { // command-like options are commands, thus they shouldn't have // a "default" value diff --git a/lib/ProgramOptions/ProgramOptions.h b/lib/ProgramOptions/ProgramOptions.h index 4dd1f3b56ca7..03ba03e0ced9 100644 --- a/lib/ProgramOptions/ProgramOptions.h +++ b/lib/ProgramOptions/ProgramOptions.h @@ -153,7 +153,7 @@ class ProgramOptions { // adds an option to the program options Option& addOption(std::string const& name, std::string const& description, Parameter* parameter, - std::underlying_type::type flags = makeFlags(Flags::Normal)) { + std::underlying_type::type flags = makeFlags(Flags::Default)) { addOption(Option(name, description, parameter, flags)); return getOption(name); } diff --git a/lib/Random/RandomFeature.cpp b/lib/Random/RandomFeature.cpp index 1105f4b2373c..69e67bc7d6f6 100644 --- a/lib/Random/RandomFeature.cpp +++ b/lib/Random/RandomFeature.cpp @@ -55,7 +55,7 @@ void RandomFeature::collectOptions(std::shared_ptr options) { "3 = URANDOM, 4 = COMBINED (not for Windows), 5 = WinCrypt (Windows " "only)", new DiscreteValuesParameter(&_randomGenerator, generators), - arangodb::options::makeFlags(arangodb::options::Flags::Hidden)); + arangodb::options::makeDefaultFlags(arangodb::options::Flags::Hidden)); } void RandomFeature::prepare() { diff --git a/tests/Basics/InifileParserTest.cpp b/tests/Basics/InifileParserTest.cpp index 30c11104bc63..fe370ba4c7d6 100644 --- a/tests/Basics/InifileParserTest.cpp +++ b/tests/Basics/InifileParserTest.cpp @@ -104,11 +104,11 @@ TEST(InifileParserTest, test_options) { options.addOption("--pork.a-string-value-not-set", "bla", new StringParameter(&aStringValueNotSet)); options.addOption("--pork.sounds", "which sounds do pigs make?", new DiscreteValuesVectorParameter(&porkSounds, soundsPorksMake), - arangodb::options::makeFlags(options::Flags::FlushOnFirst)); + arangodb::options::makeDefaultFlags(options::Flags::FlushOnFirst)); options.addOption("--pork.strange-sounds", "which strange sounds do pigs make?", new DiscreteValuesVectorParameter(&strangePorkSounds, soundsPorksMake), - arangodb::options::makeFlags(options::Flags::FlushOnFirst)); + arangodb::options::makeDefaultFlags(options::Flags::FlushOnFirst)); auto contents = R"data(