#
# Debug build tests for InnoDB extensions in the slow query log
#
--source include/have_innodb.inc
--source include/have_debug_sync.inc

--source include/log_prepare.inc

--source include/count_sessions.inc

SET @saved_innodb_thread_sleep_delay = @@GLOBAL.innodb_thread_sleep_delay;
SET @saved_innodb_thread_concurrency = @@GLOBAL.innodb_thread_concurrency;
SET GLOBAL innodb_thread_concurrency = 1;

CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;

--connect con1,localhost,root
--connection con1

SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL inserted WAIT_FOR finish1';
send INSERT INTO t1 VALUES ();

--connect con2,localhost,root
--connection con2

SET DEBUG_SYNC = 'now WAIT_FOR inserted';
SET DEBUG_SYNC = 'user_thread_waiting SIGNAL waiting WAIT_FOR finish2';

SET SESSION long_query_time=0;
SET SESSION log_slow_verbosity='microtime,innodb';
--let log_file=percona.slow_extended.innodb_debug
--source include/log_start.inc

send INSERT INTO t1 VALUES ();

--connection default
SET DEBUG_SYNC = 'now WAIT_FOR waiting';
SET DEBUG_SYNC = 'now SIGNAL finish2';
real_sleep 2;
SET DEBUG_SYNC = 'now SIGNAL finish1';

--connection con1
reap;

SET DEBUG_SYNC = 'reset';

--disconnect con1

--connection con2
reap;
--source include/log_stop.inc
--source include/percona_slow_log_verbosity_grep.inc
--disconnect con2

--connection default
SET GLOBAL innodb_thread_concurrency = @saved_innodb_thread_concurrency;
SET GLOBAL innodb_thread_sleep_delay = @saved_innodb_thread_sleep_delay;

DROP TABLE t1;

--source include/log_cleanup.inc

--source include/wait_until_count_sessions.inc
