From 76d8a784733265b55f945df82b7b49277c5cef2d Mon Sep 17 00:00:00 2001 From: xiaofanluan Date: Wed, 5 Feb 2025 21:02:22 +0800 Subject: [PATCH] improve: unindexed collection can be compacted Signed-off-by: xiaofanluan --- internal/datacoord/compaction_policy_single.go | 2 +- internal/datacoord/compaction_trigger.go | 4 ++-- internal/datacoord/garbage_collector.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/datacoord/compaction_policy_single.go b/internal/datacoord/compaction_policy_single.go index edf1c4dbc2af0..5109985364858 100644 --- a/internal/datacoord/compaction_policy_single.go +++ b/internal/datacoord/compaction_policy_single.go @@ -99,7 +99,7 @@ func (policy *singleCompactionPolicy) triggerOneCollection(ctx context.Context, views := make([]CompactionView, 0) for _, group := range partSegments { if Params.DataCoordCfg.IndexBasedCompaction.GetAsBool() { - group.segments = FilterInIndexedSegments(policy.handler, policy.meta, false, group.segments...) + group.segments = FilterInIndexedSegments(policy.handler, policy.meta, true, group.segments...) } collectionTTL, err := getCollectionTTL(collection.Properties) diff --git a/internal/datacoord/compaction_trigger.go b/internal/datacoord/compaction_trigger.go index 121920a52706c..f0cc1b2768f7f 100644 --- a/internal/datacoord/compaction_trigger.go +++ b/internal/datacoord/compaction_trigger.go @@ -327,7 +327,7 @@ func (t *compactionTrigger) handleGlobalSignal(signal *compactionSignal) error { } if Params.DataCoordCfg.IndexBasedCompaction.GetAsBool() { - group.segments = FilterInIndexedSegments(t.handler, t.meta, signal.isForce, group.segments...) + group.segments = FilterInIndexedSegments(t.handler, t.meta, true, group.segments...) } coll, err := t.getCollection(group.collectionID) @@ -625,7 +625,7 @@ func (t *compactionTrigger) generatePlans(segments []*SegmentInfo, signal *compa func (t *compactionTrigger) getCandidateSegments(channel string, partitionID UniqueID) []*SegmentInfo { segments := t.meta.GetSegmentsByChannel(channel) if Params.DataCoordCfg.IndexBasedCompaction.GetAsBool() { - segments = FilterInIndexedSegments(t.handler, t.meta, false, segments...) + segments = FilterInIndexedSegments(t.handler, t.meta, true, segments...) } var res []*SegmentInfo diff --git a/internal/datacoord/garbage_collector.go b/internal/datacoord/garbage_collector.go index f99ba6096c449..193033b7de360 100644 --- a/internal/datacoord/garbage_collector.go +++ b/internal/datacoord/garbage_collector.go @@ -440,7 +440,7 @@ func (gc *garbageCollector) recycleDroppedSegments(ctx context.Context) { droppedCompactTo[to] = struct{}{} } } - indexedSegments := FilterInIndexedSegments(gc.handler, gc.meta, false, lo.Keys(droppedCompactTo)...) + indexedSegments := FilterInIndexedSegments(gc.handler, gc.meta, true, lo.Keys(droppedCompactTo)...) indexedSet := make(typeutil.UniqueSet) for _, segment := range indexedSegments { indexedSet.Insert(segment.GetID())