Skip to content

Compactor interrupted during block upload leaves partial blocks in the storage forever #1291

Closed
@pstibrany

Description

@pstibrany

After compactor creates new blocks locally, it starts uploading new blocks to object storage. If compactor is interrupted in the middle of upload (eg. it is asked to shut down), it will stop the upload and leave partial block in the object storage. On restart (before next compaction) compactor will remove blocks from last compaction on disk, but partial blocks in the object storage will stay in the storage forever. Compactor will discover such blocks and will complain about them, but currently it has no logic to delete partial blocks, and we expect that operator investigates what happened.

Compactor could be little smarter, and when it is interrupted during block upload, it could actually try to mark partially uploaded block for deletion. This is safe, because compactor will never attempt to re-upload such block in the future (instead it will run new compaction, producing new block). Marking for deletion would need to be done with new context (possibly with some timeout to avoid blocking shutdown for too long).

Alternative solution may be to have better handling of partial blocks in the storage: When compactor detects partial block, it may "remember" this (in memory), and if this same block is still partial (has no meta.json) after preconfigured period (eg. 6h), compactor could delete the block. With many compactors running, multiple compactors may try to delete the same block after this period, but that's fine.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions