diff --git a/internal/proto/query_coord.proto b/internal/proto/query_coord.proto index f05a07dc7b028..d469841c525ff 100644 --- a/internal/proto/query_coord.proto +++ b/internal/proto/query_coord.proto @@ -831,6 +831,7 @@ message CheckerInfo { message SegmentTarget { int64 ID = 1; data.SegmentLevel level = 2; + int64 num_of_rows = 3; } message PartitionTarget { diff --git a/internal/querycoordv2/meta/target.go b/internal/querycoordv2/meta/target.go index 3099d2ab9f8ac..9526d697e3ef1 100644 --- a/internal/querycoordv2/meta/target.go +++ b/internal/querycoordv2/meta/target.go @@ -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()) @@ -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(), }) } } diff --git a/internal/querycoordv2/meta/target_manager_test.go b/internal/querycoordv2/meta/target_manager_test.go index c78b7207a8213..d8bd7b05c362e 100644 --- a/internal/querycoordv2/meta/target_manager_test.go +++ b/internal/querycoordv2/meta/target_manager_test.go @@ -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, }, } @@ -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)