Repository navigation
feat(services): import parquet history into iceberg tables - #148
Merged
Merged
Conversation
Adds corvus-import-parquet, a one-off copy of the live Parquet lake into the Iceberg tables (events, raw, session_ends). Raw payloads are decrypted with the player DEK and joined with their events; erased players and players without a key are skipped and counted. Each commit is tagged with its source in the snapshot summary, so reruns and resumes skip what is already imported. sessions and segments are not imported: their non-nullable columns are not stored in PostgreSQL.
Describes what the import copies and skips, how reruns stay idempotent and where that stops (snapshot expiry), and the operator steps for running it once as a Job.
Snapshot tags expire with the nightly maintenance, so a rerun could copy everything again. Before a file is appended, rows whose key already exists in the Iceberg partition of their date are now dropped (session_id and seq for events and raw, session_id for session_ends). The tag stays as a fast path only. session_ends are imported only for sessions with rows in the Parquet files of their day, and days without Parquet files produce nothing. Ingest has written capture.session_ends since 2026-11-18, so the Postgres sessions of that period were duplicated before.
Drops the caveat that the import had to finish within snapshot retention: rows are now checked against the Iceberg data, so expired snapshot tags no longer matter. Also states which session_ends are imported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Until the switch to Iceberg, every capture was written only to the encrypted Parquet lake. The October captures therefore exist only there, while the dashboards and the training jobs now read the Iceberg tables and see none of them.
This PR adds a one-off command,
corvus-import-parquet, that copies the live Parquet files into the Iceberg tables once. Frames and their payloads are decrypted with each player's key and written next to the session end records, so the old captures sit next to the new ones.Players who were erased are never copied: their rows are skipped, and the run report counts them, as it does rows without a key and sessions the catalog does not know. Session and segment metadata is not copied, because PostgreSQL does not hold the fields the Iceberg tables require for those. Session end records are copied only for sessions that have frames in the lake, and sessions that the live ingest already wrote are left alone.
Running it again is safe. Before a file is written, every row that already exists in the Iceberg table for its date is dropped, so a rerun, a resumed run and a table whose snapshots were expired all copy nothing twice. The dry run reads the same data and writes nothing, so the counts can be checked before the real run. The operator steps for running it once as a Job are in
docs/reference/data-lake.md.Known gap: the compact template does not carry the key secret, so the one-off Job needs the same secret as ingest.