mon: Keep positions of surviving OSDs in EC PGs on re-layout #214

Merged
vitalif merged 7 commits from koolkhel/vitastor:mon-keep-ec-positions into master 2026-12-02 19:51:58 +03:00

7 Commits

Author SHA1 Message Date
70961008d8 mon: Move EC position keeping into align_positions()
Make the ordered pass of optimize_change() a function next to
align_pgs(), collect the previous positions with a plain for loop, and
move the new test cases into their own functions.
2026-12-02 19:37:32 +03:00
d6a153abad mon: Place kept EC positions once per PG
Build the map of the previous set's members once per PG, place them at
their old positions once, and try only the new items over rotations,
inline in optimize_change() instead of keep_positions() per rotation.
The result is the same. Test the rotation of two new items per PG
(a new host and NO_OSD) and numeric previous sets via optimize_change().
2026-12-02 19:07:04 +03:00
a2ca454add mon: Return the optimizer's items when keeping EC positions
Previous sets read from etcd may hold OSD numbers as JSON numbers, for
example after vitastor-cli rm-osd rewrote them, while the optimizer
returns strings. keep_positions() returned the previous set's items, so
new sets mixed both types and strict comparisons with the stored primary
(includes() in pick_primary) failed for surviving OSDs. Return the new
set's own items instead.
2026-12-02 19:05:43 +03:00
f04e276d54 mon: Keep EC positions in undersized PGs and under positional rules
Sets with NO_OSD never pass check_combinations, so surviving OSDs of
undersized PGs did not keep their positions at all; accept the kept
order when the optimizer's own set fails the check too. A rotation of
the new items may break a positional rule: try the other rotations
before falling back to the optimizer's order.
2026-12-02 19:05:43 +03:00
e64e234f3a mon: Test keep_positions with two new OSDs per PG
Remove two hosts in the ordered keep-positions test, so that some PGs
get two new OSDs and the rotation of new items runs, and check that
every new set is complete.
2026-12-02 19:05:43 +03:00
408165042a mon: Handle repeated items and placement rules when keeping EC positions
Folded failure domains may repeat in a set, so match the previous set by
counts, not by presence: otherwise a repeated item could be kept twice
and another one dropped. Keep the new order only if it still passes the
pool's placement rules, else use the optimizer's order, so positional
rules like host=112233 are not broken by the rotation.
2026-12-02 19:05:43 +03:00
66b295f94f mon: Keep positions of surviving OSDs in EC PGs on re-layout
In EC pools the position of an OSD in a PG is the number of the chunk
it holds. optimize_change() takes changed sets from sorted combinations,
so every changed PG came back sorted: OSDs that stayed in the PG changed
positions and their chunks moved too, and after a few re-layouts the
last hosts held only parity chunks. Keep the positions of the OSDs that
stay and put new ones into the vacated positions, rotated by PG number
as optimize_initial() does.
2026-12-02 19:05:43 +03:00