diff --git a/api/storage_service.cc b/api/storage_service.cc index 2997a0abb6..2c93219e73 100644 --- a/api/storage_service.cc +++ b/api/storage_service.cc @@ -296,7 +296,7 @@ void unset_repair(http_context& ctx, routes& r) { void set_storage_service(http_context& ctx, routes& r, sharded& ss, gms::gossiper& g) { ss::local_hostid.set(r, [](std::unique_ptr req) { - return db::system_keyspace::get_local_host_id().then([](const utils::UUID& id) { + return db::system_keyspace::load_local_host_id().then([](const utils::UUID& id) { return make_ready_future(id.to_sstring()); }); }); diff --git a/db/system_distributed_keyspace.cc b/db/system_distributed_keyspace.cc index 229115b396..b27b7e1759 100644 --- a/db/system_distributed_keyspace.cc +++ b/db/system_distributed_keyspace.cc @@ -299,7 +299,7 @@ future> system_distributed_keyspace::vi } future<> system_distributed_keyspace::start_view_build(sstring ks_name, sstring view_name) const { - return db::system_keyspace::get_local_host_id().then([this, ks_name = std::move(ks_name), view_name = std::move(view_name)] (utils::UUID host_id) { + return db::system_keyspace::load_local_host_id().then([this, ks_name = std::move(ks_name), view_name = std::move(view_name)] (utils::UUID host_id) { return _qp.execute_internal( format("INSERT INTO {}.{} (keyspace_name, view_name, host_id, status) VALUES (?, ?, ?, ?)", NAME, VIEW_BUILD_STATUS), db::consistency_level::ONE, @@ -310,7 +310,7 @@ future<> system_distributed_keyspace::start_view_build(sstring ks_name, sstring } future<> system_distributed_keyspace::finish_view_build(sstring ks_name, sstring view_name) const { - return db::system_keyspace::get_local_host_id().then([this, ks_name = std::move(ks_name), view_name = std::move(view_name)] (utils::UUID host_id) { + return db::system_keyspace::load_local_host_id().then([this, ks_name = std::move(ks_name), view_name = std::move(view_name)] (utils::UUID host_id) { return _qp.execute_internal( format("UPDATE {}.{} SET status = ? WHERE keyspace_name = ? AND view_name = ? AND host_id = ?", NAME, VIEW_BUILD_STATUS), db::consistency_level::ONE, diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index 18b99ea77d..aee5bea94c 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -2039,7 +2039,7 @@ future<> system_keyspace::make(database& db, service::storage_service& ss) { return system_keyspace_make(db, ss); } -future system_keyspace::get_local_host_id() { +future system_keyspace::load_local_host_id() { sstring req = format("SELECT host_id FROM system.{} WHERE key=?", LOCAL); auto msg = co_await qctx->execute_cql(req, sstring(LOCAL)); if (msg->empty() || !msg->one().has("host_id")) { diff --git a/db/system_keyspace.hh b/db/system_keyspace.hh index b72a2e4686..083c88a799 100644 --- a/db/system_keyspace.hh +++ b/db/system_keyspace.hh @@ -363,7 +363,7 @@ public: * Read the host ID from the system keyspace, creating (and storing) one if * none exists. */ - static future get_local_host_id(); + static future load_local_host_id(); /** * Sets the local host ID explicitly. Should only be called outside of SystemTable when replacing a node. diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index d3a2239159..3ba00bf8e6 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -5339,7 +5339,7 @@ future storage_proxy::create_hint_sync_point(const std::v db::hints::sync_point spoint; spoint.regular_per_shard_rps.resize(smp::count); spoint.mv_per_shard_rps.resize(smp::count); - spoint.host_id = co_await db::system_keyspace::get_local_host_id(); + spoint.host_id = co_await db::system_keyspace::load_local_host_id(); co_await parallel_for_each(boost::irange(0, smp::count), [this, &target_hosts, &spoint] (unsigned shard) { const auto& sharded_sp = container(); // sharded::invoke_on does not have a const-method version, so we cannot use it here @@ -5357,7 +5357,7 @@ future storage_proxy::create_hint_sync_point(const std::v } future<> storage_proxy::wait_for_hint_sync_point(const db::hints::sync_point spoint, clock_type::time_point deadline) { - const utils::UUID my_host_id = co_await db::system_keyspace::get_local_host_id(); + const utils::UUID my_host_id = co_await db::system_keyspace::load_local_host_id(); if (spoint.host_id != my_host_id) { throw std::runtime_error(format("The hint sync point was created on another node, with host ID {}. This node's host ID is {}", spoint.host_id, my_host_id)); diff --git a/service/storage_service.cc b/service/storage_service.cc index abb8f3f31c..00d216c24d 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -340,7 +340,7 @@ void storage_service::prepare_to_join( // for bootstrap to get the load info it needs. // (we won't be part of the storage ring though until we add a counterId to our state, below.) // Seed the host ID-to-endpoint map with our own ID. - auto local_host_id = db::system_keyspace::get_local_host_id().get0(); + auto local_host_id = db::system_keyspace::load_local_host_id().get0(); _db.invoke_on_all([local_host_id] (auto& db) { db.set_local_id(local_host_id); }).get();