Skip to content

Commit

Permalink
c/errc: introduced new error code indicating targeting invalid node
Browse files Browse the repository at this point in the history
Introduced an error code that indicates the node that the request was
sent to is not the one that received it.

Signed-off-by: Michał Maślanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Aug 9, 2024
1 parent 304a084 commit 221a0b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/v/cluster/errc.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ enum class errc : int16_t {
data_migration_already_exists,
data_migration_invalid_resources,
resource_is_being_migrated,
invalid_target_node_id,
};

std::ostream& operator<<(std::ostream& o, errc err);
Expand Down Expand Up @@ -282,6 +283,8 @@ struct errc_category final : public std::error_category {
case errc::resource_is_being_migrated:
return "Requested operation can not be executed as the resource is "
"undergoing data migration";
case errc::invalid_target_node_id:
return "Request was intended for the node with different node id";
}
return "cluster::errc::unknown";
}
Expand Down
2 changes: 2 additions & 0 deletions src/v/cluster/errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ std::ostream& operator<<(std::ostream& o, cluster::errc err) {
return o << "cluster::errc::data_migration_invalid_resources";
case errc::resource_is_being_migrated:
return o << "cluster::errc::resource_is_being_migrated";
case errc::invalid_target_node_id:
return o << "cluster::errc::invalid_target_node_id";
}
}
} // namespace cluster
1 change: 1 addition & 0 deletions src/v/kafka/server/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ constexpr error_code map_topic_error_code(cluster::errc code) {
case cluster::errc::data_migration_already_exists:
case cluster::errc::data_migration_not_exists:
case cluster::errc::data_migration_invalid_resources:
case cluster::errc::invalid_target_node_id:
break;
}
return error_code::unknown_server_error;
Expand Down

0 comments on commit 221a0b7

Please sign in to comment.