Skip to content

Commit

Permalink
fix: Querycoord will trigger unexpected balance task after restart
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Liu <[email protected]>
  • Loading branch information
weiliu1031 committed Dec 24, 2024
1 parent 118678b commit 6c54dd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/proto/query_coord.proto
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ message CheckerInfo {
message SegmentTarget {
int64 ID = 1;
data.SegmentLevel level = 2;
int64 num_of_rows = 3;
}

message PartitionTarget {
Expand Down
6 changes: 4 additions & 2 deletions internal/querycoordv2/meta/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func FromPbCollectionTarget(target *querypb.CollectionTarget) *CollectionTarget
CollectionID: target.GetCollectionID(),
PartitionID: partition.GetPartitionID(),
InsertChannel: t.GetChannelName(),
NumOfRows: segment.GetNumOfRows(),
}
}
partitions = append(partitions, partition.GetPartitionID())
Expand Down Expand Up @@ -113,8 +114,9 @@ func (p *CollectionTarget) toPbMsg() *querypb.CollectionTarget {
}

partitionTarget.Segments = append(partitionTarget.Segments, &querypb.SegmentTarget{
ID: info.GetID(),
Level: info.GetLevel(),
ID: info.GetID(),
Level: info.GetLevel(),
NumOfRows: info.GetNumOfRows(),
})
}
}
Expand Down
5 changes: 5 additions & 0 deletions internal/querycoordv2/meta/target_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,13 @@ func (suite *TargetManagerSuite) TestRecover() {
ID: 11,
PartitionID: 1,
InsertChannel: "channel-1",
NumOfRows: 100,
},
{
ID: 12,
PartitionID: 1,
InsertChannel: "channel-2",
NumOfRows: 100,
},
}

Expand All @@ -609,6 +611,9 @@ func (suite *TargetManagerSuite) TestRecover() {
suite.Len(target.GetAllDmChannelNames(), 2)
suite.Len(target.GetAllSegmentIDs(), 2)
suite.Equal(target.GetTargetVersion(), version)
for _, segment := range target.GetAllSegments() {
suite.Equal(int64(100), segment.GetNumOfRows())
}

// after recover, target info should be cleaned up
targets, err := suite.catalog.GetCollectionTargets(ctx)
Expand Down

0 comments on commit 6c54dd0

Please sign in to comment.