From 35808b4f4eab2e36b49743b696ba6a1f997ceecf Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Thu, 7 May 2026 14:32:49 +0200 Subject: [PATCH] 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. --- gms/gossiper.cc | 1 + gms/gossiper.hh | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gms/gossiper.cc b/gms/gossiper.cc index be962b641e..a9ab070e8f 100644 --- a/gms/gossiper.cc +++ b/gms/gossiper.cc @@ -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())) { diff --git a/gms/gossiper.hh b/gms/gossiper.hh index 9f128beffb..6cd4684abe 100644 --- a/gms/gossiper.hh +++ b/gms/gossiper.hh @@ -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