Skip to content

Commit

Permalink
fix: sync partitiion stats blocking balance task(milvus-io#33741) (mi…
Browse files Browse the repository at this point in the history
…lvus-io#33742)

related: milvus-io#33741

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
Co-authored-by: wayblink <anyang.wang@zilliz.com>
  • Loading branch information
MrPresent-Han and wayblink committed Jul 2, 2024
1 parent 6b348e4 commit 0aa0f59
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions internal/datacoord/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (h *ServerHandler) GetQueryVChanPositions(channel RWChannel, partitionIDs .
zap.String("channel", channel.GetName()),
zap.Int("numOfSegments", len(segments)),
zap.Int("indexed segment", len(indexedSegments)),
zap.Int64("currentPartitionStatsVersion", currentPartitionStatsVersion),
)
unIndexedIDs := make(typeutil.UniqueSet)

Expand Down
2 changes: 1 addition & 1 deletion internal/querycoordv2/checkers/balance_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (b *BalanceChecker) replicasToBalance() []int64 {
hasUnbalancedCollection := false
for _, cid := range loadedCollections {
if b.normalBalanceCollectionsCurrentRound.Contain(cid) {
log.Debug("ScoreBasedBalancer has balanced collection, skip balancing in this round",
log.Debug("ScoreBasedBalancer is balancing this collection, skip balancing in this round",
zap.Int64("collectionID", cid))
continue
}
Expand Down
6 changes: 1 addition & 5 deletions internal/querycoordv2/checkers/leader_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (suite *LeaderCheckerTestSuite) SetupTest() {

distManager := meta.NewDistributionManager()
targetManager := meta.NewTargetManager(suite.broker, suite.meta)
suite.checker = NewLeaderChecker(suite.meta, distManager, targetManager, suite.nodeMgr, false)
suite.checker = NewLeaderChecker(suite.meta, distManager, targetManager, suite.nodeMgr)
}

func (suite *LeaderCheckerTestSuite) TearDownTest() {
Expand Down Expand Up @@ -476,10 +476,6 @@ func (suite *LeaderCheckerTestSuite) TestIgnoreSyncRemovedSegments() {

func (suite *LeaderCheckerTestSuite) TestUpdatePartitionStats() {
testChannel := "test-insert-channel"
suite.checker.enableSyncPartitionStats = true
defer func() {
suite.checker.enableSyncPartitionStats = false
}()
leaderID := int64(2)
observer := suite.checker
observer.meta.CollectionManager.PutCollection(utils.CreateTestCollection(1, 1))
Expand Down
4 changes: 4 additions & 0 deletions internal/querycoordv2/task/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package task

import (
"reflect"

"github.com/samber/lo"
"go.uber.org/atomic"

Expand Down Expand Up @@ -234,6 +236,8 @@ func (action *LeaderAction) IsFinished(distMgr *meta.DistributionManager) bool {
return action.rpcReturned.Load() && dist != nil && dist.NodeID == action.Node()
case ActionTypeReduce:
return action.rpcReturned.Load() && (dist == nil || dist.NodeID != action.Node())
case ActionTypeUpdate:
return action.rpcReturned.Load() && (dist != nil && reflect.DeepEqual(action.partStatsVersions, view.PartitionStatsVersions))
}
return false
}
3 changes: 0 additions & 3 deletions tests/integration/balance/balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,12 @@ func (s *BalanceTestSuit) SetupSuite() {

// disable compaction
paramtable.Get().Save(paramtable.Get().DataCoordCfg.EnableCompaction.Key, "false")
// todo @wayblink repair this test
// paramtable.Get().Save(paramtable.Get().QueryNodeCfg.EnableSyncPartitionStats.Key, "false")

s.Require().NoError(s.SetupEmbedEtcd())
}

func (s *BalanceTestSuit) TearDownSuite() {
defer paramtable.Get().Reset(paramtable.Get().DataCoordCfg.EnableCompaction.Key)
// defer paramtable.Get().Reset(paramtable.Get().QueryNodeCfg.EnableSyncPartitionStats.Key)

s.MiniClusterSuite.TearDownSuite()
}
Expand Down

0 comments on commit 0aa0f59

Please sign in to comment.