Merge lp:~wgrant/launchpad/flatten-bfj-0-db into lp:launchpad/db-devel
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 12306 | ||||||||
Proposed branch: | lp:~wgrant/launchpad/flatten-bfj-0-db | ||||||||
Merge into: | lp:launchpad/db-devel | ||||||||
Diff against target: |
94 lines (+79/-0) 2 files modified
database/schema/patch-2209-41-0.sql (+78/-0) database/schema/security.cfg (+1/-0) |
||||||||
To merge this branch: | bzr merge lp:~wgrant/launchpad/flatten-bfj-0-db | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Bishop (community) | db | Approve | |
Review via email: mp+145540@code.launchpad.net |
Commit message
Add performance denorm columns to BinaryPackageBu
Description of the change
The build farm job schema is being reworked to improve performance. Columns from PackageBuild and BuildFarmJob are being merged into tables that previously delegated to them. The PackageBuild table will end up dying entirely, but BuildFarmJob will remain, a shadow of its former self, to answer questions about Archive:+builds and Builder:+history. Additionally, BinaryPackageBuild is growing new distribution, distroseries, sourcepackagename and is_distro_archive columns to make searches even faster.
This branch contains the main DB changes. BPB and SPRB gain all columns that previously lived on BFJ and PB, and TTB gets everything from BFJ. BPB and SPRB get direct FKs to BFJ, and their FKs to PB become nullable. BFJ gains an archive column to replace PB for use in Archive:+builds, failure_count becomes nullable as it's to be dropped soon, and the started_if_finished constraint dies because date_started is about to as well.
Additionally, BPB gains distribution, distroseries, sourcepackagename and is_distro_archive columns for more efficient searches.
You need indexes on all of the log and upload_log columns or the Librarian Garbage Collector will hate you. This will need to be landed separately and applied live straight after, as there are a several million existing rows.
You can't default date_created and failure_count columns when creating the column without rewriting the entire tables and their indexes. Add the DEFAULTs using separate ALTER TABLE statements and you will be fine.