Skip to content

Commit 0b0ec9a

Browse files
authored
per tenant compactor backlogs (#120)
2 parents b480301 + 67565b9 commit 0b0ec9a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cmd/thanos/compact.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@ func runCompact(
462462
}
463463

464464
compactMainFn := func() error {
465+
// this should happen before any compaction to remove unnecessary process on backlogs beyond retention.
466+
if err := compact.ApplyRetentionPolicyByTenant(ctx, logger, insBkt, sy.Metas(), retentionByTenant, compactMetrics.blocksMarked.WithLabelValues(metadata.DeletionMarkFilename, metadata.TenantRetentionExpired)); err != nil {
467+
return errors.Wrap(err, "retention by tenant failed")
468+
}
469+
465470
if err := compactor.Compact(ctx); err != nil {
466471
return errors.Wrap(err, "whole compaction error")
467472
}
@@ -540,10 +545,6 @@ func runCompact(
540545
return errors.Wrap(err, "sync before retention")
541546
}
542547

543-
if err := compact.ApplyRetentionPolicyByTenant(ctx, logger, insBkt, sy.Metas(), retentionByTenant, compactMetrics.blocksMarked.WithLabelValues(metadata.DeletionMarkFilename, metadata.TenantRetentionExpired)); err != nil {
544-
return errors.Wrap(err, "retention by tenant failed")
545-
}
546-
547548
if err := compact.ApplyRetentionPolicyByResolution(ctx, logger, insBkt, sy.Metas(), retentionByResolution, compactMetrics.blocksMarked.WithLabelValues(metadata.DeletionMarkFilename, "")); err != nil {
548549
return errors.Wrap(err, "retention failed")
549550
}

0 commit comments

Comments
 (0)