1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

make mysql_upgrade try to install missing storage engine plugins (MDEV-11942)

This commit is contained in:
Hartmut Holzgraefe
2017-02-07 22:56:28 +01:00
committed by Sergei Golubchik
parent 8f1ca5e311
commit c372388e48

View File

@@ -756,7 +756,6 @@ static void print_conn_args(const char *tool_name)
verbose("Running '%s with default connection arguments", tool_name); verbose("Running '%s with default connection arguments", tool_name);
} }
/* /*
Check and upgrade(if necessary) all tables Check and upgrade(if necessary) all tables
in the server using "mysqlcheck --check-upgrade .." in the server using "mysqlcheck --check-upgrade .."
@@ -926,6 +925,52 @@ static void print_line(char* line)
} }
/*
Check for entries with "Unknown storage engine" in I_S.TABLES,
try to load plugins for these tables if available (MDEV-11942)
*/
static int run_mysqlcheck_engines(void)
{
DYNAMIC_STRING ds_query;
DYNAMIC_STRING ds_result;
/* Trying to identify existing tables with unknown storage engine
Does not work with all engine types yet, and doesn't produce
results for BLACKHOLE without the dummy "WHERE row_format IS NULL"
condition yet. See MDEV-11943 */
const char *query = "SELECT DISTINCT LOWER(REPLACE(REPLACE(table_comment, 'Unknown storage engine ', ''), '\\'', '')) AS engine FROM information_schema.tables WHERE row_format IS NULL AND table_comment LIKE 'Unknown storage engine%'";
if (init_dynamic_string(&ds_query, "", 512, 512))
die("Out of memory");
if (init_dynamic_string(&ds_result, "", 512, 512))
die("Out of memory");
verbose("Checking for tables with unknown storage engine");
run_query(query, &ds_result, TRUE);
{
char *line= ds_result.str;
if (line && *line) {
do
{
line[strlen(line)-1]='\0';
verbose("installing missing plugin for '%s' storage engine", line);
dynstr_set(&ds_query, "INSTALL SONAME 'ha_");
dynstr_append(&ds_query, line); // we simply assume SONAME=ha_ENGINENAME
dynstr_append(&ds_query, "'");
if (run_query(ds_query.str, NULL, TRUE)) {
fprintf(stderr, "... can't install plugin 'ha_%s'\n", line);
}
} while ((line= get_line(line)) && *line);
}
}
}
/* /*
Update all system tables in MySQL Server to current Update all system tables in MySQL Server to current
version using "mysql" to execute all the SQL commands version using "mysql" to execute all the SQL commands
@@ -1131,7 +1176,8 @@ int main(int argc, char **argv)
/* /*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/ */
if (run_mysqlcheck_upgrade(TRUE) || if (run_mysqlcheck_engines() ||
run_mysqlcheck_upgrade(TRUE) ||
run_mysqlcheck_views() || run_mysqlcheck_views() ||
run_sql_fix_privilege_tables() || run_sql_fix_privilege_tables() ||
run_mysqlcheck_fixnames() || run_mysqlcheck_fixnames() ||