mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-23 16:22:15 +00:00
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:
@@ -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())) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user