AuditLog archive: orphaned files of an interrupted archive write are never cleaned up #114
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.tmpor renamed data files without a.manifest.jsonin{Directory}/{YYYY}; nothing ever removes them (the archive path does best-effortTryDeleteof its own.tmpfiles only when it catches the failure).Proposal: in the cleanup pass, delete
.tmpfiles and manifest-lessauditlog-*.parquetfiles 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.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).