hints: move id to ip translation into store_hint() function

Also use gossiper to translate instead of token_metadata since we want
to get rid of ip base APIs there.
This commit is contained in:
Gleb Natapov
2024-12-25 17:24:20 +02:00
parent c7d08fe1fe
commit ae8dc595e1
3 changed files with 5 additions and 6 deletions

View File

@@ -430,9 +430,10 @@ bool manager::have_ep_manager(const std::variant<locator::host_id, gms::inet_add
return _hint_directory_manager.has_mapping(std::get<gms::inet_address>(ep));
}
bool manager::store_hint(endpoint_id host_id, gms::inet_address ip, schema_ptr s, lw_shared_ptr<const frozen_mutation> fm,
bool manager::store_hint(endpoint_id host_id, schema_ptr s, lw_shared_ptr<const frozen_mutation> fm,
tracing::trace_state_ptr tr_state) noexcept
{
auto ip = _gossiper_anchor->get_address_map().get(host_id);
if (utils::get_local_injector().enter("reject_incoming_hints")) {
manager_logger.debug("Rejecting a hint to {} / {} due to an error injection", host_id, ip);
++_stats.dropped;

View File

@@ -171,7 +171,7 @@ public:
void register_metrics(const sstring& group_name);
future<> start(shared_ptr<const gms::gossiper> gossiper_ptr);
future<> stop();
bool store_hint(endpoint_id host_id, gms::inet_address ip, schema_ptr s, lw_shared_ptr<const frozen_mutation> fm,
bool store_hint(endpoint_id host_id, schema_ptr s, lw_shared_ptr<const frozen_mutation> fm,
tracing::trace_state_ptr tr_state) noexcept;
/// \brief Changes the host_filter currently used, stopping and starting endpoint_managers relevant to the new host_filter.

View File

@@ -1244,8 +1244,7 @@ public:
tracing::trace_state_ptr tr_state) override {
auto m = _mutations[hid];
if (m) {
const auto ep = ermptr->get_token_metadata().get_endpoint_for_host_id(hid);
return hm.store_hint(hid, ep, _schema, std::move(m), tr_state);
return hm.store_hint(hid, _schema, std::move(m), tr_state);
} else {
return false;
}
@@ -1303,8 +1302,7 @@ public:
}
virtual bool store_hint(db::hints::manager& hm, locator::host_id hid, locator::effective_replication_map_ptr ermptr,
tracing::trace_state_ptr tr_state) override {
const auto ep = ermptr->get_token_metadata().get_endpoint_for_host_id(hid);
return hm.store_hint(hid, ep, _schema, _mutation, tr_state);
return hm.store_hint(hid, _schema, _mutation, tr_state);
}
virtual future<> apply_locally(storage_proxy& sp, storage_proxy::clock_type::time_point timeout,
tracing::trace_state_ptr tr_state, db::per_partition_rate_limit::info rate_limit_info,