fix(pools): do not panic when a rebalance stop finds no rebalance metadata

Signed-off-by: Denis Babchuk <babchukdenis@icloud.com>
This commit is contained in:
Denis Babchuk
2026-11-02 00:15:04 +03:00
committed by Feng Ruohang
parent d4e7716085
commit 525ab5fa40
3 changed files with 49 additions and 1 deletions
+4
View File
@@ -826,6 +826,10 @@ func (z *erasureServerPools) saveRebalanceStats(ctx context.Context, poolIdx int
// if not found, we store the memory metadata back
// when rebalance status changed, will notify all nodes update status to memory, we can treat the memory metadata is the latest status
if errors.Is(err, errConfigNotFound) {
if z.rebalMeta == nil {
// No rebalance has run, e.g. a rebalance stop without one.
return errRebalanceNotStarted
}
r = z.rebalMeta
}