mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
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.
This commit is contained in:
parent
2fcd8c1252
commit
7e507f262a
3 changed files with 55 additions and 2 deletions
|
@ -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
|
||||
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;
|
||||
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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
-- source include/mysql_upgrade_preparation.inc
|
||||
-- source include/have_working_dns.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_partition.inc
|
||||
|
||||
#
|
||||
# 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'
|
|||
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;
|
||||
|
||||
--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;
|
|||
# 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");
|
||||
|
|
Loading…
Reference in a new issue