mariadb/mysql-test/suite/innodb/t/create_select.test
Marko Mäkelä a5e268a293 MDEV-20102 Phantom InnoDB table remains after interrupted CREATE...SELECT
This is a regression due to MDEV-16515 that affects some versions in
the MariaDB 10.1 server series starting with 10.1.35, and possibly
all versions starting with 10.2.17, 10.3.8, and 10.4.0.

The idea of MDEV-16515 is to allow DROP TABLE to be interrupted,
in case it was stuck due to some concurrent activity. We already
made some cases of internal DROP TABLE immune to kill in MDEV-18237,
MDEV-16647, MDEV-17470. We must include the cleanup of
CREATE TABLE...SELECT in the list of such internal DROP TABLE.

ha_innobase::delete_table(): Pass create_failed=true if the current
SQL statement is CREATE, so that the table will be dropped.

row_drop_table_for_mysql(): If create_failed=true, do not allow
the operation to be interrupted.
2019-07-22 14:55:46 +03:00

28 lines
744 B
Text

--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/count_sessions.inc
let $ID= `SELECT @id := CONNECTION_ID()`;
connect (con1, localhost, root,,);
let $ignore= `SELECT @id := $ID`;
connection default;
send CREATE TABLE t1 ENGINE=InnoDB SELECT * FROM seq_1_to_100000000;
connection con1;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'Sending data'
and info = 'CREATE TABLE t1 ENGINE=InnoDB SELECT * FROM seq_1_to_100000000';
--source include/wait_condition.inc
KILL QUERY @id;
disconnect con1;
connection default;
--error ER_QUERY_INTERRUPTED
reap;
CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB;
DROP TABLE t1;
--source include/wait_until_count_sessions.inc