Files
seaweedfs/weed/worker/tasks/ec_balance
Chris LuandClaude Opus 5.5 55a4a5974c ec_balance: make the per-rack cap on global moves a worker setting (#12478)
* ec_balance: make the per-rack cap on global moves a worker setting

The global load-balancing phase planned at most 10 moves per rack per
detection run, hard-coded. On a cluster where one disk per machine holds
several times its siblings' shards, that is about 20 moves an hour against
tens of thousands needed, however many moves the worker can execute.

Add global_max_moves_per_rack to the plugin worker config. The default stays
10, so nothing changes unless it is raised. It is clamped to 1..5000 because
the planner reads 0 as unlimited and would plan a whole drain in one run.

Claude-Session: https://claude.ai/code/session_011UpvafcfUuC2mLxNAXLQJi

* ec_balance: clamp global_max_moves_per_rack before narrowing it to int

A value past the int32 range made ReadIntConfig return the default, so a
request asking for more than the maximum got 10 moves instead of 5000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ec_balance: test the configured global cap through Detection

The helper test still passed if Detection handed the planner a literal cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ec_balance: plan no more global moves per rack than the detection keeps

Each global move scans the source node's volumes, and the detection keeps
at most max_results moves. With the cap at 5000, three skewed racks of
20,000 volumes planned 15,000 moves to keep 500, taking about 70 s of the
300 s detection budget; bounded by max_results it takes about 5 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ec_balance: test the configured global cap with a result limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 16:01:12 -08:00
..