diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index 51ac4a79b2..e0f31a4c51 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -43,6 +43,7 @@ #include "partition_slice_builder.hh" #include "db/config.hh" #include "schema_builder.hh" +#include using days = std::chrono::duration>; @@ -728,13 +729,16 @@ bootstrap_state get_bootstrap_state() { } future<> set_bootstrap_state(bootstrap_state state) { -#if 0 - sstring req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%s')"; - return execute_cql(req, LOCAL, LOCAL, state.name()).discard_result().then([] { + static sstring state_name = std::unordered_map>({ + { bootstrap_state::NEEDS_BOOTSTRAP, "NEEDS_BOOTSTRAP" }, + { bootstrap_state::COMPLETED, "COMPLETED" }, + { bootstrap_state::IN_PROGRESS, "IN_PROGRESS" } + }).at(state); + + sstring req = "INSERT INTO system.%s (key, bootstrapped) VALUES (?, ?)"; + return execute_cql(req, LOCAL, sstring(LOCAL), state_name).discard_result().then([] { return force_blocking_flush(LOCAL); }); -#endif - return make_ready_future<>(); } std::vector all_tables() {