buildfarmjob schema is inefficient for reporting
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Critical
|
William Grant |
Bug Description
We do queries like 'what packages failed to build ordered by date'. Bugs like bug 730396 bug 739066 bug 739065 may/are symptoms of this.
Broadly when the following is true:
- the dataset in a table is larger than we want to evaluate & sort every page load (implies we want an index for sorted results)
then
- we need to be able to filter the results for any query to a sensible subset on that table
This is because when there is an index matching the sort order, postgresql will strongly prefer to iterate that rather than loading all the results and doing an in-memory sort.
The BuildFarmJob collection:
BuildFarmJob(
BuildFarmJob(
BuildFarmJob(
fails the 'able to filter' criteria: these three different combinations always appear together:
BPB always has a PB always has a BFJ
DPRB always has a PB always has a BFJ
TTB always has a BFJ
But the filtering (e.g. on branch for TTB) is separated from the ordering (e.g. date in BFJ).
As these three combinations act as a single object consistently, the simplest thing is to fold them all together: roll BFJ+PB into PBP, roll BFJ+PB into SPRB and roll BFJ into TTB.
BFJ is 200MB (2M rows)
PB is 100MB (2M rows)
BPB is 91MB (2M rows)
SPRB is < 1MB (20K rows)
TTB is < 1MB (4300 rows)
SPRB and TTB could be migrated during downtime, but the BPB migration will have to be done online via a garbo migration script.
Related branches
- Stuart Bishop (community): Approve (db)
-
Diff: 94 lines (+79/-0)2 files modifieddatabase/schema/patch-2209-41-0.sql (+78/-0)
database/schema/security.cfg (+1/-0)
- Steve Kowalik (community): Approve (code)
-
Diff: 682 lines (+248/-72)10 files modifiedlib/lp/buildmaster/interfaces/packagebuild.py (+2/-10)
lib/lp/buildmaster/model/buildfarmjob.py (+16/-9)
lib/lp/buildmaster/model/packagebuild.py (+6/-15)
lib/lp/buildmaster/tests/test_packagebuild.py (+4/-3)
lib/lp/code/model/sourcepackagerecipebuild.py (+67/-10)
lib/lp/soyuz/model/binarypackagebuild.py (+84/-14)
lib/lp/soyuz/scripts/gina/handlers.py (+3/-3)
lib/lp/soyuz/tests/test_binarypackagebuild.py (+20/-0)
lib/lp/soyuz/tests/test_hasbuildrecords.py (+7/-3)
lib/lp/translations/model/translationtemplatesbuild.py (+39/-5)
- Steve Kowalik (community): Approve (code)
-
Diff: 543 lines (+380/-1)5 files modifieddatabase/schema/security.cfg (+4/-0)
lib/lp/scripts/garbo.py (+227/-0)
lib/lp/scripts/tests/test_garbo.py (+136/-1)
lib/lp/soyuz/interfaces/binarypackagebuild.py (+3/-0)
lib/lp/soyuz/model/binarypackagebuild.py (+10/-0)
- Steve Kowalik (community): Approve (code)
-
Diff: 1290 lines (+261/-339)20 files modifieddatabase/sampledata/current-dev.sql (+48/-48)
database/sampledata/current.sql (+48/-48)
lib/lp/buildmaster/interfaces/buildfarmjob.py (+2/-0)
lib/lp/buildmaster/interfaces/packagebuild.py (+0/-4)
lib/lp/buildmaster/model/buildfarmjob.py (+11/-17)
lib/lp/buildmaster/model/packagebuild.py (+4/-8)
lib/lp/code/model/sourcepackagerecipe.py (+44/-47)
lib/lp/code/model/sourcepackagerecipebuild.py (+5/-7)
lib/lp/registry/model/sourcepackage.py (+7/-7)
lib/lp/soyuz/doc/sourcepackagerelease.txt (+1/-3)
lib/lp/soyuz/interfaces/binarypackagebuild.py (+0/-4)
lib/lp/soyuz/model/archive.py (+27/-47)
lib/lp/soyuz/model/binarypackagebuild.py (+39/-46)
lib/lp/soyuz/model/buildpackagejob.py (+7/-13)
lib/lp/soyuz/model/distributionsourcepackagerelease.py (+1/-5)
lib/lp/soyuz/model/publishing.py (+5/-10)
lib/lp/soyuz/model/sourcepackagerelease.py (+6/-14)
lib/lp/soyuz/tests/test_archive.py (+3/-6)
lib/lp/translations/interfaces/translationtemplatesbuild.py (+1/-5)
lib/lp/translations/model/translationtemplatesbuild.py (+2/-0)
- Steve Kowalik (community): Approve (code)
-
Diff: 817 lines (+126/-256)18 files modifiedlib/lp/buildmaster/configure.zcml (+0/-6)
lib/lp/buildmaster/interfaces/buildfarmjob.py (+9/-0)
lib/lp/buildmaster/interfaces/packagebuild.py (+0/-17)
lib/lp/buildmaster/model/buildfarmjob.py (+35/-18)
lib/lp/buildmaster/model/packagebuild.py (+0/-43)
lib/lp/buildmaster/tests/test_buildfarmjob.py (+27/-2)
lib/lp/buildmaster/tests/test_packagebuild.py (+0/-42)
lib/lp/code/model/sourcepackagerecipebuild.py (+9/-21)
lib/lp/soyuz/browser/tests/test_queue.py (+1/-1)
lib/lp/soyuz/interfaces/publishing.py (+2/-5)
lib/lp/soyuz/model/archive.py (+4/-4)
lib/lp/soyuz/model/binarypackagebuild.py (+17/-44)
lib/lp/soyuz/model/publishing.py (+4/-11)
lib/lp/soyuz/model/queue.py (+0/-1)
lib/lp/soyuz/scripts/retrydepwait.py (+9/-15)
lib/lp/soyuz/tests/test_hasbuildrecords.py (+3/-14)
lib/lp/soyuz/tests/test_packageupload.py (+1/-1)
lib/lp/translations/model/translationtemplatesbuild.py (+5/-11)
- Steve Kowalik (community): Approve (code)
-
Diff: 365 lines (+32/-91)9 files modifiedlib/lp/buildmaster/model/buildfarmjob.py (+9/-31)
lib/lp/buildmaster/model/packagebuild.py (+3/-4)
lib/lp/buildmaster/tests/test_buildfarmjob.py (+0/-7)
lib/lp/buildmaster/tests/test_manager.py (+0/-1)
lib/lp/buildmaster/tests/test_packagebuild.py (+1/-2)
lib/lp/code/model/sourcepackagerecipebuild.py (+8/-19)
lib/lp/code/model/tests/test_sourcepackagerecipebuild.py (+2/-8)
lib/lp/soyuz/model/binarypackagebuild.py (+8/-18)
lib/lp/translations/model/translationtemplatesbuild.py (+1/-1)
- William Grant: Approve (code)
-
Diff: 543 lines (+1/-380)5 files modifieddatabase/schema/security.cfg (+0/-4)
lib/lp/scripts/garbo.py (+0/-227)
lib/lp/scripts/tests/test_garbo.py (+1/-136)
lib/lp/soyuz/interfaces/binarypackagebuild.py (+0/-3)
lib/lp/soyuz/model/binarypackagebuild.py (+0/-10)
- William Grant: Approve (code)
-
Diff: 27 lines (+23/-0)1 file modifieddatabase/schema/patch-2209-41-1.sql (+23/-0)
- Stuart Bishop (community): Approve (db)
-
Diff: 16 lines (+12/-0)1 file modifieddatabase/schema/patch-2209-41-2.sql (+12/-0)
- Steve Kowalik (community): Approve (code)
-
Diff: 1229 lines (+186/-489)17 files modifiedlib/lp/buildmaster/configure.zcml (+0/-13)
lib/lp/buildmaster/interfaces/packagebuild.py (+1/-30)
lib/lp/buildmaster/model/buildfarmjob.py (+7/-48)
lib/lp/buildmaster/model/packagebuild.py (+5/-101)
lib/lp/buildmaster/tests/test_manager.py (+1/-1)
lib/lp/buildmaster/tests/test_packagebuild.py (+2/-73)
lib/lp/code/model/sourcepackagerecipe.py (+15/-15)
lib/lp/code/model/sourcepackagerecipebuild.py (+46/-50)
lib/lp/soyuz/doc/sourcepackagerelease.txt (+1/-1)
lib/lp/soyuz/model/archive.py (+9/-13)
lib/lp/soyuz/model/binarypackagebuild.py (+72/-88)
lib/lp/soyuz/model/distributionsourcepackagerelease.py (+1/-2)
lib/lp/soyuz/model/publishing.py (+4/-7)
lib/lp/soyuz/model/queue.py (+0/-1)
lib/lp/soyuz/scripts/retrydepwait.py (+1/-1)
lib/lp/soyuz/tests/test_binarypackagebuild.py (+0/-20)
lib/lp/translations/model/translationtemplatesbuild.py (+21/-25)
- William Grant: Approve (db)
-
Diff: 62 lines (+58/-0)1 file modifieddatabase/schema/patch-2209-41-3.sql (+58/-0)
- Steve Kowalik (community): Approve (code)
- Diff: 0 lines
- Stuart Bishop (community): Approve (db)
-
Diff: 526 lines (+156/-192)5 files modifieddatabase/sampledata/current-dev.sql (+48/-82)
database/sampledata/current.sql (+48/-82)
database/schema/comments.sql (+0/-16)
database/schema/patch-2209-41-5.sql (+60/-0)
database/schema/security.cfg (+0/-12)
- William Grant: Approve (db)
-
Diff: 58 lines (+54/-0)1 file modifieddatabase/schema/patch-2209-41-4.sql (+54/-0)
Changed in launchpad: | |
assignee: | nobody → Launchpad Green Squad (launchpad-green-squad) |
Changed in launchpad: | |
assignee: | Launchpad Green Squad (launchpad-green-squad) → William Grant (wgrant) |
status: | Triaged → In Progress |
Changed in launchpad: | |
assignee: | William Grant (wgrant) → nobody |
Changed in launchpad: | |
status: | In Progress → Triaged |
tags: | added: analysis critical |
tags: |
added: critical-analysus removed: analysis critical |
tags: |
added: critical-analysis removed: critical-analysus |
Changed in launchpad: | |
assignee: | nobody → William Grant (wgrant) |
status: | Triaged → In Progress |
tags: |
added: qa-ok removed: qa-needstesting |
tags: |
added: qa-ok removed: qa-needstesting |
tags: |
added: qa-ok removed: qa-needstesting |
tags: |
added: qa-ok removed: qa-needstesting |
tags: |
added: qa-ok removed: qa-needstesting |
Changed in launchpad: | |
status: | Fix Committed → Fix Released |
I've landed the migration that can be deployed before the next DB downtime. Before that downtime we should add new columns (part of the patches in the attached branches), with triggers and garbo jobs to populate them. Then the remaining bits of these two branches should land, migrating to the new flat tables.