Merge lp:~cjwatson/launchpad/garbo-archivepermission-duplicates into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Colin Watson on 2012-07-18 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15649 |
| Proposed branch: | lp:~cjwatson/launchpad/garbo-archivepermission-duplicates |
| Merge into: | lp:launchpad |
| Diff against target: |
152 lines (+99/-0) 3 files modified
database/schema/security.cfg (+1/-0) lib/lp/scripts/garbo.py (+19/-0) lib/lp/scripts/tests/test_garbo.py (+79/-0) |
| To merge this branch: | bzr merge lp:~cjwatson/launchpad/garbo-archivepermission-duplicates |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Raphaël Badin (community) | 2012-07-18 | Approve on 2012-07-18 | |
| Francesco Banconi (community) | code* | 2012-07-18 | Approve on 2012-07-18 |
|
Review via email:
|
|||
Commit Message
Remove duplicate rows from ArchivePermission, created due to bug 887185.
Description of the Change
== Summary ==
There are some duplicated rows in ArchivePermission left over from an old (fixed) bug. These get in the way because Archive.
== Proposed fix ==
Add a BulkPruner-based garbo job to get rid of the duplicates. Previous analysis showed that the only problems have non-NULL packageset and duplicate person, archive, packageset, permission, so we'll get rid of all but the first id for all such groups.
== LOC Rationale ==
+99, but it will all be removed again once the job has completed.
== Tests ==
bin/test -vvct test_DuplicateA
== Demo and Q/A ==
dogfood's database is already in an appropriately broken state. Dump the archivepermission table, run the garbo job, and dump it again, and then verify that all the removed IDs (there should be 190, I believe) correspond to duplicates and that exactly one of each duplicated group remains.
| Raphaël Badin (rvb) wrote : | # |
Thanks for the cleanup!
The test code could probably be more compact, but, like Francesco noted, this doesn't matter much since this will be ditched eventually.
I didn't know about window functions, I've always used regular aggregate functions to do that kind of stuff. Thanks Colin!
| Colin Watson (cjwatson) wrote : | # |
Right. Some of the repeated code was necessary to deliberately avoid
guards against duplication in the ArchivePermission model; the rest was
just so that the tests were more or less regular.

Thanks Colin, this branch looks good. ons), but I think that's ok since the job will be removed.
It seems the tests contain some repeated code (to create ArchivePermissi
Tests pass, and you said on IRC that you checked the SQL fragment by hand on dogfood.