Commit d671fec4 authored by Monty's avatar Monty

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.
parent 324d8a60
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ #include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
#define VER "2.0" #define VER "2.1"
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h> #include <sys/wait.h>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
static int phase = 0; static int phase = 0;
static int info_file= -1; static int info_file= -1;
static const int phases_total = 7; static const int phases_total = 8;
static char mysql_path[FN_REFLEN]; static char mysql_path[FN_REFLEN];
static char mysqlcheck_path[FN_REFLEN]; static char mysqlcheck_path[FN_REFLEN];
...@@ -982,7 +982,7 @@ static my_bool is_mysql() ...@@ -982,7 +982,7 @@ static my_bool is_mysql()
static int run_mysqlcheck_views(void) static int run_mysqlcheck_views(void)
{ {
const char *upgrade_views="--process-views=YES"; const char *upgrade_views="--process-views=UPGRADE";
if (upgrade_from_mysql) if (upgrade_from_mysql)
{ {
/* /*
...@@ -1122,8 +1122,9 @@ static my_bool from_before_10_1() ...@@ -1122,8 +1122,9 @@ static my_bool from_before_10_1()
} }
static void uninstall_plugins(void) static int uninstall_plugins(void)
{ {
verbose("Phase %d/%d: uninstalling plugins", ++phase, phases_total);
if (ds_plugin_data_types.length) if (ds_plugin_data_types.length)
{ {
char *plugins= ds_plugin_data_types.str; char *plugins= ds_plugin_data_types.str;
...@@ -1140,7 +1141,10 @@ static void uninstall_plugins(void) ...@@ -1140,7 +1141,10 @@ static void uninstall_plugins(void)
next= get_line(next); next= get_line(next);
} }
} }
return 0;
} }
/** /**
@brief Install plugins for missing data types @brief Install plugins for missing data types
@details Check for entries with "Unknown data type" in I_S.TABLES, @details Check for entries with "Unknown data type" in I_S.TABLES,
...@@ -1189,6 +1193,8 @@ static int install_used_plugin_data_types(void) ...@@ -1189,6 +1193,8 @@ static int install_used_plugin_data_types(void)
dynstr_free(&ds_result); dynstr_free(&ds_result);
return 0; return 0;
} }
/* /*
Check for entries with "Unknown storage engine" in I_S.TABLES, Check for entries with "Unknown storage engine" in I_S.TABLES,
try to load plugins for these tables if available (MDEV-11942) try to load plugins for these tables if available (MDEV-11942)
...@@ -1239,6 +1245,7 @@ static int install_used_engines(void) ...@@ -1239,6 +1245,7 @@ static int install_used_engines(void)
return 0; return 0;
} }
static int check_slave_repositories(void) static int check_slave_repositories(void)
{ {
DYNAMIC_STRING ds_result; DYNAMIC_STRING ds_result;
...@@ -1366,6 +1373,13 @@ static int run_sql_fix_privilege_tables(void) ...@@ -1366,6 +1373,13 @@ static int run_sql_fix_privilege_tables(void)
} }
static int flush_privileges(void)
{
verbose("Phase %d/%d: Running 'FLUSH PRIVILEGES'", ++phase, phases_total);
return run_query("FLUSH PRIVILEGES", NULL, TRUE);
}
/** /**
Check if the server version matches with the server version mysql_upgrade Check if the server version matches with the server version mysql_upgrade
was compiled with. was compiled with.
...@@ -1395,10 +1409,11 @@ static int check_version_match(void) ...@@ -1395,10 +1409,11 @@ static int check_version_match(void)
if (calc_server_version((char *) version_str) != MYSQL_VERSION_ID) if (calc_server_version((char *) version_str) != MYSQL_VERSION_ID)
{ {
fprintf(stderr, "Error: Server version (%s) does not match with the " fprintf(stderr, "Error: Server version (%s)\n"
"version of\nthe server (%s) with which this program was built/" "does not match the version of the server (%s)\n"
"distributed. You can\nuse --skip-version-check to skip this " "with which this program was built/distributed. You can\n"
"check.\n", version_str, MYSQL_SERVER_VERSION); "use --skip-version-check to skip this check.\n",
version_str, MYSQL_SERVER_VERSION);
return 1; return 1;
} }
return 0; return 0;
...@@ -1486,18 +1501,14 @@ int main(int argc, char **argv) ...@@ -1486,18 +1501,14 @@ int main(int argc, char **argv)
if (run_mysqlcheck_upgrade(TRUE) || if (run_mysqlcheck_upgrade(TRUE) ||
install_used_engines() || install_used_engines() ||
install_used_plugin_data_types() || install_used_plugin_data_types() ||
run_mysqlcheck_views() ||
run_sql_fix_privilege_tables() || run_sql_fix_privilege_tables() ||
run_mysqlcheck_views() ||
run_mysqlcheck_fixnames() || run_mysqlcheck_fixnames() ||
run_mysqlcheck_upgrade(FALSE) || run_mysqlcheck_upgrade(FALSE) ||
check_slave_repositories()) check_slave_repositories() ||
uninstall_plugins() ||
flush_privileges())
die("Upgrade failed" ); die("Upgrade failed" );
uninstall_plugins();
verbose("Phase %d/%d: Running 'FLUSH PRIVILEGES'", ++phase, phases_total);
if (run_query("FLUSH PRIVILEGES", NULL, TRUE))
die("Upgrade failed" );
verbose("OK"); verbose("OK");
/* Finish writing indicating upgrade has been performed */ /* Finish writing indicating upgrade has been performed */
......
...@@ -63,8 +63,9 @@ const char *operation_name[]= ...@@ -63,8 +63,9 @@ const char *operation_name[]=
"???", "check", "repair", "analyze", "optimize", "fix names" "???", "check", "repair", "analyze", "optimize", "fix names"
}; };
typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_VIEWS_FROM_MYSQL } enum_do_views; 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_FROM_MYSQL", NullS}; const char *do_views_opts[]= {"NO", "YES", "UPGRADE", "UPGRADE_FROM_MYSQL",
NullS};
TYPELIB do_views_typelib= { array_elements(do_views_opts) - 1, "", TYPELIB do_views_typelib= { array_elements(do_views_opts) - 1, "",
do_views_opts, NULL }; do_views_opts, NULL };
static ulong opt_do_views= DO_VIEWS_NO; static ulong opt_do_views= DO_VIEWS_NO;
...@@ -213,8 +214,9 @@ static struct my_option my_long_options[] = ...@@ -213,8 +214,9 @@ static struct my_option my_long_options[] =
{"process-views", 0, {"process-views", 0,
"Perform the requested operation (check or repair) on views. " "Perform the requested operation (check or repair) on views. "
"One of: NO, YES (correct the checksum, if necessary, add the " "One of: NO, YES (correct the checksum, if necessary, add the "
"mariadb-version field), UPGRADE_FROM_MYSQL (same as YES and toggle " "mariadb-version field), UPGRADE (run from mariadb-upgrade), "
"the algorithm MERGE<->TEMPTABLE.", &opt_do_views, &opt_do_views, "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}, &do_views_typelib, GET_ENUM, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"process-tables", 0, "Perform the requested operation on tables.", {"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}, &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, ...@@ -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"; op= opt_write_binlog ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
if (view) 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 else
{ {
......
...@@ -227,7 +227,7 @@ DROP TABLE mysql050614_xxx_croatian_ci; ...@@ -227,7 +227,7 @@ DROP TABLE mysql050614_xxx_croatian_ci;
# Checking mysql_upgrade # Checking mysql_upgrade
# #
# Running mysql_upgrade # Running mysql_upgrade
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -258,8 +258,9 @@ mysql.time_zone_name OK ...@@ -258,8 +258,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.transaction_registry OK mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -361,9 +362,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -361,9 +362,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -384,11 +384,12 @@ test.maria050313_ucs2_croatian_ci_def OK ...@@ -384,11 +384,12 @@ test.maria050313_ucs2_croatian_ci_def OK
test.maria050313_utf8_croatian_ci OK test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK test.maria100004_xxx_croatian_ci OK
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
# Running mysql_upgrade for the second time # Running mysql_upgrade for the second time
# This should report OK for all tables # This should report OK for all tables
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -419,8 +420,9 @@ mysql.time_zone_name OK ...@@ -419,8 +420,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.transaction_registry OK mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -522,9 +524,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -522,9 +524,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -539,7 +540,8 @@ test.maria050313_utf8_croatian_ci OK ...@@ -539,7 +540,8 @@ test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK test.maria100004_xxx_croatian_ci OK
test.mysql050614_xxx_croatian_ci OK test.mysql050614_xxx_croatian_ci OK
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def; SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
Table Create Table Table Create Table
......
...@@ -11,7 +11,7 @@ Table Op Msg_type Msg_text ...@@ -11,7 +11,7 @@ Table Op Msg_type Msg_text
test.bug49823 repair status OK test.bug49823 repair status OK
RENAME TABLE general_log TO renamed_general_log; RENAME TABLE general_log TO renamed_general_log;
RENAME TABLE test.bug49823 TO general_log; RENAME TABLE test.bug49823 TO general_log;
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -43,8 +43,9 @@ mysql.time_zone_name OK ...@@ -43,8 +43,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.transaction_registry OK mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -146,9 +147,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -146,9 +147,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -158,7 +158,8 @@ performance_schema ...@@ -158,7 +158,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
DROP TABLE general_log; DROP TABLE general_log;
RENAME TABLE renamed_general_log TO general_log; RENAME TABLE renamed_general_log TO general_log;
......
...@@ -86,7 +86,7 @@ DROP TABLE t1; ...@@ -86,7 +86,7 @@ DROP TABLE t1;
create database TEST; create database TEST;
create procedure TEST.pr() begin end; create procedure TEST.pr() begin end;
create procedure test.pr() begin end; create procedure test.pr() begin end;
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -134,8 +134,9 @@ error : Corrupt ...@@ -134,8 +134,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -237,9 +238,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -237,9 +238,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
TEST TEST
information_schema information_schema
...@@ -250,7 +250,8 @@ performance_schema ...@@ -250,7 +250,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
drop procedure test.pr; drop procedure test.pr;
drop database TEST; drop database TEST;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
SET NAMES utf8; SET NAMES utf8;
show create table mysql_json_test; show create table mysql_json_test;
ERROR HY000: Unknown data type: 'MYSQL_JSON' ERROR HY000: Unknown data type: 'MYSQL_JSON'
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -53,9 +53,10 @@ error : Corrupt ...@@ -53,9 +53,10 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
installing plugin for MYSQL_JSON data type installing plugin for MYSQL_JSON data type
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -157,9 +158,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -157,9 +158,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -175,8 +175,9 @@ test.mysql_json_test_big Needs upgrade ...@@ -175,8 +175,9 @@ test.mysql_json_test_big Needs upgrade
Repairing tables Repairing tables
test.mysql_json_test OK test.mysql_json_test OK
test.mysql_json_test_big OK test.mysql_json_test_big OK
Phase 7/8: uninstalling plugins
uninstalling plugin for 'type_mysql_json' data type uninstalling plugin for 'type_mysql_json' data type
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
show create table mysql_json_test; show create table mysql_json_test;
Table Create Table Table Create Table
......
...@@ -6,7 +6,7 @@ SET NAMES utf8; ...@@ -6,7 +6,7 @@ SET NAMES utf8;
call mtr.add_suppression("Table rebuild required"); call mtr.add_suppression("Table rebuild required");
show create table mysql_json_test; show create table mysql_json_test;
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it! ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test` FORCE" or dump/reload to fix it!
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -54,8 +54,9 @@ error : Corrupt ...@@ -54,8 +54,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -157,9 +158,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -157,9 +158,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -175,7 +175,8 @@ test.mysql_json_test_big Needs upgrade ...@@ -175,7 +175,8 @@ test.mysql_json_test_big Needs upgrade
Repairing tables Repairing tables
test.mysql_json_test OK test.mysql_json_test OK
test.mysql_json_test_big OK test.mysql_json_test_big OK
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
show create table mysql_json_test; show create table mysql_json_test;
Table Create Table Table Create Table
......
...@@ -16,7 +16,7 @@ WHERE TABLE_SCHEMA='mysql' AND TABLE_NAME='user'; ...@@ -16,7 +16,7 @@ WHERE TABLE_SCHEMA='mysql' AND TABLE_NAME='user';
CHARACTER_SET_CLIENT COLLATION_CONNECTION CHARACTER_SET_CLIENT COLLATION_CONNECTION
utf8mb4 utf8mb4_unicode_ci utf8mb4 utf8mb4_unicode_ci
# Running mysql_upgrade # Running mysql_upgrade
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -47,8 +47,9 @@ mysql.time_zone_name OK ...@@ -47,8 +47,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.transaction_registry OK mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -150,9 +151,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -150,9 +151,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -162,7 +162,8 @@ performance_schema ...@@ -162,7 +162,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
# #
# Restoring character_set_client and collation_connection back # Restoring character_set_client and collation_connection back
......
update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')) where user='root'; update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')) where user='root';
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -47,8 +47,9 @@ error : Corrupt ...@@ -47,8 +47,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -150,9 +151,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -150,9 +151,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -162,7 +162,8 @@ performance_schema ...@@ -162,7 +162,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
connect con1,localhost,root,foo,,,; connect con1,localhost,root,foo,,,;
update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin', '$.authentication_string')) where user='root'; update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin', '$.authentication_string')) where user='root';
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_tes ...@@ -10,7 +10,7 @@ ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_tes
show create table mysql_json_test_big; show create table mysql_json_test_big;
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test_big` FORCE" or dump/reload to fix it! ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.mysql_json_test_big` FORCE" or dump/reload to fix it!
# Run mysql_upgrade to fix the tables containing JSON. # Run mysql_upgrade to fix the tables containing JSON.
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -41,8 +41,9 @@ mysql.time_zone_name OK ...@@ -41,8 +41,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.transaction_registry OK mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -144,9 +145,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -144,9 +145,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -164,7 +164,8 @@ Repairing tables ...@@ -164,7 +164,8 @@ Repairing tables
test.mysql_json_test OK test.mysql_json_test OK
test.mysql_json_test_big OK test.mysql_json_test_big OK
test.tempty OK test.tempty OK
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
# #
# Now check if the table structure is correct and that the data # Now check if the table structure is correct and that the data
......
The --upgrade-system-tables option was used, user tables won't be touched. The --upgrade-system-tables option was used, user tables won't be touched.
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -47,10 +47,11 @@ error : Corrupt ...@@ -47,10 +47,11 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views... Skipped Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 4/8: Fixing views... Skipped
Phase 5/7: Fixing table and database names ... Skipped Phase 5/8: Fixing table and database names ... Skipped
Phase 6/7: Checking and upgrading tables... Skipped Phase 6/8: Checking and upgrading tables... Skipped
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
...@@ -34,7 +34,7 @@ select table_catalog, table_schema, table_name, table_type, engine, row_format, ...@@ -34,7 +34,7 @@ select table_catalog, table_schema, table_name, table_type, engine, row_format,
--echo # upgrade from 10.1 - engines aren't enabled --echo # upgrade from 10.1 - engines aren't enabled
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / --replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
exec $MYSQL_UPGRADE 2>&1; exec $MYSQL_UPGRADE --silent 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
...@@ -54,7 +54,7 @@ EOF ...@@ -54,7 +54,7 @@ EOF
--echo # still upgrade from 10.1 --echo # still upgrade from 10.1
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / --replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
exec $MYSQL_UPGRADE 2>&1; exec $MYSQL_UPGRADE --silent 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
...@@ -68,13 +68,14 @@ remove_file $datadir/mysql_upgrade_info; ...@@ -68,13 +68,14 @@ remove_file $datadir/mysql_upgrade_info;
--echo # upgrade from 10.0 - engines are enabled --echo # upgrade from 10.0 - engines are enabled
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / --replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
exec $MYSQL_UPGRADE 2>&1; exec $MYSQL_UPGRADE --silent 2>&1;
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
drop table t1, t2; drop table t1, t2;
remove_file $datadir/mysql_upgrade_info; remove_file $datadir/mysql_upgrade_info;
# This is needed as mysql_upgrade can load the plugins
uninstall plugin blackhole; uninstall plugin blackhole;
uninstall plugin archive; uninstall plugin archive;
......
# #
# Bug#55672 mysql_upgrade dies with internal error # Bug#55672 mysql_upgrade dies with internal error
# #
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -32,8 +32,9 @@ mysql.time_zone_name OK ...@@ -32,8 +32,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.transaction_registry OK mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -135,9 +136,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -135,9 +136,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -147,5 +147,6 @@ performance_schema ...@@ -147,5 +147,6 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
...@@ -64,7 +64,7 @@ test.v2 check error Upgrade required. Please do "REPAIR VIEW `v2`" or dump/reloa ...@@ -64,7 +64,7 @@ test.v2 check error Upgrade required. Please do "REPAIR VIEW `v2`" or dump/reloa
check view v3 for upgrade; check view v3 for upgrade;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v3 check error Upgrade required. Please do "REPAIR VIEW `v3`" or dump/reload to fix it! test.v3 check error Upgrade required. Please do "REPAIR VIEW `v3`" or dump/reload to fix it!
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -112,8 +112,9 @@ error : Corrupt ...@@ -112,8 +112,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -219,9 +220,8 @@ test.v1 OK ...@@ -219,9 +220,8 @@ test.v1 OK
test.v1badcheck OK test.v1badcheck OK
test.v2 OK test.v2 OK
test.v3 OK test.v3 OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -233,7 +233,8 @@ sys.sys_config OK ...@@ -233,7 +233,8 @@ sys.sys_config OK
test test
test.kv OK test.kv OK
test.t1 OK test.t1 OK
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
show create view v1; show create view v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
...@@ -315,7 +316,7 @@ show create view v4; ...@@ -315,7 +316,7 @@ show create view v4;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
MariaDB upgrade detected MariaDB upgrade detected
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -364,8 +365,9 @@ error : Corrupt ...@@ -364,8 +365,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views from mysql Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views from mysql
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -471,9 +473,8 @@ test.v1 OK ...@@ -471,9 +473,8 @@ test.v1 OK
test.v2 OK test.v2 OK
test.v3 OK test.v3 OK
test.v4 OK test.v4 OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -485,7 +486,8 @@ sys.sys_config OK ...@@ -485,7 +486,8 @@ sys.sys_config OK
test test
test.kv OK test.kv OK
test.t1 OK test.t1 OK
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
flush tables; flush tables;
show create view v1; show create view v1;
...@@ -542,7 +544,7 @@ rename table mysql.event to mysql.ev_bk; ...@@ -542,7 +544,7 @@ rename table mysql.event to mysql.ev_bk;
flush tables; flush tables;
The --upgrade-system-tables option was used, user tables won't be touched. The --upgrade-system-tables option was used, user tables won't be touched.
MariaDB upgrade detected MariaDB upgrade detected
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -591,8 +593,9 @@ error : Corrupt ...@@ -591,8 +593,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views from mysql Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views from mysql
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -697,10 +700,10 @@ sys.x$waits_global_by_latency OK ...@@ -697,10 +700,10 @@ sys.x$waits_global_by_latency OK
test.v1 OK test.v1 OK
test.v2 OK test.v2 OK
test.v3 OK test.v3 OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names ... Skipped
Phase 5/7: Fixing table and database names ... Skipped Phase 6/8: Checking and upgrading tables... Skipped
Phase 6/7: Checking and upgrading tables... Skipped Phase 7/8: uninstalling plugins
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
drop table mysql.event; drop table mysql.event;
rename table mysql.ev_bk to mysql.event; rename table mysql.ev_bk to mysql.event;
......
...@@ -84,7 +84,7 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE ...@@ -84,7 +84,7 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'"; SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
# Run mysql_upgrade # Run mysql_upgrade
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -133,9 +133,12 @@ error : Corrupt ...@@ -133,9 +133,12 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
mysql.user OK Phase 4/8: Fixing views
mysql.user
Warning : The user specified as a definer ('mariadb.sys'@'localhost') does not exist
status : OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
sys.host_summary_by_file_io_type OK sys.host_summary_by_file_io_type OK
...@@ -236,9 +239,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -236,9 +239,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -252,7 +254,8 @@ performance_schema ...@@ -252,7 +254,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
# check new definitions mysql_upgrade # check new definitions mysql_upgrade
SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'root@localhost'; SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'root@localhost';
......
...@@ -104,7 +104,7 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE ...@@ -104,7 +104,7 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'"; SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
# Run mysql_upgrade # Run mysql_upgrade
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -153,8 +153,9 @@ error : Corrupt ...@@ -153,8 +153,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -256,9 +257,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -256,9 +257,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -272,7 +272,8 @@ performance_schema ...@@ -272,7 +272,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
# check new definitions mysql_upgrade # check new definitions mysql_upgrade
SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
...@@ -303,7 +304,7 @@ DROP USER 'superuser'@'localhost'; ...@@ -303,7 +304,7 @@ DROP USER 'superuser'@'localhost';
DROP VIEW mysql.user; DROP VIEW mysql.user;
DROP PROCEDURE AddGeometryColumn; DROP PROCEDURE AddGeometryColumn;
DROP PROCEDURE DropGeometryColumn; DROP PROCEDURE DropGeometryColumn;
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -352,8 +353,12 @@ error : Corrupt ...@@ -352,8 +353,12 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user
Warning : The user specified as a definer ('mariadb.sys'@'localhost') does not exist
status : OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
sys.host_summary_by_file_io_type OK sys.host_summary_by_file_io_type OK
...@@ -454,9 +459,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -454,9 +459,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -470,7 +474,8 @@ performance_schema ...@@ -470,7 +474,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
delete from global_priv; delete from global_priv;
delete from tables_priv; delete from tables_priv;
......
...@@ -88,7 +88,7 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE ...@@ -88,7 +88,7 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'"; SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
# Run mysql_upgrade # Run mysql_upgrade
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -137,8 +137,9 @@ error : Corrupt ...@@ -137,8 +137,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -240,9 +241,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -240,9 +241,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -256,7 +256,8 @@ performance_schema ...@@ -256,7 +256,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
# check new definitions mysql_upgrade # check new definitions mysql_upgrade
SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
...@@ -279,7 +280,7 @@ count(*) ...@@ -279,7 +280,7 @@ count(*)
# restore environment # restore environment
DROP USER 'superuser'@'localhost'; DROP USER 'superuser'@'localhost';
DROP VIEW mysql.user; DROP VIEW mysql.user;
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -328,8 +329,12 @@ error : Corrupt ...@@ -328,8 +329,12 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user
Warning : The user specified as a definer ('mariadb.sys'@'localhost') does not exist
status : OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
sys.host_summary_by_file_io_type OK sys.host_summary_by_file_io_type OK
...@@ -430,9 +435,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -430,9 +435,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -446,7 +450,8 @@ performance_schema ...@@ -446,7 +450,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
delete from global_priv; delete from global_priv;
delete from tables_priv; delete from tables_priv;
......
...@@ -34,7 +34,7 @@ count(*) ...@@ -34,7 +34,7 @@ count(*)
# #
# Run mysql_upgrade # Run mysql_upgrade
# #
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -83,8 +83,9 @@ error : Corrupt ...@@ -83,8 +83,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -186,9 +187,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -186,9 +187,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -198,7 +198,8 @@ performance_schema ...@@ -198,7 +198,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
# #
# check new definers of Add/DropGeometryColumn # check new definers of Add/DropGeometryColumn
......
...@@ -49,7 +49,7 @@ password_expired ...@@ -49,7 +49,7 @@ password_expired
N N
drop user gigi@localhost; drop user gigi@localhost;
# Run mysql_upgrade # Run mysql_upgrade
Phase 1/7: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql
mysql.column_stats OK mysql.column_stats OK
...@@ -97,8 +97,9 @@ error : Corrupt ...@@ -97,8 +97,9 @@ error : Corrupt
mysql.transaction_registry mysql.transaction_registry
Error : Unknown storage engine 'InnoDB' Error : Unknown storage engine 'InnoDB'
error : Corrupt error : Corrupt
Phase 2/7: Installing used storage engines... Skipped Phase 2/8: Installing used storage engines... Skipped
Phase 3/7: Fixing views Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK mysql.user OK
sys.host_summary OK sys.host_summary OK
sys.host_summary_by_file_io OK sys.host_summary_by_file_io OK
...@@ -200,9 +201,8 @@ sys.x$wait_classes_global_by_latency OK ...@@ -200,9 +201,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/8: Fixing table and database names
Phase 5/7: Fixing table and database names Phase 6/8: Checking and upgrading tables
Phase 6/7: Checking and upgrading tables
Processing databases Processing databases
information_schema information_schema
mtr mtr
...@@ -212,7 +212,8 @@ performance_schema ...@@ -212,7 +212,8 @@ performance_schema
sys sys
sys.sys_config OK sys.sys_config OK
test test
Phase 7/7: Running 'FLUSH PRIVILEGES' Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
create user gigi@localhost; create user gigi@localhost;
show create user gigi@localhost; show create user gigi@localhost;
......
...@@ -46,7 +46,6 @@ INSERT INTO tmp_user_sys (Host,User,Priv) VALUES ('localhost','mariadb.sys','{"a ...@@ -46,7 +46,6 @@ INSERT INTO tmp_user_sys (Host,User,Priv) VALUES ('localhost','mariadb.sys','{"a
INSERT IGNORE INTO global_priv SELECT * FROM tmp_user_sys WHERE 0 <> @need_sys_user_creation; INSERT IGNORE INTO global_priv SELECT * FROM tmp_user_sys WHERE 0 <> @need_sys_user_creation;
DROP TABLE tmp_user_sys; DROP TABLE tmp_user_sys;
CREATE DEFINER='mariadb.sys'@'localhost' SQL SECURITY DEFINER VIEW IF NOT EXISTS user AS SELECT CREATE DEFINER='mariadb.sys'@'localhost' SQL SECURITY DEFINER VIEW IF NOT EXISTS user AS SELECT
Host, Host,
User, User,
......
...@@ -28,7 +28,6 @@ SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @cur ...@@ -28,7 +28,6 @@ SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @cur
SELECT '{"access":18446744073709551615}' INTO @all_privileges; SELECT '{"access":18446744073709551615}' INTO @all_privileges;
SELECT '{"access":18446744073709551615,"plugin":"mysql_native_password","authentication_string":"invalid","auth_or":[{},{"plugin":"unix_socket"}]}' into @all_with_auth; SELECT '{"access":18446744073709551615,"plugin":"mysql_native_password","authentication_string":"invalid","auth_or":[{},{"plugin":"unix_socket"}]}' into @all_with_auth;
-- Fill "global_priv" table with default users allowing root access -- Fill "global_priv" table with default users allowing root access
-- from local machine if "global_priv" table didn't exist before -- from local machine if "global_priv" table didn't exist before
CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE global_priv; CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE global_priv;
......
-- Copyright (C) 2003, 2013 Oracle and/or its affiliates. -- Copyright (C) 2003, 2013 Oracle and/or its affiliates.
-- Copyright (C) 2010, 2022, MariaDB Corporation -- Copyright (C) 2010, 2023, MariaDB Corporation
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by -- it under the terms of the GNU General Public License as published by
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
# This part converts any old privilege tables to privilege tables suitable # This part converts any old privilege tables to privilege tables suitable
# for current version of MySQL # for current version of MariaDB
# You can safely ignore all 'Duplicate column' and 'Unknown column' errors # You can safely ignore all 'Duplicate column' and 'Unknown column' errors
# because these just mean that your tables are already up to date. # because these just mean that your tables are already up to date.
...@@ -28,6 +28,7 @@ set sql_mode=''; ...@@ -28,6 +28,7 @@ set sql_mode='';
set default_storage_engine=Aria; set default_storage_engine=Aria;
set enforce_storage_engine=NULL; set enforce_storage_engine=NULL;
set alter_algorithm='DEFAULT'; set alter_algorithm='DEFAULT';
set use_stat_tables='NEVER';
set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO'); set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');
......
...@@ -2301,7 +2301,7 @@ int view_repair(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt) ...@@ -2301,7 +2301,7 @@ int view_repair(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt)
bool swap_alg= (check_opt->sql_flags & TT_FROM_MYSQL); bool swap_alg= (check_opt->sql_flags & TT_FROM_MYSQL);
bool wrong_checksum= view_checksum(thd, view) != HA_ADMIN_OK; bool wrong_checksum= view_checksum(thd, view) != HA_ADMIN_OK;
int ret; int ret;
if (wrong_checksum || swap_alg || (!view->mariadb_version)) if (wrong_checksum || !view->mariadb_version)
{ {
ret= mariadb_fix_view(thd, view, wrong_checksum, swap_alg); ret= mariadb_fix_view(thd, view, wrong_checksum, swap_alg);
DBUG_RETURN(ret); DBUG_RETURN(ret);
......
...@@ -8277,6 +8277,7 @@ mi_repair_type: ...@@ -8277,6 +8277,7 @@ mi_repair_type:
opt_view_repair_type: opt_view_repair_type:
/* empty */ { } /* empty */ { }
| FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; }
| FROM MYSQL_SYM { Lex->check_opt.sql_flags|= TT_FROM_MYSQL; } | FROM MYSQL_SYM { Lex->check_opt.sql_flags|= TT_FROM_MYSQL; }
; ;
......
...@@ -6569,7 +6569,7 @@ void TABLE_LIST::register_want_access(privilege_t want_access) ...@@ -6569,7 +6569,7 @@ void TABLE_LIST::register_want_access(privilege_t want_access)
*/ */
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
bool TABLE_LIST::prepare_view_security_context(THD *thd) bool TABLE_LIST::prepare_view_security_context(THD *thd, bool upgrade_check)
{ {
DBUG_ENTER("TABLE_LIST::prepare_view_security_context"); DBUG_ENTER("TABLE_LIST::prepare_view_security_context");
DBUG_PRINT("enter", ("table: %s", alias.str)); DBUG_PRINT("enter", ("table: %s", alias.str));
...@@ -6594,8 +6594,8 @@ bool TABLE_LIST::prepare_view_security_context(THD *thd) ...@@ -6594,8 +6594,8 @@ bool TABLE_LIST::prepare_view_security_context(THD *thd)
{ {
if (thd->security_ctx->master_access & PRIV_REVEAL_MISSING_DEFINER) if (thd->security_ctx->master_access & PRIV_REVEAL_MISSING_DEFINER)
{ {
my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str); my_error(ER_NO_SUCH_USER, MYF(upgrade_check ? ME_WARNING: 0),
definer.user.str, definer.host.str);
} }
else else
{ {
...@@ -6677,11 +6677,33 @@ bool TABLE_LIST::prepare_security(THD *thd) ...@@ -6677,11 +6677,33 @@ bool TABLE_LIST::prepare_security(THD *thd)
TABLE_LIST *tbl; TABLE_LIST *tbl;
DBUG_ENTER("TABLE_LIST::prepare_security"); DBUG_ENTER("TABLE_LIST::prepare_security");
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check if we are running REPAIR VIEW FOR UPGRADE
In this case we are probably comming from mysql_upgrade and
should not get an error for mysql.user table we just created.
*/
bool upgrade_check= (thd->lex->sql_command == SQLCOM_REPAIR &&
(thd->lex->check_opt.sql_flags &
(TT_FOR_UPGRADE | TT_FROM_MYSQL)) &&
(thd->security_ctx->master_access &
PRIV_REVEAL_MISSING_DEFINER));
Security_context *save_security_ctx= thd->security_ctx; Security_context *save_security_ctx= thd->security_ctx;
DBUG_ASSERT(!prelocking_placeholder); DBUG_ASSERT(!prelocking_placeholder);
if (prepare_view_security_context(thd)) if (prepare_view_security_context(thd, upgrade_check))
DBUG_RETURN(TRUE); {
if (upgrade_check)
{
/* REPAIR needs SELECT_ACL */
while ((tbl= tb++))
{
tbl->grant.privilege= SELECT_ACL;
tbl->security_ctx= save_security_ctx;
}
DBUG_RETURN(FALSE);
}
DBUG_RETURN(TRUE); // Fatal
}
thd->security_ctx= find_view_security_context(thd); thd->security_ctx= find_view_security_context(thd);
opt_trace_disable_if_no_security_context_access(thd); opt_trace_disable_if_no_security_context_access(thd);
while ((tbl= tb++)) while ((tbl= tb++))
...@@ -6707,7 +6729,7 @@ bool TABLE_LIST::prepare_security(THD *thd) ...@@ -6707,7 +6729,7 @@ bool TABLE_LIST::prepare_security(THD *thd)
#else #else
while ((tbl= tb++)) while ((tbl= tb++))
tbl->grant.privilege= ALL_KNOWN_ACL; tbl->grant.privilege= ALL_KNOWN_ACL;
#endif #endif /* NO_EMBEDDED_ACCESS_CHECKS */
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
......
...@@ -2763,7 +2763,7 @@ struct TABLE_LIST ...@@ -2763,7 +2763,7 @@ struct TABLE_LIST
bool prepare_security(THD *thd); bool prepare_security(THD *thd);
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *find_view_security_context(THD *thd); Security_context *find_view_security_context(THD *thd);
bool prepare_view_security_context(THD *thd); bool prepare_view_security_context(THD *thd, bool upgrade_check);
#endif #endif
/* /*
Cleanup for re-execution in a prepared statement or a stored Cleanup for re-execution in a prepared statement or a stored
......
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