Code review comment for lp:~al-maisan/launchpad/psds-399186

Muharem Hrnjadovic (al-maisan) wrote :

Hello there!

The branch at hand introduces the association between package sets and
distro series as well as a new table ('packagesetgroup') that
facilitates the tracking of equivalent package sets across distro series
boundaries.

For more detail on these changes and why they are needed, please see:

  * the original "package set and distro series" meeting minutes:
    http://pastebin.ubuntu.com/302054/
  * Julian's update: http://pastebin.ubuntu.com/302058/

Please note also that the only change introduced to the underlying
trigger procedures was to make sure that when a package set P includes
another package set Q then both P and Q must belong to the same distro
series.

I have tested the schema patch at hand, particularly the data migration
part and the additional trigger procedure check using a SQL script
(http://pastebin.ubuntu.com/302082 = some play data + plus the schema
patch + plus the stricter trigger procedure) against the unpatched
database as follows:

{{{
$ psql -d launchpad_dev -f /tmp/patch.sql
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
CREATE SEQUENCE
CREATE TABLE
ALTER SEQUENCE
psql:/tmp/patch.sql:74: NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "packagesetgroup_pkey" for table "packagesetgroup"
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
INSERT 0 5
UPDATE 5
UPDATE 3
ALTER TABLE
ALTER TABLE
UPDATE 5
UPDATE 4
ALTER TABLE
ALTER TABLE
psql:/tmp/patch.sql:129: NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "packageset__name__distroseries__key" for table "packageset"
ALTER TABLE
UPDATE 4
INSERT 0 1
UPDATE 1
ALTER TABLE
ALTER TABLE
CREATE INDEX
CREATE INDEX
CREATE FUNCTION

$ psql -d launchpad_dev
Welcome to psql 8.3.8, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

-----------------------------------------------------------------------
--
-- Please note below how the
-- * appropiate package set groups have been created
-- * equivalent package sets have been associated
--
-----------------------------------------------------------------------
launchpad_dev=# SELECT ps.packagesetgroup, ps.id AS packageset, ps.name AS ps_name, ds.name AS ds_name FROM packageset ps, distroseries ds WHERE ps.distroseries = ds.id ORDER BY ps.packagesetgroup, ps.id;
 packagesetgroup | packageset | ps_name | ds_name
-----------------+------------+-------------+---------
               1 | 1 | umbrella | karmic
               2 | 2 | deprecated | karmic
               3 | 3 | mozilla | karmic
               3 | 6 | mozilla | lucid
               4 | 4 | firefox | karmic
               4 | 7 | firefox | lucid
               5 | 5 | thunderbird | karmic
               5 | 8 | thunderbird | lucid
               6 | 9 | only | lucid
(9 rows)

-----------------------------------------------------------------------
--
-- Package sets belonging to the same distro series may still include
-- each other.
--
-----------------------------------------------------------------------
launchpad_dev=# INSERT INTO packagesetinclusion(parent, child)
    SELECT superset.id AS parent, subset.id AS child
    FROM packageset superset, packageset subset
    WHERE superset.name = 'mozilla' AND subset.name = 'firefox' AND
    superset.distroseries = subset.distroseries;
INSERT 0 2

-----------------------------------------------------------------------
--
-- An attempt to include package sets belonging to different distro series
-- triggers an exception.
--
-----------------------------------------------------------------------
launchpad_dev=# INSERT INTO packagesetinclusion(parent, child)
    SELECT superset.id AS parent, subset.id AS child
    FROM packageset superset, packageset subset
    WHERE superset.name = 'mozilla' AND subset.name = 'firefox' AND
    superset.distroseries != subset.distroseries;
ERROR: Package sets firefox and mozilla belong to different distro series (to lucid and karmic respectively) and thus cannot be associated.
}}}

« Back to merge proposal