code: Rename get_local_host_id() into load_...()

There will appear the future-less method which better deserves
the get_ prefix, so give the existing method the load_ one.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2021-09-30 09:58:05 +03:00
parent e49dc4ed0d
commit beb345c00a
6 changed files with 8 additions and 8 deletions

View File

@@ -296,7 +296,7 @@ void unset_repair(http_context& ctx, routes& r) {
void set_storage_service(http_context& ctx, routes& r, sharded<service::storage_service>& ss, gms::gossiper& g) {
ss::local_hostid.set(r, [](std::unique_ptr<request> 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<json::json_return_type>(id.to_sstring());
});
});

View File

@@ -299,7 +299,7 @@ future<std::unordered_map<utils::UUID, sstring>> 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,

View File

@@ -2039,7 +2039,7 @@ future<> system_keyspace::make(database& db, service::storage_service& ss) {
return system_keyspace_make(db, ss);
}
future<utils::UUID> system_keyspace::get_local_host_id() {
future<utils::UUID> 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")) {

View File

@@ -363,7 +363,7 @@ public:
* Read the host ID from the system keyspace, creating (and storing) one if
* none exists.
*/
static future<utils::UUID> get_local_host_id();
static future<utils::UUID> load_local_host_id();
/**
* Sets the local host ID explicitly. Should only be called outside of SystemTable when replacing a node.

View File

@@ -5339,7 +5339,7 @@ future<db::hints::sync_point> 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<unsigned>(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<db::hints::sync_point> 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));

View File

@@ -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();