# Testing of INFORMATION_SCHEMA.PROCESSLIST fields ROWS_SENT and ROWS_EXAMINED
--source include/have_debug_sync.inc

CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES(10);
INSERT INTO t2 VALUES(10);
INSERT INTO t2 VALUES(20);
INSERT INTO t2 VALUES(10);
INSERT INTO t2 VALUES(20);

--source include/count_sessions.inc
--connect (conn1, localhost, root, ,)
--connect (conn2, localhost, root, ,)

--connection conn1
SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped NO_CLEAR_EVENT';
send CREATE TABLE t1 (a INT);
--connection default
SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';

--connection conn2
SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped NO_CLEAR_EVENT';
send SELECT a FROM t2 WHERE a > 15;
--connection default
SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';

--source include/percona_processlist_row_stats_show.inc

--connection conn1
reap;
--connection conn2
reap;
SET DEBUG_SYNC= 'RESET';

--connection conn1
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'sent_row SIGNAL thread1_ready WAIT_FOR threads_dumped NO_CLEAR_EVENT';
send SELECT a FROM t2 WHERE a < 15;
--connection default
SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';

--connection conn2
SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped NO_CLEAR_EVENT';
send SELECT a FROM t2 WHERE a > 15;
--connection default
SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';

--source include/percona_processlist_row_stats_show.inc

--connection conn1
reap;
--connection conn2
reap;
SET DEBUG_SYNC= 'RESET';

--connection conn1
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread1_ready WAIT_FOR threads_dumped NO_CLEAR_EVENT';
send UPDATE t2 SET a = 15 WHERE a = 20;
--connection default
SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';

--connection conn2
SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped NO_CLEAR_EVENT';
send UPDATE t2 SET a = 15 WHERE a = 10;
--connection default
SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';

--source include/percona_processlist_row_stats_show.inc

--connection conn1
reap;
--connection conn2
reap;

--connection default
disconnect conn1;
disconnect conn2;

DROP TABLES t1, t2;
SET DEBUG_SYNC= 'RESET';

--source include/wait_until_count_sessions.inc
