Commit 973b281e authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-18788 Live upgrade from MySQL 5.6/5.7 to MariaDB 10.4 fails with "Event...

MDEV-18788 Live upgrade from MySQL 5.6/5.7 to MariaDB 10.4 fails with "Event Scheduler: An error occurred when initializing system tables"

if columns or indexes are modified/renamed/dropped in an ALTER TABLE,
stat tables must be updated accordingly (e.g. all statistics for a column
should be dropped). But if a stat table doesn't exist, it's not a reason
to fail the whole ALTER TABLE operation - such an error should be ignored.
parent 06291c3f
create table t1 (a int);
alter table mysql.column_stats rename to mysql.column_stats1;
flush tables;
alter table t1 change a b varchar(100);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table mysql.column_stats1 rename to mysql.column_stats;
drop table t1;
#
# MDEV-18788 Live upgrade from MySQL 5.6/5.7 to MariaDB 10.4 fails with "Event Scheduler: An error occurred when initializing system tables"
#
create table t1 (a int);
alter table mysql.column_stats rename to mysql.column_stats1;
flush tables;
alter table t1 change a b varchar(100);
show create table t1;
alter table mysql.column_stats1 rename to mysql.column_stats;
drop table t1;
......@@ -273,7 +273,11 @@ static inline int open_stat_table_for_ddl(THD *thd, TABLE_LIST *table,
Open_tables_backup *backup)
{
table->init_one_table(&MYSQL_SCHEMA_NAME, stat_tab_name, NULL, TL_WRITE);
return open_system_tables_for_read(thd, table, backup);
No_such_table_error_handler nst_handler;
thd->push_internal_handler(&nst_handler);
int res= open_system_tables_for_read(thd, table, backup);
thd->pop_internal_handler();
return res;
}
......
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