Commit 23c0cf38 authored by Alexey Kopytov's avatar Alexey Kopytov

Bug #44638: mysql_upgrade, mysqlcheck output instance unclear

Dump all connection-related arguments when running mysqlcheck
from mysql_upgrade.

No test case, since the output depends on the test suite
configuration and platform.
parent d30375be
...@@ -39,6 +39,7 @@ static uint my_end_arg= 0; ...@@ -39,6 +39,7 @@ static uint my_end_arg= 0;
static char *opt_user= (char*)"root"; static char *opt_user= (char*)"root";
static DYNAMIC_STRING ds_args; static DYNAMIC_STRING ds_args;
static DYNAMIC_STRING conn_args;
static char *opt_password= 0; static char *opt_password= 0;
static my_bool tty_password= 0; static my_bool tty_password= 0;
...@@ -135,6 +136,7 @@ static void free_used_memory(void) ...@@ -135,6 +136,7 @@ static void free_used_memory(void)
free_defaults(defaults_argv); free_defaults(defaults_argv);
dynstr_free(&ds_args); dynstr_free(&ds_args);
dynstr_free(&conn_args);
} }
...@@ -204,7 +206,7 @@ static void add_one_option(DYNAMIC_STRING* ds, ...@@ -204,7 +206,7 @@ static void add_one_option(DYNAMIC_STRING* ds,
} }
} }
dynstr_append_os_quoted(ds, "--", opt->name, eq, arg, NullS); dynstr_append_os_quoted(ds, "--", opt->name, eq, arg, NullS);
dynstr_append(&ds_args, " "); dynstr_append(ds, " ");
} }
...@@ -256,6 +258,15 @@ get_one_option(int optid, const struct my_option *opt, ...@@ -256,6 +258,15 @@ get_one_option(int optid, const struct my_option *opt,
case 'f': /* --force */ case 'f': /* --force */
add_option= FALSE; add_option= FALSE;
break; break;
case 'h': /* --host */
case 'W': /* --pipe */
case 'P': /* --port */
case 'S': /* --socket */
case OPT_MYSQL_PROTOCOL: /* --protocol */
case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
add_one_option(&conn_args, opt, argument);
break;
} }
if (add_option) if (add_option)
...@@ -603,6 +614,20 @@ static void create_mysql_upgrade_info_file(void) ...@@ -603,6 +614,20 @@ static void create_mysql_upgrade_info_file(void)
} }
/*
Print connection-related arguments.
*/
static void print_conn_args(const char *tool_name)
{
if (conn_args.str[0])
verbose("Running '%s' with connection arguments: %s", tool_name,
conn_args.str);
else
verbose("Running '%s with default connection arguments", tool_name);
}
/* /*
Check and upgrade(if neccessary) all tables Check and upgrade(if neccessary) all tables
in the server using "mysqlcheck --check-upgrade .." in the server using "mysqlcheck --check-upgrade .."
...@@ -610,7 +635,7 @@ static void create_mysql_upgrade_info_file(void) ...@@ -610,7 +635,7 @@ static void create_mysql_upgrade_info_file(void)
static int run_mysqlcheck_upgrade(void) static int run_mysqlcheck_upgrade(void)
{ {
verbose("Running 'mysqlcheck'..."); print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path, return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", "--no-defaults",
...@@ -624,7 +649,7 @@ static int run_mysqlcheck_upgrade(void) ...@@ -624,7 +649,7 @@ static int run_mysqlcheck_upgrade(void)
static int run_mysqlcheck_fixnames(void) static int run_mysqlcheck_fixnames(void)
{ {
verbose("Running 'mysqlcheck'..."); print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path, return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults", "--no-defaults",
...@@ -753,7 +778,8 @@ int main(int argc, char **argv) ...@@ -753,7 +778,8 @@ int main(int argc, char **argv)
strncpy(self_name, argv[0], FN_REFLEN); strncpy(self_name, argv[0], FN_REFLEN);
} }
if (init_dynamic_string(&ds_args, "", 512, 256)) if (init_dynamic_string(&ds_args, "", 512, 256) ||
init_dynamic_string(&conn_args, "", 512, 256))
die("Out of memory"); die("Out of memory");
load_defaults("my", load_default_groups, &argc, &argv); load_defaults("my", load_default_groups, &argc, &argv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment