Skip to content

feat/backfill db - #1986

Open
alanpeixinho wants to merge 2 commits into
kernelci:mainfrom
profusion:feat/backfill-db
Open

feat/backfill db#1986
alanpeixinho wants to merge 2 commits into
kernelci:mainfrom
profusion:feat/backfill-db

Conversation

@alanpeixinho

Copy link
Copy Markdown
Contributor

what it is

Includes a backfill labs command to update old data into using the lab foreign key for builds and tests tables.

How to test

  • Create a new local database, and apply migrations.
  • Insert data from a snapshot or running the ingester.
  • Manually remove lab information from some rows.
  • Run the backfill_lab_ids command with varying parameters.

@alanpeixinho
alanpeixinho marked this pull request as draft July 10, 2026 21:24
@alanpeixinho alanpeixinho changed the title feat/backfill db [WIP] feat/backfill db Jul 10, 2026
@alanpeixinho
alanpeixinho marked this pull request as ready for review July 15, 2026 16:36
@alanpeixinho alanpeixinho changed the title [WIP] feat/backfill db feat/backfill db Jul 15, 2026
@felipebergamin

Copy link
Copy Markdown
Member

@alanpeixinho I think this PR needs a rebase

@felipebergamin felipebergamin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❯ docker compose exec backend poetry run python3 manage.py backfill_lab_ids           
[2026-08-18 20:28:49] Collecting distinct lab names from JSONB...
[2026-08-18 20:28:50]   Found 16 distinct lab names
[2026-08-18 20:28:50] Inserting missing lab names into labs table...
[2026-08-18 20:28:50] Staging builds ids...
[2026-08-18 20:28:50] Builds to backfill: 3075
[2026-08-18 20:28:50]   builds: 3075/3075 (0.2s)
[2026-08-18 20:28:50] Staging tests ids...
[2026-08-18 20:28:51] Tests to backfill: 382421
[2026-08-18 20:28:55]   tests: 50000/382421 (3.9s)
[2026-08-18 20:28:58]   tests: 100000/382421 (7.3s)
[2026-08-18 20:29:02]   tests: 150000/382421 (10.9s)
[2026-08-18 20:29:05]   tests: 200000/382421 (14.7s)
[2026-08-18 20:29:09]   tests: 250000/382421 (18.6s)
[2026-08-18 20:29:14]   tests: 300000/382421 (23.0s)
[2026-08-18 20:29:18]   tests: 350000/382421 (26.8s)
[2026-08-18 20:29:21]   tests: 382421/382421 (29.7s)
[2026-08-18 20:29:21] Done.

  * process historical data to use the lab foreign key

Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
Leave lab_id NULL for shell/k8s* and misc.automatic_lab so backfill
matches ingest _real_lab and does not insert fake labs.

Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
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.

2 participants