diff --git a/CHANGELOG.md b/CHANGELOG.md index 6836b87c48..32923c9c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ We use *breaking* word for marking changes that are not backward compatible (rel - [#2238](https://github.com/thanos-io/thanos/pull/2238) Ruler: Fixed Issue #2204 bug in alert queue signalling filled up queue and alerts were dropped - [#2231](https://github.com/thanos-io/thanos/pull/2231) Bucket Web - Sort chunks by thanos.downsample.resolution for better grouping +### Added + +- [#2265](https://github.com/thanos-io/thanos/pull/2265) Compactor: Add `--wait-interval` to specify compaction wait interval between consecutive compact runs when `--wait` enabled. + ## [v0.11.0](https://github.com/thanos-io/thanos/releases/tag/v0.11.0) - 2020.03.02 ### Fixed diff --git a/cmd/thanos/compact.go b/cmd/thanos/compact.go index c14bbac3a9..7d54845e76 100644 --- a/cmd/thanos/compact.go +++ b/cmd/thanos/compact.go @@ -103,9 +103,13 @@ func registerCompact(m map[string]setupFunc, app *kingpin.Application) { retention5m := modelDuration(cmd.Flag("retention.resolution-5m", "How long to retain samples of resolution 1 (5 minutes) in bucket. Setting this to 0d will retain samples of this resolution forever").Default("0d")) retention1h := modelDuration(cmd.Flag("retention.resolution-1h", "How long to retain samples of resolution 2 (1 hour) in bucket. Setting this to 0d will retain samples of this resolution forever").Default("0d")) + // TODO(kakkoyun): https://github.com/thanos-io/thanos/issues/2266. wait := cmd.Flag("wait", "Do not exit after all compactions have been processed and wait for new work."). Short('w').Bool() + waitInterval := cmd.Flag("wait-interval", "Wait interval between consecutive compaction runs. Only works when --wait flag specified."). + Default("5m").Duration() + generateMissingIndexCacheFiles := cmd.Flag("index.generate-missing-cache-file", "If enabled, on startup compactor runs an on-off job that scans all the blocks to find all blocks with missing index cache file. It generates those if needed and upload."). Hidden().Default("false").Bool() @@ -146,6 +150,7 @@ func registerCompact(m map[string]setupFunc, app *kingpin.Application) { *blockSyncConcurrency, *compactionConcurrency, selectorRelabelConf, + *waitInterval, ) } } @@ -170,6 +175,7 @@ func runCompact( blockSyncConcurrency int, concurrency int, selectorRelabelConf *extflag.PathOrContent, + waitInterval time.Duration, ) error { halted := promauto.With(reg).NewGauge(prometheus.GaugeOpts{ Name: "thanos_compactor_halted", @@ -348,7 +354,7 @@ func runCompact( } // --wait=true is specified. - return runutil.Repeat(5*time.Minute, ctx.Done(), func() error { + return runutil.Repeat(waitInterval, ctx.Done(), func() error { err := compactMainFn() if err == nil { iterations.Inc() diff --git a/docs/components/compact.md b/docs/components/compact.md index edd71eb7b1..4199daeed2 100644 --- a/docs/components/compact.md +++ b/docs/components/compact.md @@ -121,6 +121,8 @@ Flags: samples of this resolution forever -w, --wait Do not exit after all compactions have been processed and wait for new work. + --wait-interval=5m Wait interval between consecutive compaction + runs. Only works when --wait flag specified. --downsampling.disable Disables downsampling. This is not recommended as querying long time ranges without non-downsampled data is not efficient and useful e.g it is not