Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
f26ceb85
Commit
f26ceb85
authored
Mar 09, 2007
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 347475: [MySQL] Use InnoDB for most tables
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
parent
a3add1d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
Mysql.pm
Bugzilla/DB/Mysql.pm
+26
-4
Mysql.pm
Bugzilla/DB/Schema/Mysql.pm
+4
-1
No files found.
Bugzilla/DB/Mysql.pm
View file @
f26ceb85
...
@@ -46,6 +46,7 @@ use strict;
...
@@ -46,6 +46,7 @@ use strict;
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Util
;
use
Bugzilla::
Util
;
use
Bugzilla::
Error
;
use
Bugzilla::
Error
;
use
Bugzilla::DB::Schema::
Mysql
;
# This module extends the DB interface via inheritance
# This module extends the DB interface via inheritance
use
base
qw(Bugzilla::DB)
;
use
base
qw(Bugzilla::DB)
;
...
@@ -260,10 +261,10 @@ sub bz_setup_database {
...
@@ -260,10 +261,10 @@ sub bz_setup_database {
# to type MyISAM if so. ISAM tables are deprecated in MySQL 3.23,
# 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
# which Bugzilla now requires, and they don't support more than 16
# indexes per table, which Bugzilla needs.
# indexes per table, which Bugzilla needs.
my
$
sth
=
$self
->
prepare
(
"SHOW TABLE STATUS"
);
my
$
table_status
=
$self
->
selectall_arrayref
(
"SHOW TABLE STATUS"
);
$sth
->
execute
;
my
@isam_tables
;
my
@isam_tables
=
();
foreach
my
$row
(
@$table_status
)
{
while
(
my
(
$name
,
$type
)
=
$sth
->
fetchrow_array
)
{
my
(
$name
,
$type
)
=
@$row
;
push
(
@isam_tables
,
$name
)
if
$type
eq
"ISAM"
;
push
(
@isam_tables
,
$name
)
if
$type
eq
"ISAM"
;
}
}
...
@@ -281,6 +282,27 @@ sub bz_setup_database {
...
@@ -281,6 +282,27 @@ sub bz_setup_database {
print
"\nISAM->MyISAM table conversion done.\n\n"
;
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
# There is a bug in MySQL 4.1.0 - 4.1.15 that makes certain SELECT
# statements fail after a SHOW TABLE STATUS:
# statements fail after a SHOW TABLE STATUS:
# http://bugs.mysql.com/bug.php?id=13535
# http://bugs.mysql.com/bug.php?id=13535
...
...
Bugzilla/DB/Schema/Mysql.pm
View file @
f26ceb85
...
@@ -85,6 +85,8 @@ use constant REVERSE_MAPPING => {
...
@@ -85,6 +85,8 @@ use constant REVERSE_MAPPING => {
# as in their db-specific version, so no reverse mapping is needed.
# as in their db-specific version, so no reverse mapping is needed.
};
};
use
constant
MYISAM_TABLES
=>
qw(longdescs)
;
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
sub
_initialize
{
sub
_initialize
{
...
@@ -130,8 +132,9 @@ sub _get_create_table_ddl {
...
@@ -130,8 +132,9 @@ sub _get_create_table_ddl {
my
(
$self
,
$table
)
=
@_
;
my
(
$self
,
$table
)
=
@_
;
my
$charset
=
Bugzilla
->
dbh
->
bz_db_is_utf8
?
"CHARACTER SET utf8"
:
''
;
my
$charset
=
Bugzilla
->
dbh
->
bz_db_is_utf8
?
"CHARACTER SET utf8"
:
''
;
my
$type
=
grep
(
$_
eq
$table
,
MYISAM_TABLES
)
?
'MYISAM'
:
'InnoDB'
;
return
(
$self
->
SUPER::
_get_create_table_ddl
(
$table
)
return
(
$self
->
SUPER::
_get_create_table_ddl
(
$table
)
.
" ENGINE =
MYISAM
$charset"
);
.
" ENGINE =
$type
$charset"
);
}
#eosub--_get_create_table_ddl
}
#eosub--_get_create_table_ddl
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment