From ef3fcdf65b7043eeffebe41584fe1af28d530736 Mon Sep 17 00:00:00 2001 From: Ten Thousand Leaves <69466447+soothing-rain@users.noreply.github.com> Date: Fri, 16 Dec 2022 10:01:23 +0800 Subject: [PATCH] Small candidate compaction should only happen with >1 segments (#21249) /kind improvement Signed-off-by: Yuchen Gao Signed-off-by: Yuchen Gao --- configs/milvus.yaml | 1 + internal/datacoord/compaction_trigger.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/milvus.yaml b/configs/milvus.yaml index 45398b2238..313781d2b9 100644 --- a/configs/milvus.yaml +++ b/configs/milvus.yaml @@ -287,6 +287,7 @@ dataCoord: # (smallProportion * segment max # of rows). compactableProportion: 0.5 # A compaction will happen on small segments if the segment after compaction will have # over (compactableProportion * segment max # of rows) rows. + # MUST BE GREATER THAN OR EQUAL TO !!! expansionRate: 1.25 # During compaction, the size of segment # of rows is able to exceed segment max # of rows by (expansionRate-1) * 100%. compaction: diff --git a/internal/datacoord/compaction_trigger.go b/internal/datacoord/compaction_trigger.go index eb83791925..4ead43be5a 100644 --- a/internal/datacoord/compaction_trigger.go +++ b/internal/datacoord/compaction_trigger.go @@ -613,7 +613,8 @@ func (t *compactionTrigger) generatePlans(segments []*SegmentInfo, force bool, i } // only merge if candidate number is large than MinSegmentToMerge or if target row is large enough if len(bucket) >= Params.DataCoordCfg.MinSegmentToMerge.GetAsInt() || - targetRow > int64(float64(segment.GetMaxRowNum())*Params.DataCoordCfg.SegmentCompactableProportion.GetAsFloat()) { + len(bucket) > 1 && + targetRow > int64(float64(segment.GetMaxRowNum())*Params.DataCoordCfg.SegmentCompactableProportion.GetAsFloat()) { plan := segmentsToPlan(bucket, compactTime) log.Info("generate a plan for small candidates", zap.Int64s("plan segment IDs", lo.Map(bucket, getSegmentIDs)),