Skip to content

feat(services): compact lake files after player erasure - #41

Merged
TheMeinerLP merged 7 commits into
mainfrom
feat/compact-lake-after-erasure
Oct 15, 2026
Merged

TheMeinerLP merged 7 commits into
mainfrom
feat/compact-lake-after-erasure

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Summary

  • corvus-compact: one-shot job that rewrites events and still-existing raw lake files without the sessions of erased players. Streams in bounded batches, uses the ingest staging protocol, swaps files in one catalog transaction under a per-file pg_try_advisory_lock, then purges the old object. Idempotent and resumable (purge_pending).
  • Migration 0005_compaction.sql: erasure_requests.compacted_at, lake_files.replaced_by / purge_pending, view corvus.erased_sessions.
  • API: GET /api/v1/snapshots/{id}/sessions?exclude_erased=true (paged) and GET /api/v1/snapshots/{id}/files (follows replaced_by), role data_scientist. Snapshots stay immutable.
  • Helm: compact CronJob (hourly, hardened like housekeeping), values, schema, helm-unittest.
  • Docs: data-lake section 7, control-plane API, Helm how-to.

Test plan

  • ruff, mypy, 631 unit tests (fakes, no containers)
  • helm lint, helm template, helm unittest
  • integration suite against real PostgreSQL/MinIO (SQL is only covered by statement snapshots)

@TheMeinerLP
TheMeinerLP force-pushed the feat/compact-lake-after-erasure branch from b038819 to 43db09f Compare October 15, 2026 22:15
Rewrite events and raw lake files without the sessions of erased players.
Each file is streamed in bounded batches, uploaded through the staging
protocol and swapped in one catalog transaction under a per-file
advisory lock. Interrupted runs are resumed: replaced objects are
purged on the next run, unreferenced new objects are left to
housekeeping.

Migration 0005 adds erasure_requests.compacted_at,
lake_files.replaced_by and purge_pending, and the erased_sessions view.
Snapshots are immutable, so their manifest still names erased sessions
and files that compaction replaced. Add GET /snapshots/{id}/sessions
with exclude_erased and keyset paging, and GET /snapshots/{id}/files
which follows replaced_by to the live files. Both need the
data_scientist role.
Hourly by default, non-overlapping, hardened like housekeeping, with
service account, network policy, values and schema entries.
…point

Items carry session_id, pseudonym, started_at, segments, labels and the erased flag,
as the ml jobs read them.
…d_at

Job tokens may call the snapshot sessions and files endpoints; the erasure
request output carries compacted_at.
@TheMeinerLP
TheMeinerLP force-pushed the feat/compact-lake-after-erasure branch from 43db09f to bfc29fe Compare October 15, 2026 22:28
@TheMeinerLP
TheMeinerLP merged commit f3eae4c into main Oct 15, 2026
13 checks passed
@TheMeinerLP
TheMeinerLP deleted the feat/compact-lake-after-erasure branch October 15, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant