system_keyspace, sstable: log local host id in key places

Specifically: when it is generated, when it is loaded from
`system.local`, and when there is a mismatch during sstable
validation; in the latter case log the in-sstable host id also.

Refs #10148

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
Message-Id: <20220301123925.257766-1-michael.livshin@scylladb.com>
This commit is contained in:
Michael Livshin
2022-03-01 14:39:26 +02:00
committed by Botond Dénes
parent c9e06f1246
commit a389cc520b
2 changed files with 7 additions and 1 deletions

View File

@@ -2751,6 +2751,7 @@ future<utils::UUID> system_keyspace::load_local_host_id() {
} else {
auto host_id = msg->one().get_as<utils::UUID>("host_id");
co_await smp::invoke_on_all([host_id] { _local_cache.local()._cached_local_host_id = host_id; });
slogger.info("Loaded local host id: {}", host_id);
co_return host_id;
}
}
@@ -2766,6 +2767,7 @@ future<utils::UUID> system_keyspace::set_local_host_id(utils::UUID host_id) {
// be unrecoverable anyway, so this little infidelity shouldn't
// matter.
co_await smp::invoke_on_all([host_id] { _local_cache.local()._cached_local_host_id = host_id; });
slogger.info("Setting local host id to {}", host_id);
sstring req = format("INSERT INTO system.{} (key, host_id) VALUES (?, ?)", LOCAL);
co_await qctx->execute_cql(req, sstring(LOCAL), host_id);

View File

@@ -1814,7 +1814,11 @@ bool sstable::validate_originating_host_id() const {
return true;
}
return *originating_host_id == local_host_id;
auto ret = *originating_host_id == local_host_id;
if (!ret) {
sstlog.error("Host id {} does not match local host id {} in SSTable: {}", *originating_host_id, local_host_id, get_filename());
}
return ret;
}
future<> sstable::touch_temp_dir() {