diff --git a/dht/boot_strapper.hh b/dht/boot_strapper.hh index 55c29b5e08..65a7b215ad 100644 --- a/dht/boot_strapper.hh +++ b/dht/boot_strapper.hh @@ -23,6 +23,8 @@ #include "locator/token_metadata.hh" #include "dht/i_partitioner.hh" #include +#include "database.hh" +#include "db/config.hh" namespace dht { @@ -77,7 +79,7 @@ public: * otherwise, if num_tokens == 1, pick a token to assume half the load of the most-loaded node. * else choose num_tokens tokens at random */ - static std::unordered_set get_bootstrap_tokens(token_metadata metadata) { + static std::unordered_set get_bootstrap_tokens(token_metadata metadata, database& db) { #if 0 Collection initialTokens = DatabaseDescriptor.getInitialTokens(); // if user specified tokens, use those @@ -95,8 +97,7 @@ public: return tokens; } #endif - // FIXME: DatabaseDescriptor.getNumTokens(); - size_t num_tokens = 3; + size_t num_tokens = db.get_config().num_tokens(); if (num_tokens < 1) { throw std::runtime_error("num_tokens must be >= 1"); } diff --git a/main.cc b/main.cc index e2d0db8fb3..b9f71fac2e 100644 --- a/main.cc +++ b/main.cc @@ -80,7 +80,7 @@ int main(int ac, char** av) { ("api-dir", bpo::value()->default_value("swagger-ui/dist/"), "The directory location of the API GUI") // TODO : default, always read? - ("options-file", bpo::value(), "cassandra.yaml file to read options from") + ("options-file", bpo::value()->default_value("conf/scylla.yaml"), "scylla.yaml file to read options from") ("help-loggers", bpo::bool_switch(&help_loggers), "print a list of logger names and exit") ; diff --git a/service/storage_service.cc b/service/storage_service.cc index 3969707fa6..0cd329d09c 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -221,7 +221,7 @@ future<> storage_service::join_token_ring(int delay) { throw std::runtime_error("This node is already a member of the token ring; bootstrap aborted. (If replacing a dead node, remove the old one from the ring first.)"); } set_mode(mode::JOINING, "getting bootstrap token", true); - _bootstrap_tokens = boot_strapper::get_bootstrap_tokens(_token_metadata); + _bootstrap_tokens = boot_strapper::get_bootstrap_tokens(_token_metadata, _db.local()); } else { auto replace_addr = get_replace_address(); if (replace_addr && *replace_addr != get_broadcast_address()) { @@ -256,8 +256,7 @@ future<> storage_service::join_token_ring(int delay) { // FIXME: _is_bootstrap_mode is set to fasle in BootStrapper::bootstrap // assert(!_is_bootstrap_mode); // bootstrap will block until finished } else { - // FIXME: DatabaseDescriptor.getNumTokens() - size_t num_tokens = 3; + size_t num_tokens = _db.local().get_config().num_tokens(); _bootstrap_tokens = boot_strapper::get_random_tokens(_token_metadata, num_tokens); logger.info("Generated random tokens. tokens are {}", _bootstrap_tokens); #if 0