mirror of
https://github.com/minio/minio.git
synced 2026-02-04 18:00:15 -05:00
fix: after saveRebalanceStats cancel will be empty (#21597)
This commit is contained in:
@@ -98,8 +98,6 @@ type rebalanceInfo struct {
|
|||||||
|
|
||||||
// rebalanceMeta contains information pertaining to an ongoing rebalance operation.
|
// rebalanceMeta contains information pertaining to an ongoing rebalance operation.
|
||||||
type rebalanceMeta struct {
|
type rebalanceMeta struct {
|
||||||
cancel context.CancelFunc `msg:"-"` // to be invoked on rebalance-stop
|
|
||||||
lastRefreshedAt time.Time `msg:"-"`
|
|
||||||
StoppedAt time.Time `msg:"stopTs"` // Time when rebalance-stop was issued.
|
StoppedAt time.Time `msg:"stopTs"` // Time when rebalance-stop was issued.
|
||||||
ID string `msg:"id"` // ID of the ongoing rebalance operation
|
ID string `msg:"id"` // ID of the ongoing rebalance operation
|
||||||
PercentFreeGoal float64 `msg:"pf"` // Computed from total free space and capacity at the start of rebalance
|
PercentFreeGoal float64 `msg:"pf"` // Computed from total free space and capacity at the start of rebalance
|
||||||
@@ -313,8 +311,6 @@ func (r *rebalanceMeta) loadWithOpts(ctx context.Context, store objectIO, opts O
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
r.lastRefreshedAt = time.Now()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,7 +940,7 @@ func (z *erasureServerPools) StartRebalance() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithCancel(GlobalContext)
|
ctx, cancel := context.WithCancel(GlobalContext)
|
||||||
z.rebalMeta.cancel = cancel // to be used when rebalance-stop is called
|
z.rebalCancel = cancel // to be used when rebalance-stop is called
|
||||||
z.rebalMu.Unlock()
|
z.rebalMu.Unlock()
|
||||||
|
|
||||||
z.rebalMu.RLock()
|
z.rebalMu.RLock()
|
||||||
@@ -987,10 +983,9 @@ func (z *erasureServerPools) StopRebalance() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if cancel := r.cancel; cancel != nil {
|
if cancel := z.rebalCancel; cancel != nil {
|
||||||
// cancel != nil only on pool leaders
|
|
||||||
r.cancel = nil
|
|
||||||
cancel()
|
cancel()
|
||||||
|
z.rebalCancel = nil
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ type erasureServerPools struct {
|
|||||||
|
|
||||||
rebalMu sync.RWMutex
|
rebalMu sync.RWMutex
|
||||||
rebalMeta *rebalanceMeta
|
rebalMeta *rebalanceMeta
|
||||||
|
rebalCancel context.CancelFunc
|
||||||
|
|
||||||
deploymentID [16]byte
|
deploymentID [16]byte
|
||||||
distributionAlgo string
|
distributionAlgo string
|
||||||
|
|||||||
Reference in New Issue
Block a user