mirror of
https://github.com/minio/minio.git
synced 2025-10-28 23:35:01 -04:00
fix: after saveRebalanceStats cancel will be empty (#21597)
This commit is contained in:
parent
756f3c8142
commit
456d9462e5
@ -98,12 +98,10 @@ type rebalanceInfo struct {
|
||||
|
||||
// rebalanceMeta contains information pertaining to an ongoing rebalance operation.
|
||||
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.
|
||||
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
|
||||
PoolStats []*rebalanceStats `msg:"rss"` // Per-pool rebalance stats keyed by pool index
|
||||
StoppedAt time.Time `msg:"stopTs"` // Time when rebalance-stop was issued.
|
||||
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
|
||||
PoolStats []*rebalanceStats `msg:"rss"` // Per-pool rebalance stats keyed by pool index
|
||||
}
|
||||
|
||||
var errRebalanceNotStarted = errors.New("rebalance not started")
|
||||
@ -313,8 +311,6 @@ func (r *rebalanceMeta) loadWithOpts(ctx context.Context, store objectIO, opts O
|
||||
return err
|
||||
}
|
||||
|
||||
r.lastRefreshedAt = time.Now()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -944,7 +940,7 @@ func (z *erasureServerPools) StartRebalance() {
|
||||
return
|
||||
}
|
||||
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.RLock()
|
||||
@ -987,10 +983,9 @@ func (z *erasureServerPools) StopRebalance() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if cancel := r.cancel; cancel != nil {
|
||||
// cancel != nil only on pool leaders
|
||||
r.cancel = nil
|
||||
if cancel := z.rebalCancel; cancel != nil {
|
||||
cancel()
|
||||
z.rebalCancel = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -53,8 +53,9 @@ type erasureServerPools struct {
|
||||
poolMetaMutex sync.RWMutex
|
||||
poolMeta poolMeta
|
||||
|
||||
rebalMu sync.RWMutex
|
||||
rebalMeta *rebalanceMeta
|
||||
rebalMu sync.RWMutex
|
||||
rebalMeta *rebalanceMeta
|
||||
rebalCancel context.CancelFunc
|
||||
|
||||
deploymentID [16]byte
|
||||
distributionAlgo string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user