enhance: enable stopping balance after balance has been suspended (#32812) (#32941)

issue: #32811
pr: #32812 

This PR enable stopping balance after balance has been suspended, in
case of global balance has been suspend, then query node get a sigterm,
if stopping balance won't be triggered, the query node exit progress
will stuck

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/33127/head
wei liu 2024-05-17 11:53:37 +08:00 committed by GitHub
parent 0abc0d05a4
commit d842efbff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -113,10 +113,12 @@ func (b *BalanceChecker) replicasToBalance() []int64 {
return stoppingReplicas
}
// no stopping balance and auto balance is disabled, return empty collections for balance
if !Params.QueryCoordCfg.AutoBalance.GetAsBool() {
// 1. if auto balance is disabled, return empty collections for balance
// 2. when balancer isn't active, skip auto balance
if !Params.QueryCoordCfg.AutoBalance.GetAsBool() || !b.IsActive() {
return nil
}
// scheduler is handling segment task, skip
if b.scheduler.GetSegmentTaskNum() != 0 {
return nil
@ -165,9 +167,6 @@ func (b *BalanceChecker) balanceReplicas(replicaIDs []int64) ([]balance.SegmentA
}
func (b *BalanceChecker) Check(ctx context.Context) []task.Task {
if !b.IsActive() {
return nil
}
ret := make([]task.Task, 0)
replicasToBalance := b.replicasToBalance()