mon: Keep positions of surviving OSDs in EC PGs on re-layout #214
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:mon-keep-ec-positions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
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 (the combinator sorts them, onlyoptimize_initial()rotates them inmake_int_pgs), 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 (so they never become primary). This keeps the positions of the OSDs that stay and puts new ones into the vacated positions, rotated by PG number asoptimize_initial()does. Replicated pools (orderedfalse) and pg_size changes are not touched. The previous set's members are mapped to their positions once per PG and placed once, and only the new items are tried over rotations; a member may hold several positions, since folded failure domains can repeat in a set (previous sets of a host-out re-layout do contain repeated hosts). The new order is used only if it passes the pool's placement rules, so positional rules likehost=112233keep their order. This is the round robin after the LP discussed in Telegram.Model with the monitor code, 12 hosts x 48 OSDs, EC 8+2, 2048 PGs (chunk moves, before -> after):
On the real (fully host-ordered) PG map of such a cluster: one host out 5830 -> 2875 chunk moves, back 7192 -> 3096, reweight to 0.5 5414 -> 2104, host added 9447 -> 4105. Moves are still 1.6-2.4x the chunks that really have to move, because of which sets the LP chooses (
calc_intersect_weightscosts positions against sorted combinations,align_pgslooks at 3 positions); that is a separate change. Note: folded host ids start above the highest in-tree OSD id (fold.js), while out OSDs stay as raw ids in prev sets, so the two can coincide; the position map instead ofincludes()keeps that from duplicating a host.Sets in host order after these events: 83-100 % before, 1-7 % after.
Found: seen on a cluster: every PG of a 12-host EC 8+2 pool was in host order and the last two hosts held only parity chunks; the cause was then found in the code and reproduced with the monitor code.
Tested:
node mon/lp_optimizer/test-optimize-simple.js, new cases "remove host 6" (fails without the change: "Surviving OSDs keep their positions failed"), previous sets given as numbers, and 7 hosts losing two (a new host and NO_OSD per PG, rotated over the vacated positions). Note: the existing case "Change size to 2, ordered" of that file already fails on master (11 moved, expected < 8), andrun().catch(console.error)hides it; the new case is placed before it so it runs.node mon/lp_optimizer/test-optimize-fold.js: ahost=112233pool losing two hosts (repeated folded hosts; fails without the rule check). Othermon/lp_optimizer/test-*.jsunchanged.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
ba582e83dftod6a153abad