From 1b7283732324c4a7cc491719d3d8875344660f7d Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Tue, 16 Apr 2024 14:50:46 +0200 Subject: [PATCH] compactor: add flag to disable cleanup of partial uploads Signed-off-by: Michael Hoffmann --- CHANGELOG.md | 1 + cmd/thanos/compact.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc305967be..78b9e7d864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7123](https://github.com/thanos-io/thanos/pull/7123) Rule: Change default Alertmanager API version to v2. - [#7223](https://github.com/thanos-io/thanos/pull/7223) Automatic detection of memory limits and configure GOMEMLIMIT to match. - [#7282](https://github.com/thanos-io/thanos/pull/7282) Fetcher: mark metas with incomplete files as corrupted. +- [#7282](https://github.com/thanos-io/thanos/pull/7282) Compactor: add flag to disable cleanup of partial uploads ### Removed diff --git a/cmd/thanos/compact.go b/cmd/thanos/compact.go index 8923bd376e..1b408f6d6b 100644 --- a/cmd/thanos/compact.go +++ b/cmd/thanos/compact.go @@ -419,6 +419,10 @@ func runCompact( var cleanMtx sync.Mutex // TODO(GiedriusS): we could also apply retention policies here but the logic would be a bit more complex. cleanPartialMarked := func() error { + if !conf.cleanupPartialUploads { + level.Info(logger).Log("msg", "cleanup of partial uploads is disabled, skipping") + return nil + } cleanMtx.Lock() defer cleanMtx.Unlock() @@ -724,6 +728,7 @@ type compactConfig struct { progressCalculateInterval time.Duration filterConf *store.FilterConfig disableAdminOperations bool + cleanupPartialUploads bool } func (cc *compactConfig) registerFlag(cmd extkingpin.FlagClause) { @@ -837,4 +842,6 @@ func (cc *compactConfig) registerFlag(cmd extkingpin.FlagClause) { cmd.Flag("bucket-web-label", "External block label to use as group title in the bucket web UI").StringVar(&cc.label) cmd.Flag("disable-admin-operations", "Disable UI/API admin operations like marking blocks for deletion and no compaction.").Default("false").BoolVar(&cc.disableAdminOperations) + cmd.Flag("compact.cleanup-partial-uploads", "Enable cleanup of partial uploads"). + Hidden().Default("true").BoolVar(&cc.cleanupPartialUploads) }