Skip to content

Commit

Permalink
c/health: added target node id to get_node_health_request
Browse files Browse the repository at this point in the history
Added a field indicating what node the request was targeted to. If
present the `target_node_id` will be validated when processing the
request.

Signed-off-by: Michał Maślanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Aug 9, 2024
1 parent c514c9e commit 7886aec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/v/cluster/health_monitor_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ std::ostream& operator<<(std::ostream& o, const partitions_filter& filter) {
return o;
}

std::ostream& operator<<(std::ostream& o, const get_node_health_request&) {
fmt::print(o, "{{}}");
std::ostream& operator<<(std::ostream& o, const get_node_health_request& r) {
fmt::print(o, "{{target_node_id: {}}}", r.get_target_node_id());
return o;
}

Expand Down
12 changes: 10 additions & 2 deletions src/v/cluster/health_monitor_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,13 @@ using force_refresh = ss::bool_class<struct hm_force_refresh_tag>;
class get_node_health_request
: public serde::envelope<
get_node_health_request,
serde::version<0>,
serde::version<1>,
serde::compat_version<0>> {
public:
using rpc_adl_exempt = std::true_type;
get_node_health_request() = default;
explicit get_node_health_request(model::node_id target_node_id)
: _target_node_id(target_node_id) {}

friend bool
operator==(const get_node_health_request&, const get_node_health_request&)
Expand All @@ -460,9 +463,14 @@ class get_node_health_request
friend std::ostream&
operator<<(std::ostream&, const get_node_health_request&);

auto serde_fields() { return std::tie(_filter); }
auto serde_fields() { return std::tie(_filter, _target_node_id); }
static constexpr model::node_id node_id_not_set{-1};

model::node_id get_target_node_id() const { return _target_node_id; }

private:
// default value for backward compatibility
model::node_id _target_node_id = node_id_not_set;
/**
* This field is no longer used, as it never was. It was made private on
* purpose
Expand Down

0 comments on commit 7886aec

Please sign in to comment.