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 <christi.schlotter@gmail.com>
  • Loading branch information
chrischdi committed Jun 10, 2020
1 parent e3afdfa commit c1b62fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/thanos/compact.go
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
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 c1b62fb

Please sign in to comment.