everywhere: define locator::host_id as a strong tagged_uuid type

So it can be distinguished from other uuid-based
identifiers in the system.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes #11276
This commit is contained in:
Benny Halevy
2022-08-10 20:22:18 +03:00
committed by Botond Dénes
parent 69aea59d97
commit d295d8e280
33 changed files with 156 additions and 95 deletions

View File

@@ -58,6 +58,7 @@
#include "readers/from_fragments_v2.hh"
#include "readers/evictable.hh"
#include "delete_ghost_rows_visitor.hh"
#include "locator/host_id.hh"
using namespace std::chrono_literals;
@@ -1721,10 +1722,10 @@ future<> view_builder::calculate_shard_build_step(view_builder_init_state& vbi)
future<std::unordered_map<sstring, sstring>>
view_builder::view_build_statuses(sstring keyspace, sstring view_name) const {
return _sys_dist_ks.view_status(std::move(keyspace), std::move(view_name)).then([this] (std::unordered_map<utils::UUID, sstring> status) {
return _sys_dist_ks.view_status(std::move(keyspace), std::move(view_name)).then([this] (std::unordered_map<locator::host_id, sstring> status) {
auto& endpoint_to_host_id = service::get_local_storage_proxy().get_token_metadata_ptr()->get_endpoint_to_host_id_map_for_reading();
return boost::copy_range<std::unordered_map<sstring, sstring>>(endpoint_to_host_id
| boost::adaptors::transformed([&status] (const std::pair<gms::inet_address, utils::UUID>& p) {
| boost::adaptors::transformed([&status] (const std::pair<gms::inet_address, locator::host_id>& p) {
auto it = status.find(p.second);
auto s = it != status.end() ? std::move(it->second) : "UNKNOWN";
return std::pair(p.first.to_sstring(), std::move(s));
@@ -2147,7 +2148,7 @@ update_backlog node_update_backlog::add_fetch(unsigned shard, update_backlog bac
}
future<bool> check_view_build_ongoing(db::system_distributed_keyspace& sys_dist_ks, const sstring& ks_name, const sstring& cf_name) {
return sys_dist_ks.view_status(ks_name, cf_name).then([] (std::unordered_map<utils::UUID, sstring>&& view_statuses) {
return sys_dist_ks.view_status(ks_name, cf_name).then([] (std::unordered_map<locator::host_id, sstring>&& view_statuses) {
return boost::algorithm::any_of(view_statuses | boost::adaptors::map_values, [] (const sstring& view_status) {
return view_status == "STARTED";
});