diff --git a/configs/milvus.yaml b/configs/milvus.yaml index 98609675ca..f98195feac 100644 --- a/configs/milvus.yaml +++ b/configs/milvus.yaml @@ -281,7 +281,7 @@ dataCoord: minSizeFromIdleToSealed: 16 # The min size in MB of segment which can be idle from sealed. smallProportion: 0.5 # The segment is considered as "small segment" when its # of rows is smaller than # (smallProportion * segment max # of rows). - compactableProportion: 0.5 # A compaction will happen on small segments if the segment after compaction will have + compactableProportion: 0.85 # A compaction will happen on small segments if the segment after compaction will have # over (compactableProportion * segment max # of rows) rows. compaction: diff --git a/internal/util/paramtable/component_param.go b/internal/util/paramtable/component_param.go index 9e9901b9e9..a317bd0bdf 100644 --- a/internal/util/paramtable/component_param.go +++ b/internal/util/paramtable/component_param.go @@ -1243,8 +1243,7 @@ func (p *dataCoordConfig) init(base *BaseTable) { p.initCompactionMinSegment() p.initCompactionMaxSegment() - p.initSegmentSmallProportion() - p.initSegmentCompactableProportion() + p.initSegmentProportion() p.initCompactionTimeoutInSeconds() p.initCompactionCheckIntervalInSeconds() p.initSingleCompactionRatioThreshold() @@ -1321,7 +1320,17 @@ func (p *dataCoordConfig) initSegmentSmallProportion() { } func (p *dataCoordConfig) initSegmentCompactableProportion() { - p.SegmentCompactableProportion = p.Base.ParseFloatWithDefault("dataCoord.segment.compactableProportion", 0.5) + p.SegmentCompactableProportion = p.Base.ParseFloatWithDefault("dataCoord.segment.compactableProportion", 0.85) +} + +func (p *dataCoordConfig) initSegmentProportion() { + p.initSegmentSmallProportion() + p.initSegmentCompactableProportion() + + // avoid invalid single compaction + if p.SegmentCompactableProportion < p.SegmentSmallProportion { + p.SegmentCompactableProportion = p.SegmentSmallProportion + } } // compaction execution timeout diff --git a/internal/util/paramtable/component_param_test.go b/internal/util/paramtable/component_param_test.go index 0499addaee..6265c3d4ac 100644 --- a/internal/util/paramtable/component_param_test.go +++ b/internal/util/paramtable/component_param_test.go @@ -290,6 +290,7 @@ func TestComponentParam(t *testing.T) { assert.Equal(t, 24*60*60*time.Second, Params.SegmentMaxLifetime) assert.True(t, Params.EnableGarbageCollection) assert.Equal(t, Params.EnableActiveStandby, false) + assert.True(t, Params.SegmentCompactableProportion >= Params.SegmentSmallProportion) t.Logf("dataCoord EnableActiveStandby = %t", Params.EnableActiveStandby) })