Commit fc279d7e authored by Sergei Golubchik's avatar Sergei Golubchik

InnoDB: test case to exploit a purge thread shutdown race condition

execute queries after purge thread has exited, but the connection
thread hasn't

before c720e68f it used to crash
parent 34319403
create table t1 (a int) engine=innodb;
insert t1 values (1),(2),(3),(4);
delete from t1 where a=1;
select user,state from information_schema.processlist order by 2;
user state
system user
system user
system user
system user
root Filling schema table
system user InnoDB shutdown handler
set global debug_dbug='+d,only_kill_system_threads';
connect con1, localhost, root;
shutdown;
connection default;
disconnect con1;
delete from t1 where a=3;
kill ID;
ERROR 70100: Connection was killed
drop table t1;
source include/have_innodb.inc;
source include/not_embedded.inc;
source include/have_debug.inc;
create table t1 (a int) engine=innodb;
insert t1 values (1),(2),(3),(4);
delete from t1 where a=1;
select user,state from information_schema.processlist order by 2;
set global debug_dbug='+d,only_kill_system_threads';
connect con1, localhost, root;
let $_server_id= `SELECT @@server_id`;
let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect;
exec echo "wait" > $_expect_file_name;
send shutdown;
connection default;
disconnect con1;
let $wait_condition=select count(*) = 0 from information_schema.processlist where user='system user';
source include/wait_condition.inc;
delete from t1 where a=3;
let $me=`select connection_id()`;
replace_result $me ID;
error ER_CONNECTION_KILLED;
eval kill $me;
source include/start_mysqld.inc;
drop table t1;
......@@ -1695,6 +1695,10 @@ static void close_connections(void)
if (tmp->slave_thread)
continue;
/* cannot use 'continue' inside DBUG_EXECUTE_IF()... */
if (DBUG_EVALUATE_IF("only_kill_system_threads", !tmp->system_thread, 0))
continue;
#ifdef WITH_WSREP
/* skip wsrep system threads as well */
if (WSREP(tmp) && (tmp->wsrep_exec_mode==REPL_RECV || tmp->wsrep_applier))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment