Skip to content

Commit

Permalink
add block-viewer.global.sync-block-timeout for sync block metas
Browse files Browse the repository at this point in the history
Signed-off-by: zizhao zhao <btw515wolf2@gmail.com>
  • Loading branch information
ianwoolf committed Oct 10, 2021
1 parent dde2cae commit cb6f0ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/thanos/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,14 @@ func runCompact(
}

g.Add(func() error {
iterCtx, iterCancel := context.WithTimeout(ctx, conf.waitInterval)
iterCtx, iterCancel := context.WithTimeout(ctx, conf.blockViewerSyncBlockTimeout)
_, _, _ = f.Fetch(iterCtx)
iterCancel()

// For /global state make sure to fetch periodically.
return runutil.Repeat(conf.blockViewerSyncBlockInterval, ctx.Done(), func() error {
return runutil.RetryWithLog(logger, time.Minute, ctx.Done(), func() error {
iterCtx, iterCancel := context.WithTimeout(ctx, conf.waitInterval)
iterCtx, iterCancel := context.WithTimeout(ctx, conf.blockViewerSyncBlockTimeout)
defer iterCancel()

_, _, err := f.Fetch(iterCtx)
Expand Down Expand Up @@ -576,6 +576,7 @@ type compactConfig struct {
blockSyncConcurrency int
blockMetaFetchConcurrency int
blockViewerSyncBlockInterval time.Duration
blockViewerSyncBlockTimeout time.Duration
cleanupBlocksInterval time.Duration
compactionConcurrency int
downsampleConcurrency int
Expand Down Expand Up @@ -634,6 +635,8 @@ func (cc *compactConfig) registerFlag(cmd extkingpin.FlagClause) {
Default("32").IntVar(&cc.blockMetaFetchConcurrency)
cmd.Flag("block-viewer.global.sync-block-interval", "Repeat interval for syncing the blocks between local and remote view for /global Block Viewer UI.").
Default("1m").DurationVar(&cc.blockViewerSyncBlockInterval)
cmd.Flag("block-viewer.global.sync-block-timeout", "Maximum time for syncing the blocks between local and remote view for /global Block Viewer UI.").
Default("5m").DurationVar(&cc.blockViewerSyncBlockTimeout)
cmd.Flag("compact.cleanup-interval", "How often we should clean up partially uploaded blocks and blocks with deletion mark in the background when --wait has been enabled. Setting it to \"0s\" disables it - the cleaning will only happen at the end of an iteration.").
Default("5m").DurationVar(&cc.cleanupBlocksInterval)

Expand Down

0 comments on commit cb6f0ce

Please sign in to comment.