gms: gossiper: Make convict() public and safe to call from any scheduling group

Make gossiper::convict() public so that it can be called from external
contexts (e.g. REST API handlers). Add co_await coroutine::switch_to()
at entry to ensure it always runs on the gossip scheduling group,
regardless of which scheduling group the caller is on.

This is needed because convict() accesses gossiper state that must be
manipulated on the gossip scheduling group.
This commit is contained in:
Tomasz Grabiec
2026-05-07 14:32:49 +02:00
parent e57027bb9d
commit 35808b4f4e
2 changed files with 6 additions and 5 deletions

View File

@@ -1208,6 +1208,7 @@ int64_t gossiper::get_endpoint_downtime(locator::host_id ep) const noexcept {
// - on_dead callbacks
// It is called from failure_detector
future<> gossiper::convict(locator::host_id endpoint) {
co_await coroutine::switch_to(_gcfg.gossip_scheduling_group);
auto permit = co_await lock_endpoint(endpoint, null_permit_id);
auto state = get_endpoint_state_ptr(endpoint);
if (!state || !is_alive(state->get_host_id())) {

View File

@@ -299,11 +299,6 @@ public:
version_type get_max_endpoint_state_version(const endpoint_state& state) const noexcept;
private:
/**
* @param endpoint end point that is convicted.
*/
future<> convict(locator::host_id endpoint);
/**
* Removes the endpoint from gossip completely
*
@@ -319,6 +314,11 @@ public:
future<> remove_endpoint(locator::host_id endpoint, permit_id);
// Returns true if an endpoint was removed
future<> force_remove_endpoint(locator::host_id id, permit_id);
/**
* @param endpoint endpoint that is convicted.
*/
future<> convict(locator::host_id endpoint);
private:
/**
* The gossip digest is built based on randomization