From a13aaa62dfcf45caa8b5571712be2b77ff4a4ccf Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Thu, 14 Jan 2016 12:58:40 +0100 Subject: [PATCH] config: Add 'experimental' switch --- db/config.cc | 7 +++++++ db/config.hh | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/db/config.cc b/db/config.cc index f83a793664..4b0fc6ad84 100644 --- a/db/config.cc +++ b/db/config.cc @@ -30,6 +30,7 @@ #include "core/shared_ptr.hh" #include "core/fstream.hh" #include "core/do_with.hh" +#include "core/print.hh" #include "log.hh" #include @@ -432,3 +433,9 @@ boost::filesystem::path db::config::get_conf_dir() { return confdir; } + +void db::config::check_experimental(const sstring& what) const { + if (!experimental()) { + throw std::runtime_error(sprint("%s is currently disabled. Start Scylla with --experimental=on to enable.", what)); + } +} diff --git a/db/config.hh b/db/config.hh index 612b1a3a1d..b5435e3db9 100644 --- a/db/config.hh +++ b/db/config.hh @@ -102,6 +102,9 @@ public: config(); + // Throws exception if experimental feature is disabled. + void check_experimental(const sstring& what) const; + boost::program_options::options_description get_options_description(); @@ -717,6 +720,7 @@ public: val(ring_delay_ms, uint32_t, 30 * 1000, Used, "Time a node waits to hear from other nodes before joining the ring in milliseconds. Same as -Dcassandra.ring_delay_ms in cassandra.") \ val(developer_mode, bool, false, Used, "Relax environement checks. Setting to true can reduce performance and reliability significantly.") \ val(skip_wait_for_gossip_to_settle, int32_t, -1, Used, "An integer to configure the wait for gossip to settle. -1: wait normally, 0: do not wait at all, n: wait for at most n polls. Same as -Dcassandra.skip_wait_for_gossip_to_settle in cassandra.") \ + val(experimental, bool, false, Used, "Set to true to unlock experimental features.") \ /* done! */ #define _make_value_member(name, type, deflt, status, desc, ...) \ @@ -733,5 +737,4 @@ private: int _dummy; }; - }