Commit e5191dd1 authored by Daniel Black's avatar Daniel Black

mysql-upgrade -> fix-view-algorithm as mysqlcheck option

parent 25872e28
...@@ -792,7 +792,7 @@ static int run_mysqlcheck_views(void) ...@@ -792,7 +792,7 @@ static int run_mysqlcheck_views(void)
"--no-defaults", "--no-defaults",
ds_args.str, ds_args.str,
"--all-databases", "--all-databases",
"--mysql-upgrade", "--fix-view-algorithm",
opt_verbose ? "--verbose": "", opt_verbose ? "--verbose": "",
opt_silent ? "--silent": "", opt_silent ? "--silent": "",
"2>&1", "2>&1",
......
...@@ -43,7 +43,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, ...@@ -43,7 +43,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0, opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
tty_password= 0, opt_frm= 0, debug_info_flag= 0, debug_check_flag= 0, tty_password= 0, opt_frm= 0, debug_info_flag= 0, debug_check_flag= 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0, opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
opt_mysql_upgrade= 0; opt_fix_view_algorithm= 0;
static my_bool opt_write_binlog= 1, opt_flush_tables= 0; static my_bool opt_write_binlog= 1, opt_flush_tables= 0;
static uint verbose = 0, opt_mysql_port=0; static uint verbose = 0, opt_mysql_port=0;
static int my_end_arg; static int my_end_arg;
...@@ -197,9 +197,9 @@ static struct my_option my_long_options[] = ...@@ -197,9 +197,9 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"mysql-upgrade", 'y', {"fix-view-algorithm", 'y',
"Fix view algorithm view field if it is not new MariaDB view.", "Fix view algorithm view field if it is not new MariaDB view.",
&opt_mysql_upgrade, &opt_mysql_upgrade, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_fix_view_algorithm, &opt_fix_view_algorithm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
...@@ -369,13 +369,13 @@ static int get_options(int *argc, char ***argv) ...@@ -369,13 +369,13 @@ static int get_options(int *argc, char ***argv)
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error); exit(ho_error);
if (opt_mysql_upgrade && what_to_do!=DO_REPAIR) if (opt_fix_view_algorithm && what_to_do!=DO_REPAIR)
{ {
if (!what_to_do) if (!what_to_do)
what_to_do= DO_REPAIR; what_to_do= DO_REPAIR;
else else
{ {
fprintf(stderr, "Error: %s doesn't support non-repair command with option mysql-upgrade.\n", fprintf(stderr, "Error: %s doesn't support non-repair command with option fix-view-algorithm.\n",
my_progname); my_progname);
exit(1); exit(1);
} }
...@@ -605,12 +605,12 @@ static int process_all_tables_in_db(char *database) ...@@ -605,12 +605,12 @@ static int process_all_tables_in_db(char *database)
{ {
if ((num_columns == 2) && (strcmp(row[1], "VIEW") == 0)) if ((num_columns == 2) && (strcmp(row[1], "VIEW") == 0))
{ {
if (!opt_mysql_upgrade) if (!opt_fix_view_algorithm)
continue; continue;
} }
else else
{ {
if (opt_mysql_upgrade) if (opt_fix_view_algorithm)
continue; continue;
} }
...@@ -629,12 +629,12 @@ static int process_all_tables_in_db(char *database) ...@@ -629,12 +629,12 @@ static int process_all_tables_in_db(char *database)
/* Skip views if we don't perform renaming. */ /* Skip views if we don't perform renaming. */
if ((what_to_do != DO_UPGRADE) && (num_columns == 2) && (strcmp(row[1], "VIEW") == 0)) if ((what_to_do != DO_UPGRADE) && (num_columns == 2) && (strcmp(row[1], "VIEW") == 0))
{ {
if (!opt_mysql_upgrade) if (!opt_fix_view_algorithm)
continue; continue;
} }
else else
{ {
if (opt_mysql_upgrade) if (opt_fix_view_algorithm)
continue; continue;
} }
if (system_database && if (system_database &&
...@@ -781,12 +781,12 @@ static int handle_request_for_tables(char *tables, uint length) ...@@ -781,12 +781,12 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_upgrade) end = strmov(end, " FOR UPGRADE"); if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
break; break;
case DO_REPAIR: case DO_REPAIR:
op= ((opt_write_binlog || opt_mysql_upgrade) ? op= ((opt_write_binlog || opt_fix_view_algorithm) ?
"REPAIR" : "REPAIR NO_WRITE_TO_BINLOG"); "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG");
if (opt_quick) end = strmov(end, " QUICK"); if (opt_quick) end = strmov(end, " QUICK");
if (opt_extended) end = strmov(end, " EXTENDED"); if (opt_extended) end = strmov(end, " EXTENDED");
if (opt_frm) end = strmov(end, " USE_FRM"); if (opt_frm) end = strmov(end, " USE_FRM");
if (opt_mysql_upgrade) end = strmov(end, " FROM MYSQL"); if (opt_fix_view_algorithm) end = strmov(end, " FROM MYSQL");
break; break;
case DO_ANALYZE: case DO_ANALYZE:
op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG"; op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG";
...@@ -804,7 +804,7 @@ static int handle_request_for_tables(char *tables, uint length) ...@@ -804,7 +804,7 @@ static int handle_request_for_tables(char *tables, uint length)
{ {
/* No backticks here as we added them before */ /* No backticks here as we added them before */
query_length= sprintf(query, "%s %s %s %s", op, query_length= sprintf(query, "%s %s %s %s", op,
(opt_mysql_upgrade ? "VIEW" : "TABLE"), (opt_fix_view_algorithm ? "VIEW" : "TABLE"),
tables, options); tables, options);
table_name= tables; table_name= tables;
} }
...@@ -813,7 +813,7 @@ static int handle_request_for_tables(char *tables, uint length) ...@@ -813,7 +813,7 @@ static int handle_request_for_tables(char *tables, uint length)
char *ptr, *org; char *ptr, *org;
org= ptr= strmov(strmov(query, op), org= ptr= strmov(strmov(query, op),
(opt_mysql_upgrade ? " VIEW " : " TABLE ")); (opt_fix_view_algorithm ? " VIEW " : " TABLE "));
ptr= fix_table_name(ptr, tables); ptr= fix_table_name(ptr, tables);
strmake(table_name_buff, org, min((int) sizeof(table_name_buff)-1, strmake(table_name_buff, org, min((int) sizeof(table_name_buff)-1,
(int) (ptr - org))); (int) (ptr - org)));
......
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