Keep PG count when optimize_change drops PGs instead of moving them #178

Open
koolkhel wants to merge 3 commits from koolkhel/vitastor:mon-keep-pg-count into master

3 Commits

Author SHA1 Message Date
5cf776364e Solve with the PG count kept first in optimize_change
Add the PG count condition to the first solve and solve without it only
when that is infeasible, instead of re-solving after a solution that
lost PGs. Return the fallback as over_share and print it with the pool's
change stats: pools are optimized concurrently, so a separate log line
can't be matched to its pool. Bound the data movement in the test and
add a case where the PG count can't be kept.
2026-11-26 14:36:40 +03:00
f3436a5ab4 Log when optimize_change can't keep the PG count
When the PG count can't be kept within OSD sizes (failure domains too
unequal for pg_count PGs at their shares), the first solution is kept
and some OSDs get more than their share. Say so instead of keeping it
silently.
2026-11-25 02:42:14 +03:00
c910ca7068 Keep PG count when optimize_change drops PGs instead of moving them
The LP in optimize_change() has no constraint on the total PG count,
and make_int_pgs() scales whatever is left back to pg_count. In an EC
pool (ordered) a moved PG costs 2 or more, so the LP may prefer to drop
PGs from overloaded failure domains rather than move them. The rest are
then scaled back onto the same domains: a host returning to an EC 4+2
pool on 7 hosts keeps 0 PGs and the pool stays at 6/7 efficiency, and a
host leaving an EC 8+2 pool on 12 hosts leaves another host empty.

If the solution loses PGs, solve again with the PG count fixed, and
keep the first solution when that is infeasible.
2026-11-24 23:04:35 +03:00