1
DROP TABLE IF EXISTS t1;
2
DROP TABLE IF EXISTS t2;
3
CREATE TABLE t2 (a INT);
4
INSERT INTO t2 VALUES(10);
5
INSERT INTO t2 VALUES(10);
6
INSERT INTO t2 VALUES(20);
7
INSERT INTO t2 VALUES(10);
8
INSERT INTO t2 VALUES(20);
9
Issuing operation that should not return any rows and stopping the thread #1
10
SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
11
CREATE TABLE t1 (a INT);
12
Issuing row-returning query and stopping the thread #2 at the end of query
13
SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
14
SELECT a FROM t2 WHERE a > 15;
15
SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
16
SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
17
Threads #1 and #2 stopped, look at their state
19
Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
20
### root ### test Query ### ### SHOW PROCESSLIST 0 0 2
21
### root ### test Query ### ### CREATE TABLE t1 (a INT) 0 0 1
22
### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 2 5 6
23
SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
25
id info rows_sent rows_examined rows_read
26
### SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
28
### CREATE TABLE t1 (a INT) 0 0 1
29
### SELECT a FROM t2 WHERE a > 15 2 5 6
30
Let threads #1 and #2 finish their job
31
SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
35
Issuing row-returning query and stopping the thread #2 in the middle of query
36
SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
37
SELECT a FROM t2 WHERE a > 15;
38
SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
39
Thread #2 stopped, look at its state
41
Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
42
### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
43
### root ### test Sleep ### ### NULL 0 0 1
44
### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 1 0 3
45
SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
46
id rows_sent rows_examined rows_read
50
SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
51
Let thread #2 finish its job
55
Issuing an UPDATE and stopping thread #2
56
SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
57
UPDATE t2 SET a = 15 WHERE a = 10;
58
SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
59
Thread #2 stopped, look at its state
61
Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
62
### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
63
### root ### test Sleep ### ### NULL 0 0 1
64
### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
65
SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
66
id rows_sent rows_examined rows_read
70
SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
71
Let thread #2 finish its job