mirror of
https://github.com/MariaDB/server.git
synced 2025-04-22 07:05:33 +02:00
MDEV-7404 REPAIR multiple tables crash in MDL_ticket::has_stronger_or_equal_type
mysql_alter_table() that is used in mysql_recreate_table() doesn't expect many tables in the TABLE_LIST.
This commit is contained in:
parent
f20598b27d
commit
5900333aa5
3 changed files with 48 additions and 5 deletions
21
mysql-test/suite/innodb/r/multi_repair-7404.result
Normal file
21
mysql-test/suite/innodb/r/multi_repair-7404.result
Normal file
|
@ -0,0 +1,21 @@
|
|||
create table `t1`(`a` int) engine=innodb partition by key (`a`);
|
||||
create table `t2`(`b` int) engine=innodb;
|
||||
create table `t3`(`c` int) engine=innodb;
|
||||
insert t1 values (1);
|
||||
insert t2 values (2);
|
||||
insert t3 values (3);
|
||||
repair table `t1`,`t2`,`t3`;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
test.t2 repair status OK
|
||||
test.t3 repair status OK
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
select * from t2;
|
||||
b
|
||||
2
|
||||
select * from t3;
|
||||
c
|
||||
3
|
||||
drop table t1, t2, t3;
|
18
mysql-test/suite/innodb/t/multi_repair-7404.test
Normal file
18
mysql-test/suite/innodb/t/multi_repair-7404.test
Normal file
|
@ -0,0 +1,18 @@
|
|||
#
|
||||
# MDEV-7404 REPAIR multiple tables crash in MDL_ticket::has_stronger_or_equal_type
|
||||
#
|
||||
|
||||
--source include/have_partition.inc
|
||||
--source include/have_innodb.inc
|
||||
create table `t1`(`a` int) engine=innodb partition by key (`a`);
|
||||
create table `t2`(`b` int) engine=innodb;
|
||||
create table `t3`(`c` int) engine=innodb;
|
||||
insert t1 values (1);
|
||||
insert t2 values (2);
|
||||
insert t3 values (3);
|
||||
repair table `t1`,`t2`,`t3`;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
select * from t3;
|
||||
drop table t1, t2, t3;
|
||||
|
|
@ -7644,12 +7644,12 @@ err:
|
|||
|
||||
|
||||
/*
|
||||
Recreates tables by calling mysql_alter_table().
|
||||
Recreates one table by calling mysql_alter_table().
|
||||
|
||||
SYNOPSIS
|
||||
mysql_recreate_table()
|
||||
thd Thread handler
|
||||
tables Tables to recreate
|
||||
table_list Table to recreate
|
||||
|
||||
RETURN
|
||||
Like mysql_alter_table().
|
||||
|
@ -7658,9 +7658,9 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list)
|
|||
{
|
||||
HA_CREATE_INFO create_info;
|
||||
Alter_info alter_info;
|
||||
TABLE_LIST *next_table= table_list->next_global;
|
||||
|
||||
DBUG_ENTER("mysql_recreate_table");
|
||||
DBUG_ASSERT(!table_list->next_global);
|
||||
/*
|
||||
table_list->table has been closed and freed. Do not reference
|
||||
uninitialized data. open_tables() could fail.
|
||||
|
@ -7672,15 +7672,19 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list)
|
|||
table_list->lock_type= TL_READ_NO_INSERT;
|
||||
/* Same applies to MDL request. */
|
||||
table_list->mdl_request.set_type(MDL_SHARED_NO_WRITE);
|
||||
/* hide following tables from open_tables() */
|
||||
table_list->next_global= NULL;
|
||||
|
||||
bzero((char*) &create_info, sizeof(create_info));
|
||||
create_info.row_type=ROW_TYPE_NOT_USED;
|
||||
create_info.default_table_charset=default_charset_info;
|
||||
/* Force alter table to recreate table */
|
||||
alter_info.flags= (ALTER_CHANGE_COLUMN | ALTER_RECREATE);
|
||||
DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info,
|
||||
bool res= mysql_alter_table(thd, NullS, NullS, &create_info,
|
||||
table_list, &alter_info, 0,
|
||||
(ORDER *) 0, 0, 0));
|
||||
(ORDER *) 0, 0, 0);
|
||||
table_list->next_global= next_table;
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue