Script to selectively convert MyISAM tables to InnoDB

Summary:
A bunch of the .sql patch files don't explicitly specify the table engine, but
we should always use InnoDB with the exception of one table which needs MyISAM
for FULLTEXT.

MySQL doesn't no-op an ALTER TABLE statment that changes the engine back to
itself and converting large tables can be time consuming, so convert only the
required tables.

Test Plan: Ran on secure.phabricator.com and my local box, it fixed all the
issues in about 3 seconds on secure.phabricator.com and <<1 second on my local.
Reviewed By: codeblock
Reviewers: codeblock, tuomaspelkonen, jungejason, aran
CC: aran, epriestley, codeblock
Differential Revision: 641
This commit is contained in:
epriestley
2011-07-11 10:46:54 -07:00
parent 36e00db564
commit 467308dd12
3 changed files with 68 additions and 18 deletions

View File

@@ -137,16 +137,21 @@ END;
$port = null;
}
list($stdout, $stderr) = execx(
"mysql --user=%s --password=%s --host=%s {$port} < %s",
$conn_user,
$conn_pass,
$conn_bare_hostname,
$patch['path']);
if (preg_match('/\.php$/', $patch['path'])) {
$schema_conn = $conn;
require_once $patch['path'];
} else {
list($stdout, $stderr) = execx(
"mysql --user=%s --password=%s --host=%s {$port} < %s",
$conn_user,
$conn_pass,
$conn_bare_hostname,
$patch['path']);
if ($stderr) {
print $stderr;
exit(-1);
if ($stderr) {
print $stderr;
exit(-1);
}
}
// Patch was successful, update the db with the latest applied patch version