Skip to content

Commit

Permalink
compact: introduce flag --wait-sync-block-duration
Browse files Browse the repository at this point in the history
Thanos compact currently does metadata sync every minute if `--wait` is
active. Thanos store has a equivalent flag named `sync-block-duration`.
This commit introduces `--wait-sync-block-duration` to be able to
configure the interval via a flag.

Signed-off-by: Schlotter, Christian <[email protected]>
  • Loading branch information
chrischdi committed Jun 10, 2020
1 parent e3afdfa commit d681877
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel
### Added

- [#2671](https://github.com/thanos-io/thanos/pull/2671) Tools: bucket replicate now allows passing repeated `--compaction` and `--resolution` flags.
- [#2752](https://github.com/thanos-io/thanos/pull/2752) Compact: add flag to configure metadata sync interval for the bucket ui

## [v0.13.0](https://github.com/thanos-io/thanos/releases) - IN PROGRESS

Expand Down
5 changes: 4 additions & 1 deletion cmd/thanos/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func runCompact(
iterCancel()

// For /global state make sure to fetch periodically.
return runutil.Repeat(time.Minute, ctx.Done(), func() error {
return runutil.Repeat(conf.waitSyncBlockInterval, ctx.Done(), func() error {
return runutil.RetryWithLog(logger, time.Minute, ctx.Done(), func() error {
iterCtx, iterCancel := context.WithTimeout(ctx, conf.waitInterval)
defer iterCancel()
Expand Down Expand Up @@ -433,6 +433,7 @@ type compactConfig struct {
retentionRaw, retentionFiveMin, retentionOneHr model.Duration
wait bool
waitInterval time.Duration
waitSyncBlockInterval time.Duration
disableDownsampling bool
blockSyncConcurrency int
compactionConcurrency int
Expand Down Expand Up @@ -475,6 +476,8 @@ func (cc *compactConfig) registerFlag(cmd *kingpin.CmdClause) *compactConfig {
Short('w').BoolVar(&cc.wait)
cmd.Flag("wait-interval", "Wait interval between consecutive compaction runs and bucket refreshes. Only works when --wait flag specified.").
Default("5m").DurationVar(&cc.waitInterval)
cmd.Flag("wait-sync-block-interval", "Repeat interval for syncing the blocks between local and remote view.").
Default("1m").DurationVar(&cc.waitSyncBlockInterval)

cmd.Flag("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 possible to render all samples for a human eye anyway").
Expand Down
3 changes: 3 additions & 0 deletions docs/components/compact.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ Flags:
--wait-interval=5m Wait interval between consecutive compaction
runs and bucket refreshes. Only works when
--wait flag specified.
--wait-sync-block-interval=1m
Repeat interval for syncing the blocks between
local and remote view.
--downsampling.disable Disables downsampling. This is not recommended
as querying long time ranges without
non-downsampled data is not efficient and useful
Expand Down

0 comments on commit d681877

Please sign in to comment.