-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-9918: [ERROR] mysqld got signal 11 during ALTER TABLE
name
COL…
…UMN ADD Problem was that in-place online alter table was used on a table that had mismatch between MySQL frm file and InnoDB data dictionary. Fixed so that traditional "Copy" method is used if the MySQL frm and InnoDB data dictionary is not consistent.
- Loading branch information
Jan Lindström
committed
Apr 22, 2016
1 parent
e5410da
commit 628bc57
Showing
10 changed files
with
393 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MySQL.*"); | ||
call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB, which is different from the number of indexes .* defined in the MySQL.*"); | ||
create table t1 (pk int, i int, key(i)) engine=InnoDB; | ||
insert into t1 values (1,1),(2,2); | ||
flush tables; | ||
# Save the .frm file without the PK | ||
alter table t1 add primary key (pk); | ||
# Stop the server, replace the frm with the old one and restart the server | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`pk` int(11) DEFAULT NULL, | ||
`i` int(11) DEFAULT NULL, | ||
KEY `i` (`i`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | ||
Warnings: | ||
Warning 1082 InnoDB: Table test/t1 has a primary key in InnoDB data dictionary, but not in MySQL! | ||
Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL | ||
select * from t1; | ||
pk i | ||
1 1 | ||
2 2 | ||
alter table t1 add j int; | ||
Warnings: | ||
Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL | ||
show warnings; | ||
Level Code Message | ||
Warning 1082 InnoDB: Table test/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`pk` int(11) DEFAULT NULL, | ||
`i` int(11) DEFAULT NULL, | ||
`j` int(11) DEFAULT NULL, | ||
KEY `i` (`i`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | ||
alter table t1 add primary key (pk); | ||
show warnings; | ||
Level Code Message | ||
show create table t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`pk` int(11) NOT NULL DEFAULT '0', | ||
`i` int(11) DEFAULT NULL, | ||
`j` int(11) DEFAULT NULL, | ||
PRIMARY KEY (`pk`), | ||
KEY `i` (`i`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--source include/have_innodb.inc | ||
--source include/not_embedded.inc | ||
|
||
# | ||
# MDEV-9918: [ERROR] mysqld got signal 11 during ALTER TABLE `name` COLUMN ADD | ||
# | ||
|
||
call mtr.add_suppression("Table .* has a primary key in InnoDB data dictionary, but not in MySQL.*"); | ||
call mtr.add_suppression("InnoDB: Table .* contains .* indexes inside InnoDB, which is different from the number of indexes .* defined in the MySQL.*"); | ||
|
||
create table t1 (pk int, i int, key(i)) engine=InnoDB; | ||
insert into t1 values (1,1),(2,2); | ||
|
||
--let $datadir= `select @@datadir` | ||
|
||
flush tables; | ||
|
||
--echo # Save the .frm file without the PK | ||
|
||
--copy_file $datadir/test/t1.frm $MYSQLTEST_VARDIR/tmp/t1.frm | ||
|
||
alter table t1 add primary key (pk); | ||
|
||
--echo # Stop the server, replace the frm with the old one and restart the server | ||
|
||
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
--shutdown_server 10 | ||
--source include/wait_until_disconnected.inc | ||
|
||
--remove_file $datadir/test/t1.frm | ||
--copy_file $MYSQLTEST_VARDIR/tmp/t1.frm $datadir/test/t1.frm | ||
|
||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
show create table t1; | ||
select * from t1; | ||
alter table t1 add j int; | ||
show warnings; | ||
show create table t1; | ||
alter table t1 add primary key (pk); | ||
show warnings; | ||
show create table t1; | ||
# Cleanup | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.