Commit 1b993721 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-13472 rpl.rpl_semi_sync_wait_point crashes because of thd_destructor_proxy

InnoDB: in slow shutodwn mode do not stop purge threads
as long as some connection threads are running
parent 023131e3
connect con1, localhost, root;
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
root
root Filling schema table
system user InnoDB purge coordinator
system user InnoDB purge worker
......@@ -10,10 +12,22 @@ system user InnoDB purge worker
system user InnoDB purge worker
system user InnoDB shutdown handler
set global debug_dbug='+d,only_kill_system_threads';
connect con1, localhost, root;
set global innodb_fast_shutdown=0;
shutdown;
connection default;
disconnect con1;
select user,state from information_schema.processlist order by 2;
user state
root Filling schema table
system user InnoDB purge coordinator
system user InnoDB purge worker
system user InnoDB purge worker
system user InnoDB purge worker
system user InnoDB slow shutdown wait
set global innodb_fast_shutdown=1;
select user,state from information_schema.processlist order by 2;
user state
root Filling schema table
delete from t1 where a=3;
set global innodb_fast_shutdown=0;
ERROR 42000: Variable 'innodb_fast_shutdown' can't be set to the value of '0'
......
......@@ -2,6 +2,7 @@ source include/have_innodb.inc;
source include/not_embedded.inc;
source include/have_debug.inc;
connect con1, localhost, root;
create table t1 (a int) engine=innodb;
insert t1 values (1),(2),(3),(4);
delete from t1 where a=1;
......@@ -9,8 +10,7 @@ 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;
set global innodb_fast_shutdown=0;
let $_server_id= `SELECT @@server_id`;
let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect;
......@@ -20,11 +20,16 @@ send shutdown;
connection default;
disconnect con1;
sleep 5;
select user,state from information_schema.processlist order by 2;
set global innodb_fast_shutdown=1;
let $wait_condition=select count(*) = 0 from information_schema.processlist where user='system user';
source include/wait_condition.inc;
select user,state from information_schema.processlist order by 2;
delete from t1 where a=3;
--error ER_WRONG_VALUE_FOR_VAR
error ER_WRONG_VALUE_FOR_VAR;
set global innodb_fast_shutdown=0;
let $me=`select connection_id()`;
......
......@@ -351,10 +351,11 @@ thd_destructor_proxy(void *)
mysql_mutex_unlock(&thd_destructor_mutex);
srv_running = NULL;
if (srv_fast_shutdown == 0) {
while (trx_sys_any_active_transactions()) {
os_thread_sleep(1000);
}
while (srv_fast_shutdown == 0 &&
(trx_sys_any_active_transactions() ||
(uint)thread_count > srv_n_purge_threads + 1)) {
thd_proc_info(thd, "InnoDB slow shutdown wait");
os_thread_sleep(1000);
}
/* Some background threads might generate undo pages that will
......
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