From d1cb380ee02c1d3b005a4fea9e1ad5718d8ca11b Mon Sep 17 00:00:00 2001 From: XuanYang-cn Date: Tue, 22 Nov 2022 17:33:16 +0800 Subject: [PATCH] Enable to gen compaction plan for stale segments (#20741) See also: #20502 Signed-off-by: yangxuan Signed-off-by: yangxuan --- internal/datacoord/compaction_trigger.go | 5 ----- internal/datacoord/compaction_trigger_test.go | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/datacoord/compaction_trigger.go b/internal/datacoord/compaction_trigger.go index 80f9435608..b11c79ffc4 100644 --- a/internal/datacoord/compaction_trigger.go +++ b/internal/datacoord/compaction_trigger.go @@ -476,11 +476,6 @@ func (t *compactionTrigger) generatePlans(segments []*SegmentInfo, force bool, c // TODO, currently we lack of the measurement of data distribution, there should be another compaction help on redistributing segment based on scalar/vector field distribution for _, segment := range segments { segment := segment.ShadowClone() - // by-pass stale segments - if !force && t.isStaleSegment(segment) { - log.Debug("generate plans skip stale segment", zap.Int64("segmentID", segment.GetID()), zap.Time("lastFlushTime", segment.lastFlushTime)) - continue - } // TODO should we trigger compaction periodically even if the segment has no obvious reason to be compacted? if force || t.ShouldDoSingleCompaction(segment, compactTime) { prioritizedCandidates = append(prioritizedCandidates, segment) diff --git a/internal/datacoord/compaction_trigger_test.go b/internal/datacoord/compaction_trigger_test.go index b4bbf3e1e2..ea397f43da 100644 --- a/internal/datacoord/compaction_trigger_test.go +++ b/internal/datacoord/compaction_trigger_test.go @@ -1057,7 +1057,7 @@ func Test_compactionTrigger_smallfiles(t *testing.T) { }, }, }, - lastFlushTime: time.Now(), + lastFlushTime: time.Now().Add(-100 * time.Minute), }, 2: { SegmentInfo: &datapb.SegmentInfo{