From 25872e2802a4ae32d4f18132d569599295c963cd Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 12 Apr 2015 17:21:02 +1000 Subject: [PATCH] Correct phase count on mysql_upgrade Add static vars on phases to make merging consistent. client/mysql_upgrade --verbose -S /tmp/s.sock Looking for 'mysql' as: client/mysql Looking for 'mysqlcheck' as: client/mysqlcheck Phase 1/4: Fixing views - skipped - not required Phase 2/4: Fixing table and database names Processing databases information_schema mysql performance_schema test Phase 3/4: Checking and upgrading tables Processing databases information_schema mysql mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK mysql.help_topic OK mysql.host OK mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.servers OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK performance_schema test Phase 4/4: Running 'mysql_fix_privilege_tables'... OK --- client/mysql_upgrade.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index c2da47b370c..fd4df9a9ffb 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -36,6 +36,8 @@ # endif #endif +static int phase = 1; +static int phases_total = 4; static char mysql_path[FN_REFLEN]; static char mysqlcheck_path[FN_REFLEN]; @@ -738,7 +740,7 @@ static void print_conn_args(const char *tool_name) static int run_mysqlcheck_upgrade(void) { - verbose("Phase 2/3: Checking and upgrading tables"); + verbose("Phase %d/%d: Checking and upgrading tables", phase++, phases_total); print_conn_args("mysqlcheck"); return run_tool(mysqlcheck_path, NULL, /* Send output from mysqlcheck directly to screen */ @@ -779,8 +781,11 @@ static my_bool is_mysql() static int run_mysqlcheck_views(void) { if (!is_mysql()) + { + verbose("Phase %d/%d: Fixing views - skipped - not required", phase++, phases_total); return 0; - verbose("Phase 0: Fixing views"); + } + verbose("Phase %d/%d: Fixing views", phase++, phases_total); print_conn_args("mysqlcheck"); return run_tool(mysqlcheck_path, NULL, /* Send output from mysqlcheck directly to screen */ @@ -796,7 +801,7 @@ static int run_mysqlcheck_views(void) static int run_mysqlcheck_fixnames(void) { - verbose("Phase 1/3: Fixing table and database names"); + verbose("Phase %d/%d: Fixing table and database names", phase++, phases_total); print_conn_args("mysqlcheck"); return run_tool(mysqlcheck_path, NULL, /* Send output from mysqlcheck directly to screen */ @@ -877,7 +882,7 @@ static int run_sql_fix_privilege_tables(void) if (init_dynamic_string(&ds_result, "", 512, 512)) die("Out of memory"); - verbose("Phase 3/3: Running 'mysql_fix_privilege_tables'..."); + verbose("Phase %d/%d: Running 'mysql_fix_privilege_tables'...", phase++, phases_total); run_query(mysql_fix_privilege_tables, &ds_result, /* Collect result */ TRUE);