diff options
author | mkanat%bugzilla.org <> | 2007-03-09 11:34:05 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2007-03-09 11:34:05 +0000 |
commit | f26ceb85a7ee96d66523fe75c9ed94e48660beed (patch) | |
tree | a15a6965010f7be192c29f802c9a93b0d42c1666 /Bugzilla/DB/Mysql.pm | |
parent | a3add1d45f66b3e9805dac8ba0d22bf71ffae4cf (diff) | |
download | bugs-f26ceb85a7ee96d66523fe75c9ed94e48660beed.tar bugs-f26ceb85a7ee96d66523fe75c9ed94e48660beed.tar.gz bugs-f26ceb85a7ee96d66523fe75c9ed94e48660beed.tar.bz2 bugs-f26ceb85a7ee96d66523fe75c9ed94e48660beed.tar.xz bugs-f26ceb85a7ee96d66523fe75c9ed94e48660beed.zip |
Bug 347475: [MySQL] Use InnoDB for most tables
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
Diffstat (limited to 'Bugzilla/DB/Mysql.pm')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 9b4102eb6..dc8ad2ef2 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -46,6 +46,7 @@ use strict; use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::Error; +use Bugzilla::DB::Schema::Mysql; # This module extends the DB interface via inheritance use base qw(Bugzilla::DB); @@ -260,10 +261,10 @@ sub bz_setup_database { # to type MyISAM if so. ISAM tables are deprecated in MySQL 3.23, # which Bugzilla now requires, and they don't support more than 16 # indexes per table, which Bugzilla needs. - my $sth = $self->prepare("SHOW TABLE STATUS"); - $sth->execute; - my @isam_tables = (); - while (my ($name, $type) = $sth->fetchrow_array) { + my $table_status = $self->selectall_arrayref("SHOW TABLE STATUS"); + my @isam_tables; + foreach my $row (@$table_status) { + my ($name, $type) = @$row; push(@isam_tables, $name) if $type eq "ISAM"; } @@ -281,6 +282,27 @@ sub bz_setup_database { print "\nISAM->MyISAM table conversion done.\n\n"; } + # Upgrade tables from MyISAM to InnoDB + my @myisam_tables; + foreach my $row (@$table_status) { + my ($name, $type) = @$row; + if ($type =~ /^MYISAM$/i + && !grep($_ eq $name, Bugzilla::DB::Schema::Mysql::MYISAM_TABLES)) + { + push(@myisam_tables, $name) ; + } + } + if (scalar @myisam_tables) { + print "Bugzilla now uses the InnoDB storage engine in MySQL for", + " most tables.\nConverting tables to InnoDB:\n"; + foreach my $table (@myisam_tables) { + print "Converting table $table... "; + $self->do("ALTER TABLE $table TYPE = InnoDB"); + print "done.\n"; + } + } + + # There is a bug in MySQL 4.1.0 - 4.1.15 that makes certain SELECT # statements fail after a SHOW TABLE STATUS: # http://bugs.mysql.com/bug.php?id=13535 |