From 7e507f262a826c9c799355755541120be8c7352a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 20 Jul 2017 15:08:24 +0200 Subject: MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars InnoDB fix will come in MDEV-13360. Here I just fix upgrades from old unfixed InnoDBs - bad data makes the following copying ALTER TABLE to fail. --- scripts/mysql_system_tables_fix.sql | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index f034af4f898..1bb601ef5f9 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -667,6 +667,15 @@ DROP PROCEDURE mysql.count_duplicate_host_names; # Convering the host name to lower case for existing users UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host; +# fix bad data when upgrading from unfixed InnoDB (MDEV-13360) +set @str="delete from innodb_index_stats where length(table_name) > 64"; +set @str=if(@have_innodb <> 0, @str, "set @dummy = 0"); +prepare stmt from @str; +execute stmt; +set @str=replace(@str, "innodb_index_stats", "innodb_table_stats"); +prepare stmt from @str; +execute stmt; + # update timestamp fields in the innodb stat tables set @str="alter table mysql.innodb_index_stats modify last_update timestamp not null default current_timestamp on update current_timestamp"; set @str=if(@have_innodb <> 0, @str, "set @dummy = 0"); -- cgit v1.2.1