Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: Add configs for compaction schedule #39010

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/milvus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ dataCoord:
maxParallelTaskNum: -1 # Deprecated, see datanode.slot.slotCap
dropTolerance: 86400 # Compaction task will be cleaned after finish longer than this time(in seconds)
gcInterval: 1800 # The time interval in seconds for compaction gc
scheduleInterval: 500 # The time interval in milliseconds for scheduling compaction tasks. If the configuration setting is below 100ms, it will be ajusted upwards to 100ms
mix:
triggerInterval: 60 # The time interval in seconds to trigger mix compaction
levelzero:
Expand Down
5 changes: 3 additions & 2 deletions internal/datacoord/compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,11 @@ func (c *compactionPlanHandler) loadMeta() {
}

func (c *compactionPlanHandler) loopSchedule() {
log.Info("compactionPlanHandler start loop schedule")
interval := paramtable.Get().DataCoordCfg.CompactionScheduleInterval.GetAsDuration(time.Millisecond)
log.Info("compactionPlanHandler start loop schedule", zap.Duration("schedule interval", interval))
defer c.stopWg.Done()

scheduleTicker := time.NewTicker(3 * time.Second)
scheduleTicker := time.NewTicker(interval)
defer scheduleTicker.Stop()
for {
select {
Expand Down
19 changes: 18 additions & 1 deletion pkg/util/paramtable/component_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -3360,7 +3360,8 @@
CompactionTimeoutInSeconds ParamItem `refreshable:"true"`
CompactionDropToleranceInSeconds ParamItem `refreshable:"true"`
CompactionGCIntervalInSeconds ParamItem `refreshable:"true"`
CompactionCheckIntervalInSeconds ParamItem `refreshable:"false"`
CompactionCheckIntervalInSeconds ParamItem `refreshable:"false"` // deprecated
CompactionScheduleInterval ParamItem `refreshable:"false"`
MixCompactionTriggerInterval ParamItem `refreshable:"false"`
L0CompactionTriggerInterval ParamItem `refreshable:"false"`
GlobalCompactionInterval ParamItem `refreshable:"false"`
Expand Down Expand Up @@ -3736,6 +3737,22 @@
}
p.CompactionCheckIntervalInSeconds.Init(base.mgr)

p.CompactionScheduleInterval = ParamItem{
Key: "dataCoord.compaction.scheduleInterval",
Version: "2.4.21",
DefaultValue: "500",
Export: true,
Formatter: func(value string) string {
ms := getAsInt64(value)
if ms < 100 {
ms = 100
}

Check warning on line 3749 in pkg/util/paramtable/component_param.go

View check run for this annotation

Codecov / codecov/patch

pkg/util/paramtable/component_param.go#L3748-L3749

Added lines #L3748 - L3749 were not covered by tests
return strconv.FormatInt(ms, 10)
},
Doc: "The time interval in milliseconds for scheduling compaction tasks. If the configuration setting is below 100ms, it will be ajusted upwards to 100ms",
}
p.CompactionScheduleInterval.Init(base.mgr)

p.SingleCompactionRatioThreshold = ParamItem{
Key: "dataCoord.compaction.single.ratio.threshold",
Version: "2.0.0",
Expand Down
Loading