Code review comment for lp:~edwin-grubbs/launchpad/bug-535430-needspackaging-timeout-part3

Revision history for this message
Stuart Bishop (stub) wrote :

The first INSERT needs an ORDER BY clause, or we could end up with inconsistent data between the master and slave databases:

INSERT INTO DistributionSourcePackage (distribution,sourcepackagename)
SELECT ds.distribution, sourcepackagename
FROM SourcePackagePublishingHistory spph
JOIN Archive ON spph.archive = Archive.id
JOIN SourcePackageRelease spr ON spph.sourcepackagerelease = spr.id
JOIN DistroSeries ds ON spph.distroseries = ds.id
WHERE ds.releasestatus = 4 -- CURRENT
    AND Archive.purpose = 1 -- PRIMARY
EXCEPT
SELECT distribution, sourcepackagename
FROM DistributionSourcePackage
ORDER BY distribution, sourcepackagename;

We also need to repack the table when we are done, so add at the end:

CLUSTER DistributionSourcePackage
    USING distributionpackage__sourcepackagename__distribution__key;

review: Approve (db)

« Back to merge proposal