Fix invalid single compaction (#21328)

Signed-off-by: xige-16 <xi.ge@zilliz.com>
pull/21352/head
xige-16 2022-12-22 16:05:28 +08:00 committed by GitHub
parent 3d1f7a88a7
commit 38f9ea5122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -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.
# MUST BE GREATER THAN OR EQUAL TO <smallProportion>!!!

View File

@ -1255,8 +1255,7 @@ func (p *dataCoordConfig) init(base *BaseTable) {
p.initCompactionMinSegment()
p.initCompactionMaxSegment()
p.initSegmentSmallProportion()
p.initSegmentCompactableProportion()
p.initSegmentProportion()
p.initCompactionTimeoutInSeconds()
p.initCompactionCheckIntervalInSeconds()
p.initSingleCompactionRatioThreshold()
@ -1333,7 +1332,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

View File

@ -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)
})