Commit 7e507f26 authored by Sergei Golubchik's avatar Sergei Golubchik

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.
parent 2fcd8c12
...@@ -464,4 +464,25 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca ...@@ -464,4 +464,25 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca
even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost; DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr; DROP PROCEDURE test.pr;
End of tests use test;
alter table mysql.innodb_table_stats modify last_update int not null;
create table extralongname_extralongname_extralongname_extralongname_ext (
id int(10) unsigned not null,
created_date date not null,
created timestamp not null,
primary key (created,id,created_date)
) engine=innodb stats_persistent=1 default charset=latin1
partition by range (year(created_date))
subpartition by hash (month(created_date))
subpartitions 2 (
partition p2007 values less than (2008),
partition p2008 values less than (2009)
);
select length(table_name) from mysql.innodb_table_stats;
length(table_name)
79
79
79
79
drop table extralongname_extralongname_extralongname_extralongname_ext;
End of 10.0 tests
-- source include/mysql_upgrade_preparation.inc -- source include/mysql_upgrade_preparation.inc
-- source include/have_working_dns.inc -- source include/have_working_dns.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_partition.inc
# #
# Basic test that we can run mysql_upgrde and that it finds the # Basic test that we can run mysql_upgrde and that it finds the
...@@ -166,4 +167,26 @@ SELECT grantor FROM mysql.tables_priv WHERE db = 'mysql' AND table_name = 'user' ...@@ -166,4 +167,26 @@ SELECT grantor FROM mysql.tables_priv WHERE db = 'mysql' AND table_name = 'user'
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost; DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr; DROP PROCEDURE test.pr;
--echo End of tests #
# MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars
#
use test;
alter table mysql.innodb_table_stats modify last_update int not null;
create table extralongname_extralongname_extralongname_extralongname_ext (
id int(10) unsigned not null,
created_date date not null,
created timestamp not null,
primary key (created,id,created_date)
) engine=innodb stats_persistent=1 default charset=latin1
partition by range (year(created_date))
subpartition by hash (month(created_date))
subpartitions 2 (
partition p2007 values less than (2008),
partition p2008 values less than (2009)
);
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
select length(table_name) from mysql.innodb_table_stats;
drop table extralongname_extralongname_extralongname_extralongname_ext;
--echo End of 10.0 tests
...@@ -667,6 +667,15 @@ DROP PROCEDURE mysql.count_duplicate_host_names; ...@@ -667,6 +667,15 @@ DROP PROCEDURE mysql.count_duplicate_host_names;
# Convering the host name to lower case for existing users # Convering the host name to lower case for existing users
UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host; 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 # 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="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"); set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
......
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