Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v23.2.x] c/p_balancer: fixed possible overflow of final used ration #19804

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/v/cluster/partition_balancer_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ struct node_disk_space {
double peak_used_ratio() const { return double(used + assigned) / total; }

double final_used_ratio() const {
// it sometimes may happen that the partition replica size on one node
// is out of date with the total used size reported by a node space
// manager. This may lead to an overflow of final used ratio.
if (released >= used + assigned) {
return 0.0;
}

return double(used + assigned - released) / total;
}

Expand Down
Loading