allow applying retention at different interval than compaction with a config #4736
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
When retention is enabled, we apply it with each compaction run. This causes a lot of resources to be wasted in a big Loki cluster which also causes compaction to not be able to keep up. Since applying retention is not as critical as compacting the data for better query performance, the apply retention interval can be set to a higher value than the compaction interval.
Special notes for your reviewer:
To keep it backwards compatible, I have allowed setting the apply retention interval to 0, which is the default. A zero value here means applying retention at the same time as compaction.
When a non-zero value is set, it should be a multiple of compaction interval because we would always apply retention when running compaction which is optimum and a pre-requisite for applying retention.
Checklist
CHANGELOG.md
about the changes.