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

Fixed some errors & warnings when running mariadb-upgrade on MySQL instance

- Moved view checks after privilege tables are fixed. This is to avoid
  warnings about wrongly defined mysql.proc when checking views.
- Don't use stat tables before they have been fixed.
- Don't run mysql_fix_view() if 'FOR MYSQL' is used if the view is
  already a MariaDB view.
- Added 'FOR UPGRADE' as an option for 'REPAIR VIEW' to be able to
  detect if the REPAIR command comes from mariadb_upgrade. In this
  case we get a warning, instead of an error, if a definer of a view
  does not exists.
This commit is contained in:
Monty
2023-06-05 10:42:04 +03:00
parent 324d8a6036
commit d671fec431
28 changed files with 371 additions and 737 deletions

View File

@@ -63,8 +63,9 @@ const char *operation_name[]=
"???", "check", "repair", "analyze", "optimize", "fix names"
};
typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_VIEWS_FROM_MYSQL } enum_do_views;
const char *do_views_opts[]= {"NO", "YES", "UPGRADE_FROM_MYSQL", NullS};
typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_UPGRADE, DO_VIEWS_FROM_MYSQL } enum_do_views;
const char *do_views_opts[]= {"NO", "YES", "UPGRADE", "UPGRADE_FROM_MYSQL",
NullS};
TYPELIB do_views_typelib= { array_elements(do_views_opts) - 1, "",
do_views_opts, NULL };
static ulong opt_do_views= DO_VIEWS_NO;
@@ -213,8 +214,9 @@ static struct my_option my_long_options[] =
{"process-views", 0,
"Perform the requested operation (check or repair) on views. "
"One of: NO, YES (correct the checksum, if necessary, add the "
"mariadb-version field), UPGRADE_FROM_MYSQL (same as YES and toggle "
"the algorithm MERGE<->TEMPTABLE.", &opt_do_views, &opt_do_views,
"mariadb-version field), UPGRADE (run from mariadb-upgrade), "
"UPGRADE_FROM_MYSQL (same as YES and toggle the algorithm "
"MERGE<->TEMPTABLE.", &opt_do_views, &opt_do_views,
&do_views_typelib, GET_ENUM, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"process-tables", 0, "Perform the requested operation on tables.",
&opt_do_tables, &opt_do_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@@ -922,7 +924,10 @@ static int handle_request_for_tables(char *tables, size_t length,
op= opt_write_binlog ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
if (view)
{
if (opt_do_views == DO_VIEWS_FROM_MYSQL) end = strmov(end, " FROM MYSQL");
if (opt_do_views == DO_VIEWS_FROM_MYSQL)
end = strmov(end, " FROM MYSQL");
else if (opt_do_views == DO_UPGRADE)
end = strmov(end, " FOR UPGRADE");
}
else
{