AuditLog archive: orphaned files of an interrupted archive write are never cleaned up #114

Closed
opened 2026-11-09 23:32:37 -05:00 by dohertj2 · 1 comment
Owner

Follow-up from #109. Archive cleanup (AuditLog:Archive:RetentionDays, superseded stale archives) only deletes well-formed archives with a manifest. An archive write interrupted before its manifest (process killed, volume full mid-write) leaves {name}.parquet.tmp / {name}.tombstones.parquet.tmp or renamed data files without a .manifest.json in {Directory}/{YYYY}; nothing ever removes them (the archive path does best-effort TryDelete of its own .tmp files only when it catches the failure).

Proposal: in the cleanup pass, delete .tmp files and manifest-less auditlog-*.parquet files older than e.g. 24 h (never a file a running archive could still be writing), report them as a new cleanup action, dry-run aware. Low priority — disk only, no correctness impact.

Follow-up from #109. Archive cleanup (`AuditLog:Archive:RetentionDays`, superseded stale archives) only deletes **well-formed archives with a manifest**. An archive write interrupted before its manifest (process killed, volume full mid-write) leaves `{name}.parquet.tmp` / `{name}.tombstones.parquet.tmp` or renamed data files without a `.manifest.json` in `{Directory}/{YYYY}`; nothing ever removes them (the archive path does best-effort `TryDelete` of its own `.tmp` files only when it catches the failure). Proposal: in the cleanup pass, delete `.tmp` files and manifest-less `auditlog-*.parquet` files older than e.g. 24 h (never a file a running archive could still be writing), report them as a new cleanup action, dry-run aware. Low priority — disk only, no correctness impact.
dohertj2 added the type:followuppriority:p3 labels 2026-11-09 23:32:37 -05:00
Author
Owner

Fixed in 533414a1 (main). Archive cleanup now also deletes orphans of an interrupted archive write (action DeletedOrphan, dry-run aware): the writer's own *.parquet.tmp / *.tombstones.parquet.tmp / *.manifest.json.tmp and manifest-less data files, only for well-formed archive names directly inside a 4-digit {Directory}/{YYYY} folder matching the name's year, not reparse points, last written > 24 h ago. Evidence: AuditLogArchiveCleanupTests.InterruptedWriteOrphans_AreRemoved_OnlyWhenOldAndWriterNamed (fresh files, committed archives, foreign/misnamed/wrong-year/wrong-folder files survive); mutation-proved (removing the age check or the manifest check fails it).

Fixed in 533414a1 (main). Archive cleanup now also deletes orphans of an interrupted archive write (action DeletedOrphan, dry-run aware): the writer's own *.parquet.tmp / *.tombstones.parquet.tmp / *.manifest.json.tmp and manifest-less data files, only for well-formed archive names directly inside a 4-digit {Directory}/{YYYY} folder matching the name's year, not reparse points, last written > 24 h ago. Evidence: AuditLogArchiveCleanupTests.InterruptedWriteOrphans_AreRemoved_OnlyWhenOldAndWriterNamed (fresh files, committed archives, foreign/misnamed/wrong-year/wrong-folder files survive); mutation-proved (removing the age check or the manifest check fails it).
Sign in to join this conversation.