fix: forbid balancing level zero segments (#29168)

related #29128
Signed-off-by: yah01 <yah2er0ne@outlook.com>

---------

Signed-off-by: yah01 <yah2er0ne@outlook.com>
Signed-off-by: yah01 <yang.cen@zilliz.com>
This commit is contained in:
yah01 2023-12-14 14:30:39 +08:00 committed by GitHub
parent f79c6146bd
commit 58dbb7872a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions

View File

@ -835,6 +835,7 @@ func (s *Server) GetRecoveryInfoV2(ctx context.Context, req *datapb.GetRecoveryI
CollectionID: segment.CollectionID,
InsertChannel: segment.InsertChannel,
NumOfRows: segment.NumOfRows,
Level: segment.GetLevel(),
})
continue
}

View File

@ -273,6 +273,9 @@ func (b *ScoreBasedBalancer) getNormalSegmentPlan(replica *meta.Replica, nodesSe
// sort the segments in asc order, try to mitigate to-from-unbalance
// TODO: segment infos inside dist manager may change in the process of making balance plan
fromSegments := b.dist.SegmentDistManager.GetByCollectionAndNode(replica.CollectionID, fromNode.nodeID)
fromSegments = lo.Filter(fromSegments, func(segment *meta.Segment, _ int) bool {
return segment.GetLevel() != datapb.SegmentLevel_L0
})
sort.Slice(fromSegments, func(i, j int) bool {
return fromSegments[i].GetNumOfRows() < fromSegments[j].GetNumOfRows()
})

View File

@ -31,19 +31,6 @@ import (
"github.com/milvus-io/milvus/pkg/util/tsoutil"
)
func SegmentBinlogs2SegmentInfo(collectionID int64, partitionID int64, segmentBinlogs *datapb.SegmentBinlogs) *datapb.SegmentInfo {
return &datapb.SegmentInfo{
ID: segmentBinlogs.GetSegmentID(),
CollectionID: collectionID,
PartitionID: partitionID,
InsertChannel: segmentBinlogs.GetInsertChannel(),
NumOfRows: segmentBinlogs.GetNumOfRows(),
Binlogs: segmentBinlogs.GetFieldBinlogs(),
Statslogs: segmentBinlogs.GetStatslogs(),
Deltalogs: segmentBinlogs.GetDeltalogs(),
}
}
func MergeMetaSegmentIntoSegmentInfo(info *querypb.SegmentInfo, segments ...*meta.Segment) {
first := segments[0]
if info.GetSegmentID() == 0 {