--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc

--echo #
--echo # Bug #19386426	SHUTDOWN HANGS: CLIENT THREAD IN A LOOP
--echo # AROUND SRV_CONC_ENTER_INNODB()
--echo #

SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency;
SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay;
SET GLOBAL innodb_thread_concurrency = 1;
create table t1(f1 int) engine=innodb;
connect (con1, localhost, root);
connection con1;
SET DEBUG_SYNC= 'ib_after_row_insert
SIGNAL opened WAIT_FOR flushed';
send insert into t1 values(12);
connection default;
--echo connection default;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# User thread is waiting in FIFO queue.
SET DEBUG_SYNC= 'user_thread_waiting
SIGNAL flushed WAIT_FOR opened1';
send insert into t1 values(13);
connection con1;
reap;
# Set thread_concurrency to zero
set global innodb_thread_concurrency=0;
SET DEBUG_SYNC= 'now SIGNAL opened1';
connection default;
reap;
select * from t1;
drop table t1;
SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay;
