Closed Bug 290277 Opened 20 years ago Closed 20 years ago

Index renaming may fail if misnamed PRIMARY indexes exist

Categories

(Bugzilla :: Installation & Upgrading, defect, P1)

2.19.2
defect

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file)

There are some versions of mysqldump that will incorrectly rename any unique
index on a table to "PRIMARY", if the table doesn't have a primary key.

This means that some people who have restored Bugzilla from a backup have
indexes incorrectly named as "PRIMARY" in their database.

So, for all the tables that have unique indexes but lack a primary key, we
should put a "PRIMARY" index into the "bad_names" hash to be dropped from that
table and re-created if found.
Flags: blocking2.20?
Priority: -- → P1
Target Milestone: --- → Bugzilla 2.20
Assignee: installation → mkanat
Depends on: 289999
Status: NEW → ASSIGNED
OK, this is a pretty straightforward patch. We just tell the index-renaming
code to also look for indexes named "PRIMARY" on any table that currently has a
UNIQUE index but no primary key.
Attachment #180752 - Flags: review?(bugreport)
Comment on attachment 180752 [details] [diff] [review]
Fix indexes named PRIMARY

Wait, I actually have to test something, here, first. :-)
Attachment #180752 - Flags: review?(bugreport)
Comment on attachment 180752 [details] [diff] [review]
Fix indexes named PRIMARY

OK, yeah, this will work, because we already do a backtick on the names of
indexes when we drop them. Normally PRIMARY is a keyword, and it has to be
enclosed in backticks in a SQL command, but we've already done that in
Bugzilla::DB::Schema::Mysql::get_drop_index_ddl.
Attachment #180752 - Flags: review?(bugreport)
"If it's not a regression from 2.18 and it's not a critical problem with
something that's already landed, let's push it off." - Dave
Flags: blocking2.20?
Flags: blocking2.20-
Attachment #180752 - Flags: review?(bugreport) → review+
Flags: approval?
(In reply to comment #4)
> "If it's not a regression from 2.18 and it's not a critical problem with
> something that's already landed, let's push it off." - Dave

This counts as a critical problem with something that's already landed (the
index-renaming code in checksetup.pl).
Flags: blocking2.20-
Flags: blocking2.20+
Flags: approval?
Flags: approval+
Checking in Bugzilla/DB/Mysql.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v  <--  Mysql.pm
new revision: 1.16; previous revision: 1.15
done
Status: ASSIGNED → RESOLVED
Closed: 20 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: