raft topology: Introduce param-less topology::get_excluded_nodes()

Picks up currently excluded nodes. Will be used during tablet rebuild
on removenode.
This commit is contained in:
Tomasz Grabiec
2024-01-19 20:18:17 +01:00
parent d053c5ef1e
commit d59db94f3c
2 changed files with 23 additions and 0 deletions

View File

@@ -88,6 +88,25 @@ std::optional<request_param> topology::get_request_param(raft::server_id id) con
return std::nullopt;
};
std::unordered_set<raft::server_id> topology::get_excluded_nodes() const {
std::unordered_set<raft::server_id> result;
for (auto& [id, rs] : transition_nodes) {
std::optional<topology_request> req;
auto req_i = requests.find(id);
if (req_i != requests.end()) {
req = req_i->second;
}
if (rs.state == node_state::removing) {
result.insert(id);
}
auto excluded = get_excluded_nodes(id, req, get_request_param(id));
result.insert(excluded.begin(), excluded.end());
}
return result;
}
std::set<sstring> calculate_not_yet_enabled_features(const std::set<sstring>& enabled_features, const auto& supported_features) {
std::set<sstring> to_enable;
bool first = true;

View File

@@ -177,6 +177,10 @@ struct topology {
// Returns false iff we can safely start a new topology change.
bool is_busy() const;
// Returns the set of nodes currently excluded from synchronization-with in the topology.
// Barrier should not wait for those nodes.
std::unordered_set<raft::server_id> get_excluded_nodes() const;
std::optional<request_param> get_request_param(raft::server_id) const;
static raft::server_id parse_replaced_node(const std::optional<request_param>&);
static std::unordered_set<raft::server_id> parse_ignore_nodes(const std::optional<request_param>&);