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