2009-04-30 13:03:44 +02:00
#
# BUG#40827 - Killing insert-select to MyISAM can cause table corruption
#
2016-03-25 17:51:22 +01:00
CONNECT insertConn, localhost, root,,;
2009-04-30 13:03:44 +02:00
CREATE TABLE `t1` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY(id1), KEY(id)
) ENGINE=MyISAM;
CREATE TABLE `t2` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY (id1), KEY(id)
) ENGINE=MyISAM;
INSERT INTO t2 (id) VALUES (123);
2016-03-25 17:51:22 +01:00
connection insertConn;
2011-12-15 22:07:58 +01:00
SET SESSION debug_dbug='+d,wait_in_enable_indexes';
2009-04-30 13:03:44 +02:00
# Send insert data
INSERT INTO t1(id) SELECT id FROM t2;
2016-03-25 17:51:22 +01:00
connection default;
2009-04-30 13:03:44 +02:00
# Wait for insert data to reach the debug point
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = 'wait_in_enable_indexes' AND
INFO = "INSERT INTO t1(id) SELECT id FROM t2"
INTO @thread_id;
2018-05-22 19:08:39 +02:00
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
2009-04-30 13:03:44 +02:00
KILL QUERY @thread_id;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;
2016-03-25 17:51:22 +01:00
disconnect insertConn;
2017-05-22 08:20:20 +02:00
call mtr.add_suppression("Index for table '.*test.t1\\.MYI' is corrupt; try to repair it");
2017-05-12 14:27:49 +02:00
create table t1 (a int, index(a));
lock tables t1 write;
insert t1 values (1),(2),(1);
set @old_dbug=@@debug_dbug;
2020-01-09 13:38:48 +01:00
SET debug_dbug='+d,mi_lock_database_failure';
2017-05-12 14:27:49 +02:00
unlock tables;
2020-03-30 19:12:02 +02:00
ERROR HY000: Index for table './test/t1.MYI' is corrupt; try to repair it
SHOW WARNINGS;
Level Code Message
2017-05-22 08:20:20 +02:00
Error 126 Index for table './test/t1.MYI' is corrupt; try to repair it
2017-05-19 07:53:58 +02:00
Error 1030 Got error 22 "Invalid argument" from storage engine MyISAM
2020-01-09 13:38:48 +01:00
SET debug_dbug=@old_dbug;
2017-05-12 14:27:49 +02:00
drop table t1;