Allow rebalance start when it's stopped/completed (#20009)

This commit is contained in:
Krishnan Parthasarathi 2024-06-27 17:22:30 -07:00 committed by GitHub
parent 722118386d
commit 154fcaeb56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -374,6 +374,7 @@ func (a adminAPIHandlers) RebalanceStop(w http.ResponseWriter, r *http.Request)
globalNotificationSys.StopRebalance(r.Context()) globalNotificationSys.StopRebalance(r.Context())
writeSuccessResponseHeadersOnly(w) writeSuccessResponseHeadersOnly(w)
adminLogIf(ctx, pools.saveRebalanceStats(GlobalContext, 0, rebalSaveStoppedAt)) adminLogIf(ctx, pools.saveRebalanceStats(GlobalContext, 0, rebalSaveStoppedAt))
globalNotificationSys.LoadRebalanceMeta(ctx, false)
} }
func proxyDecommissionRequest(ctx context.Context, defaultEndPoint Endpoint, w http.ResponseWriter, r *http.Request) (proxy bool) { func proxyDecommissionRequest(ctx context.Context, defaultEndPoint Endpoint, w http.ResponseWriter, r *http.Request) (proxy bool) {

View File

@ -350,8 +350,15 @@ func (z *erasureServerPools) IsRebalanceStarted() bool {
z.rebalMu.RLock() z.rebalMu.RLock()
defer z.rebalMu.RUnlock() defer z.rebalMu.RUnlock()
if r := z.rebalMeta; r != nil { r := z.rebalMeta
if r.StoppedAt.IsZero() { if r == nil {
return false
}
if !r.StoppedAt.IsZero() {
return false
}
for _, ps := range r.PoolStats {
if ps.Participating && ps.Info.Status != rebalCompleted {
return true return true
} }
} }