Skip to content

Commit

Permalink
Merge pull request #19805 from vbotbuildovich/backport-pr-19794-v23.3…
Browse files Browse the repository at this point in the history
….x-395

[v23.3.x] c/p_balancer: fixed possible overflow of final used ration
  • Loading branch information
mmaslankaprv authored Jun 12, 2024
2 parents a352352 + c7cde1f commit 37a4875
Showing 1 changed file with 7 additions and 0 deletions.
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 @@ -45,6 +45,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

0 comments on commit 37a4875

Please sign in to comment.