diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d8c82db3..a843f4839b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#4680](https://github.com/thanos-io/thanos/pull/4680) Query: add `exemplar.partial-response` flag to control partial response. - [#4679](https://github.com/thanos-io/thanos/pull/4679) Added `enable-feature` flag to enable negative offsets and @ modifier, similar to Prometheus. - [#4696](https://github.com/thanos-io/thanos/pull/4696) Query: add cache name to tracing spans. +- [#4764](https://github.com/thanos-io/thanos/pull/4764) Compactor: add `block-viewer.global.sync-block-timeout` flag to set the timeout of synchronization block metas. ### Fixed diff --git a/cmd/thanos/compact.go b/cmd/thanos/compact.go index 2ae488de6d..b4ff8f5690 100644 --- a/cmd/thanos/compact.go +++ b/cmd/thanos/compact.go @@ -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) @@ -576,6 +576,7 @@ type compactConfig struct { blockSyncConcurrency int blockMetaFetchConcurrency int blockViewerSyncBlockInterval time.Duration + blockViewerSyncBlockTimeout time.Duration cleanupBlocksInterval time.Duration compactionConcurrency int downsampleConcurrency int @@ -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) diff --git a/docs/components/compact.md b/docs/components/compact.md index ce1a796b36..8b662a88e7 100644 --- a/docs/components/compact.md +++ b/docs/components/compact.md @@ -284,6 +284,10 @@ Flags: Repeat interval for syncing the blocks between local and remote view for /global Block Viewer UI. + --block-viewer.global.sync-block-timeout=5m + Maximum time for syncing the blocks between + local and remote view for /global Block Viewer + UI. --bucket-web-label=BUCKET-WEB-LABEL Prometheus label to use as timeline title in the bucket web UI