fix: Filter channel level zero segments when build level delete cache (#31129)

See also #31125

Delegator shall build level zero delete cache from l0 segments belongs
to it. Previously it build cache from all existing level zero segments
in the querynode which may lead to high memory usage and even panicking
when pk types are not matched

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/30998/head
congqixia 2024-03-07 23:01:02 +08:00 committed by GitHub
parent c886aa29ff
commit ba8197fafb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -520,7 +520,7 @@ func (sd *shardDelegator) GetLevel0Deletions(partitionID int64) ([]storage.Prima
} }
func (sd *shardDelegator) GenerateLevel0DeletionCache() { func (sd *shardDelegator) GenerateLevel0DeletionCache() {
level0Segments := sd.segmentManager.GetBy(segments.WithLevel(datapb.SegmentLevel_L0)) level0Segments := sd.segmentManager.GetBy(segments.WithLevel(datapb.SegmentLevel_L0), segments.WithChannel(sd.vchannelName))
deletions := make(map[int64]*storage.DeleteData) deletions := make(map[int64]*storage.DeleteData)
for _, segment := range level0Segments { for _, segment := range level0Segments {
segment := segment.(*segments.L0Segment) segment := segment.(*segments.L0Segment)
@ -766,7 +766,7 @@ func (sd *shardDelegator) ReleaseSegments(ctx context.Context, req *querypb.Rele
log := sd.getLogger(ctx) log := sd.getLogger(ctx)
targetNodeID := req.GetNodeID() targetNodeID := req.GetNodeID()
level0Segments := typeutil.NewSet(lo.Map(sd.segmentManager.GetBy(segments.WithLevel(datapb.SegmentLevel_L0)), func(segment segments.Segment, _ int) int64 { level0Segments := typeutil.NewSet(lo.Map(sd.segmentManager.GetBy(segments.WithLevel(datapb.SegmentLevel_L0), segments.WithChannel(sd.vchannelName)), func(segment segments.Segment, _ int) int64 {
return segment.ID() return segment.ID()
})...) })...)
hasLevel0 := false hasLevel0 := false