Signal stop-rebalance to all rebalancing pools (#16438)

This commit is contained in:
Krishnan Parthasarathi 2023-01-18 17:24:23 -08:00 committed by GitHub
parent 5c1a4ba5f9
commit 71c95ad0d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -353,6 +353,7 @@ func (z *erasureServerPools) rebalanceBuckets(ctx context.Context, poolIdx int)
z.rebalMu.Lock()
z.rebalMeta.PoolStats[poolIdx].Info.Status = rebalStopped
z.rebalMeta.PoolStats[poolIdx].Info.EndTime = now
z.rebalMeta.cancel = nil // remove the already used context.CancelFunc
z.rebalMu.Unlock()
rebalDone = true

View File

@ -649,6 +649,15 @@ func (sys *NotificationSys) StopRebalance(ctx context.Context) {
logger.LogIf(logger.SetReqInfo(ctx, reqInfo), nErr.Err)
}
}
objAPI := newObjectLayerFn()
if objAPI == nil {
logger.LogIf(ctx, errServerNotInitialized)
return
}
if pools, ok := objAPI.(*erasureServerPools); ok {
pools.StopRebalance()
}
}
// LoadRebalanceMeta notifies all peers to load rebalance.bin from object layer.