1# 2# BUG#40827 - Killing insert-select to MyISAM can cause table corruption 3# 4CREATE TABLE `t1` ( 5`id` BIGINT(20) , 6`id1` BIGINT(20) AUTO_INCREMENT, 7KEY(id1), KEY(id) 8) ENGINE=MyISAM; 9CREATE TABLE `t2` ( 10`id` BIGINT(20) , 11`id1` BIGINT(20) AUTO_INCREMENT, 12KEY (id1), KEY(id) 13) ENGINE=MyISAM; 14INSERT INTO t2 (id) VALUES (123); 15INSERT INTO t2 (id) SELECT id FROM t2; 16INSERT INTO t2 (id) SELECT id FROM t2; 17INSERT INTO t2 (id) SELECT id FROM t2; 18INSERT INTO t2 (id) SELECT id FROM t2; 19INSERT INTO t2 (id) SELECT id FROM t2; 20INSERT INTO t2 (id) SELECT id FROM t2; 21INSERT INTO t2 (id) SELECT id FROM t2; 22INSERT INTO t2 (id) SELECT id FROM t2; 23INSERT INTO t2 (id) SELECT id FROM t2; 24INSERT INTO t2 (id) SELECT id FROM t2; 25# Switch to insert Connection 26SET SESSION debug='+d,wait_in_enable_indexes'; 27# Send insert data 28INSERT INTO t1(id) SELECT id FROM t2; 29# Switch to default Connection 30# Wait for insert data to reach the debug point 31SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST 32WHERE STATE = 'wait_in_enable_indexes' AND 33INFO = "INSERT INTO t1(id) SELECT id FROM t2" 34INTO @thread_id; 35KILL QUERY @thread_id; 36CHECK TABLE t1; 37Table Op Msg_type Msg_text 38test.t1 check status OK 39DROP TABLE t1,t2; 40ERROR HY000: 137 when fixing table 41