@@ -43,7 +43,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
43
43
opt_silent = 0 , opt_auto_repair = 0 , ignore_errors = 0 ,
44
44
tty_password = 0 , opt_frm = 0 , debug_info_flag = 0 , debug_check_flag = 0 ,
45
45
opt_fix_table_names = 0 , opt_fix_db_names = 0 , opt_upgrade = 0 ,
46
- opt_fix_view_algorithm = 0 ;
46
+ opt_fix_view_algorithm = 0 , opt_fix_tables = 1 ;
47
47
static my_bool opt_write_binlog = 1 , opt_flush_tables = 0 ;
48
48
static uint verbose = 0 , opt_mysql_port = 0 ;
49
49
static int my_end_arg ;
@@ -200,6 +200,9 @@ static struct my_option my_long_options[] =
200
200
{"fix-view-algorithm" , 'y' ,
201
201
"Fix view algorithm view field if it is not new MariaDB view." ,
202
202
& opt_fix_view_algorithm , & opt_fix_view_algorithm , 0 , GET_BOOL , NO_ARG , 0 , 0 , 0 , 0 , 0 , 0 },
203
+ {"fix-tables" , 'Y' ,
204
+ "Fix tables. Usually the default however mysql_upgrade will run with --skip-fix-tables." ,
205
+ & opt_fix_tables , & opt_fix_tables , 0 , GET_BOOL , NO_ARG , 1 , 0 , 0 , 0 , 0 , 0 },
203
206
{0 , 0 , 0 , 0 , 0 , 0 , GET_NO_ARG , NO_ARG , 0 , 0 , 0 , 0 , 0 , 0 }
204
207
};
205
208
@@ -369,6 +372,12 @@ static int get_options(int *argc, char ***argv)
369
372
if ((ho_error = handle_options (argc , argv , my_long_options , get_one_option )))
370
373
exit (ho_error );
371
374
375
+ if (what_to_do == DO_REPAIR && !(opt_fix_view_algorithm || opt_fix_tables ))
376
+ {
377
+ fprintf (stderr , "Error: %s doesn't support repair command without either fix-view-algorithm or fix-tables specified.\n" ,
378
+ my_progname );
379
+ exit (1 );
380
+ }
372
381
if (opt_fix_view_algorithm && what_to_do != DO_REPAIR )
373
382
{
374
383
if (!what_to_do )
@@ -641,9 +650,10 @@ static int process_all_tables_in_db(char *database)
641
650
642
651
while ((row = mysql_fetch_row (res )))
643
652
{
644
- if ((num_columns == 2 ) && (strcmp (row [1 ], "VIEW" ) == 0 ))
653
+ if ((num_columns == 2 ) && (strcmp (row [1 ], "VIEW" ) == 0 ) &&
654
+ opt_fix_view_algorithm )
645
655
tot_views_length += fixed_name_length (row [0 ]) + 2 ;
646
- else
656
+ else if ( opt_fix_tables )
647
657
tot_length += fixed_name_length (row [0 ]) + 2 ;
648
658
}
649
659
mysql_data_seek (res , 0 );
@@ -671,6 +681,8 @@ static int process_all_tables_in_db(char *database)
671
681
}
672
682
else
673
683
{
684
+ if (!opt_fix_tables )
685
+ continue ;
674
686
end = fix_table_name (end , row [0 ]);
675
687
* end ++ = ',' ;
676
688
}
@@ -696,7 +708,11 @@ static int process_all_tables_in_db(char *database)
696
708
view = TRUE;
697
709
}
698
710
else
711
+ {
712
+ if (!opt_fix_tables )
713
+ continue ;
699
714
view = FALSE;
715
+ }
700
716
if (system_database &&
701
717
(!strcmp (row [0 ], "general_log" ) ||
702
718
!strcmp (row [0 ], "slow_log" )))
0 commit comments