Skip to content

Commit

Permalink
Add wait-interval flag
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
  • Loading branch information
kakkoyun committed Mar 13, 2020
1 parent c0418a2 commit d550b6a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion cmd/thanos/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -146,6 +150,7 @@ func registerCompact(m map[string]setupFunc, app *kingpin.Application) {
*blockSyncConcurrency,
*compactionConcurrency,
selectorRelabelConf,
*waitInterval,
)
}
}
Expand All @@ -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",
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions docs/components/compact.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d550b6a

Please sign in to comment.