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 afaabc2 commit 5241ae8
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 @@ -827,6 +827,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 @@ -57,6 +57,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 @@ -111,8 +112,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 @@ -570,11 +570,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 @@ -595,6 +597,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()
Expand Down

0 comments on commit 5241ae8

Please sign in to comment.