Skip to content

Commit

Permalink
per tenant compactor backlogs (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnyi authored Dec 21, 2024
2 parents b480301 + 67565b9 commit 0b0ec9a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/thanos/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,11 @@ func runCompact(
}

compactMainFn := func() error {
// this should happen before any compaction to remove unnecessary process on backlogs beyond retention.
if err := compact.ApplyRetentionPolicyByTenant(ctx, logger, insBkt, sy.Metas(), retentionByTenant, compactMetrics.blocksMarked.WithLabelValues(metadata.DeletionMarkFilename, metadata.TenantRetentionExpired)); err != nil {
return errors.Wrap(err, "retention by tenant failed")
}

if err := compactor.Compact(ctx); err != nil {
return errors.Wrap(err, "whole compaction error")
}
Expand Down Expand Up @@ -540,10 +545,6 @@ func runCompact(
return errors.Wrap(err, "sync before retention")
}

if err := compact.ApplyRetentionPolicyByTenant(ctx, logger, insBkt, sy.Metas(), retentionByTenant, compactMetrics.blocksMarked.WithLabelValues(metadata.DeletionMarkFilename, metadata.TenantRetentionExpired)); err != nil {
return errors.Wrap(err, "retention by tenant failed")
}

if err := compact.ApplyRetentionPolicyByResolution(ctx, logger, insBkt, sy.Metas(), retentionByResolution, compactMetrics.blocksMarked.WithLabelValues(metadata.DeletionMarkFilename, "")); err != nil {
return errors.Wrap(err, "retention failed")
}
Expand Down

0 comments on commit 0b0ec9a

Please sign in to comment.