Closed Bug 824346 Opened 12 years ago Closed 12 years ago

The flaginclusions and flagexclusions DB tables have no UNIQUE index

Categories

(Bugzilla :: Database, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: LpSolit, Assigned: dkl)

Details

Attachments

(1 file, 1 obsolete file)

The flaginclusions and flagexclusions DB tables have no UNIQUE index and so it's possible to insert duplicated rows. We already have an index for both tables, they should simply include UNIQUE in them. (The audit_log table also has no such index, but that's another story.)
Assignee: database → dkl
Status: NEW → ASSIGNED
Attachment #709777 - Flags: review?(LpSolit)
Target Milestone: --- → Bugzilla 4.4
Comment on attachment 709777 [details] [diff] [review] Patch to update to unique index on flag clusion tables (v1) >=== modified file 'Bugzilla/Install/DB.pm' >+ foreach my $table ('flaginclusions', 'flagexclusions') { >+ my $idx = $dbh->bz_index_info($table, $table . '_type_id_idx'); Instead of writing |$table . '_type_id_idx'| 3 times, please define: my $index = $table . '_type_id_idx'; right before $idx and use it where appropriate. r=LpSolit with this fix (make sure to retest your patch to not break DB upgrades).
Attachment #709777 - Flags: review?(LpSolit) → review+
Flags: approval4.4+
Flags: approval+
Sorry to need another review but I felt it better to go ahead and extend this patch to also remove any possible duplicates in the flaginclusions/flagexclusions table right before updating the indexes. This will keep a nasty DB error from happening when a Bugzilla already has some duplicates in one or more of those tables. I did test that scenario. Please review. dkl
Attachment #709777 - Attachment is obsolete: true
Attachment #713931 - Flags: review?(LpSolit)
Comment on attachment 713931 [details] [diff] [review] Patch to update to unique index on flag clusion tables (v2) >=== modified file 'Bugzilla/Install/DB.pm' >+ say "Removing duplicated entries from the '$table' table...\n" if @$dupes; Remove \n. say() already includes it. r=LpSolit
Attachment #713931 - Flags: review?(LpSolit) → review+
Added to relnotes for 4.4rc2. Please commit asap.
Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/trunk modified Bugzilla/Install/DB.pm modified Bugzilla/DB/Schema.pm Committed revision 8583. Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/4.4 modified Bugzilla/Install/DB.pm modified Bugzilla/DB/Schema.pm Committed revision 8522. dkl
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: