Skip to content

Conversation

@sandeepsukhani
Copy link
Contributor

@sandeepsukhani sandeepsukhani commented Nov 4, 2025

What this PR does / why we need it:
When retention support was initially introduced to Loki, we stored chunk deletion markers on local disk without any support for storing them on object storage instead. Chunk deletion markers are created for chunks which are supposed to be deleted due to running out of retention or a deletion request. At a large scale, if a large number of chunks are selected in a short span due to a significant change in retention period or a delete request touching too much data, there would be a significant surge in the disk space usage by deletion marker files, which can cause the compactor to run out of disk space.

With this PR, I am adding support for configuring the compactor to store chunk deletion markers in the object storage under a prefix. If the prefix is empty (default), the compactor will, as usual, continue to store the deletion markers on the local disk.

When the compactor is configured to store chunk deletion markers in object storage, the chunk markers are stored in a period-specific object store according to the schema configuration.

Checklist

  • Documentation added
  • Tests updated

@sandeepsukhani sandeepsukhani requested a review from a team as a code owner November 4, 2025 10:32
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

💻 Deploy preview available (feat: Add support for storing chunk deletion markers in object storage instead of local disk):

HorizontalScalingModeDisabled, HorizontalScalingModeMain, HorizontalScalingModeWorker))
cfg.WorkerConfig.RegisterFlagsWithPrefix("compactor.worker.", f)
cfg.JobsConfig.RegisterFlagsWithPrefix("compactor.jobs.", f)
f.StringVar(&cfg.DeletionMarkerObjectStorePrefix, "compactor.deletion-marker-object-store-prefix", "", "Object storage path prefix for storing deletion markers. Leave empty to store deletion markers on local disk.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add rule about trailing slash in this

[max_retries: <int> | default = 3]
# Object storage path prefix for storing deletion markers. Leave empty to store
# deletion markers on local disk.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question re: "local disk" does this require a persistent volume to be configured? Or does this mean storage will be on file system?

Copy link
Contributor Author

@sandeepsukhani sandeepsukhani Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compactor should have a persistent volume attached to it. It already uses the local disk for storing deletion markers. This feature enables operators to use object storage for storing the deletion markers.
However, it does not allow us to run the compactor without a disk because the disk is also needed for other operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants