Merge lp:~tsarev/percona-server/5.5-processlist_rows_stats-sporadic_fails-fix into lp:percona-server/5.5

Proposed by Oleg Tsarev
Status: Merged
Merged at revision: 142
Proposed branch: lp:~tsarev/percona-server/5.5-processlist_rows_stats-sporadic_fails-fix
Merge into: lp:percona-server/5.5
Diff against target: 230 lines (+71/-81)
3 files modified
mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.result (+27/-31)
mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.test (+37/-50)
mysql-test/processlist_row_stats.patch/percona_processlist_row_stats_show.inc (+7/-0)
To merge this branch: bzr merge lp:~tsarev/percona-server/5.5-processlist_rows_stats-sporadic_fails-fix
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Stewart Smith Pending
Review via email: mp+70332@code.launchpad.net

This proposal supersedes a proposal from 2011-08-03.

Description of the change

1) Now every time before I call SHOW PROCESSLIST or SELECT ... FROM INFORMATION_SCHEMA.PROCESSLIST I first switch threads to consistent state.
  Before that connection conn1 sometime not complete run of previous query, and result of test was sporadic.
  Example of fail available here:
  http://jenkins.percona.com/view/Percona%20Server%205.5/job/percona-server-5.5-param/66/BUILD_TYPE=debug,Host=ubuntu-natty-32bit/consoleText
  Example of fail:
   Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
   ### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
  -### root ### test Sleep ### ### NULL 0 0 1
  +### root ### test Query ### ### CREATE TABLE t1 (a INT) 0 0 1
   ### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 1 0 3

  As you can see, conn1 not complete yet CREATE TABLE (table was created, but thread not switched to state "Sleep" yet)

2) I removed useless echo messages. This messages doesn't have any usefull information, but do noise in output

3) Also I extend test by additional queries (need for (1) - consistent state of 1)

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

LGTM if the Jenkins test results are clean

review: Approve
Revision history for this message
Oleg Tsarev (tsarev) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.result'
2--- mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.result 2011-04-11 19:43:06 +0000
3+++ mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.result 2011-08-03 17:46:56 +0000
4@@ -6,69 +6,65 @@
5 INSERT INTO t2 VALUES(20);
6 INSERT INTO t2 VALUES(10);
7 INSERT INTO t2 VALUES(20);
8-Issuing operation that should not return any rows and stopping the thread #1
9 SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
10 CREATE TABLE t1 (a INT);
11 SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
12-Thread #1 stopped
13-Issuing row-returning query and stopping the thread #2 at the end of query
14 SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
15 SELECT a FROM t2 WHERE a > 15;
16 SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
17-Thread #2 stopped
18-Look at thread states
19 SHOW PROCESSLIST;
20 Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
21 ### root ### test Query ### ### SHOW PROCESSLIST 0 0 2
22 ### root ### test Query ### ### CREATE TABLE t1 (a INT) 0 0 1
23 ### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 2 5 6
24-SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
25-ORDER BY id;
26+SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
27 id info rows_sent rows_examined rows_read
28-### SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
29-ORDER BY id 0 0 1
30+### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
31 ### CREATE TABLE t1 (a INT) 0 0 1
32 ### SELECT a FROM t2 WHERE a > 15 2 5 6
33-Let threads #1 and #2 finish their job
34 SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
35 a
36 20
37 20
38-Issuing row-returning query and stopping the thread #2 in the middle of query
39+SET DEBUG_SYNC= 'sent_row SIGNAL thread1_ready WAIT_FOR threads_dumped';
40+SELECT a FROM t2 WHERE a < 15;
41+SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
42 SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
43 SELECT a FROM t2 WHERE a > 15;
44 SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
45-Thread #2 stopped, look at its state
46 SHOW PROCESSLIST;
47 Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
48 ### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
49-### root ### test Sleep ### ### NULL 0 0 1
50+### root ### test Query ### ### SELECT a FROM t2 WHERE a < 15 1 0 1
51 ### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 1 0 3
52-SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
53-id rows_sent rows_examined rows_read
54-### 0 0 1
55-### 0 0 1
56-### 1 0 3
57+SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
58+id info rows_sent rows_examined rows_read
59+### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
60+### SELECT a FROM t2 WHERE a < 15 1 0 1
61+### SELECT a FROM t2 WHERE a > 15 1 0 3
62 SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
63-Let thread #2 finish its job
64-a
65-20
66-20
67-Issuing an UPDATE and stopping thread #2
68+a
69+10
70+10
71+10
72+a
73+20
74+20
75+SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread1_ready WAIT_FOR threads_dumped';
76+UPDATE t2 SET a = 15 WHERE a = 20;
77+SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
78 SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
79 UPDATE t2 SET a = 15 WHERE a = 10;
80 SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
81-Thread #2 stopped, look at its state
82 SHOW PROCESSLIST;
83 Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
84 ### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
85-### root ### test Sleep ### ### NULL 0 0 1
86+### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 20 0 5 6
87 ### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
88-SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
89-id rows_sent rows_examined rows_read
90-### 0 0 1
91-### 0 0 1
92-### 0 5 6
93+SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
94+id info rows_sent rows_examined rows_read
95+### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
96+### UPDATE t2 SET a = 15 WHERE a = 20 0 5 6
97+### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
98 SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
99-Let thread #2 finish its job
100 DROP TABLES t1, t2;
101
102=== modified file 'mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.test'
103--- mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.test 2011-04-11 19:43:06 +0000
104+++ mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.test 2011-08-03 17:46:56 +0000
105@@ -13,76 +13,63 @@
106 INSERT INTO t2 VALUES(10);
107 INSERT INTO t2 VALUES(20);
108
109-connect (conn1, localhost, root, ,);
110-connect (conn2, localhost, root, ,);
111+--connect (conn1, localhost, root, ,)
112+--connect (conn2, localhost, root, ,)
113
114 --connection conn1
115-echo Issuing operation that should not return any rows and stopping the thread #1;
116 SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
117 send CREATE TABLE t1 (a INT);
118-
119 --connection default
120 SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
121---echo Thread #1 stopped
122
123 --connection conn2
124-echo Issuing row-returning query and stopping the thread #2 at the end of query;
125 SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
126 send SELECT a FROM t2 WHERE a > 15;
127-
128 --connection default
129 SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
130---echo Thread #2 stopped
131---echo Look at thread states
132-
133---replace_column 1 ### 3 ### 6 ### 7 ###
134-SHOW PROCESSLIST;
135-# The running threads are different between SHOW above and SELECT below. Thus select info too to
136-# show the difference. Results are in the same order as in SHOW.
137---replace_column 1 ###
138-SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist
139-ORDER BY id;
140-
141-echo Let threads #1 and #2 finish their job;
142-SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
143-
144---connection conn1
145-reap;
146-
147---connection conn2
148-reap;
149-echo Issuing row-returning query and stopping the thread #2 in the middle of query;
150+
151+--source include/percona_processlist_row_stats_show.inc
152+
153+--connection conn1
154+reap;
155+--connection conn2
156+reap;
157+
158+--connection conn1
159+SET DEBUG_SYNC= 'sent_row SIGNAL thread1_ready WAIT_FOR threads_dumped';
160+send SELECT a FROM t2 WHERE a < 15;
161+--connection default
162+SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
163+
164+--connection conn2
165 SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
166 send SELECT a FROM t2 WHERE a > 15;
167-
168 --connection default
169 SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
170-echo Thread #2 stopped, look at its state;
171-
172---replace_column 1 ### 3 ### 6 ### 7 ###
173-SHOW PROCESSLIST;
174---replace_column 1 ###
175-SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
176-SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
177-echo Let thread #2 finish its job;
178-
179---connection conn2
180-reap;
181-echo Issuing an UPDATE and stopping thread #2;
182+
183+--source include/percona_processlist_row_stats_show.inc
184+
185+--connection conn1
186+reap;
187+--connection conn2
188+reap;
189+
190+--connection conn1
191+SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread1_ready WAIT_FOR threads_dumped';
192+send UPDATE t2 SET a = 15 WHERE a = 20;
193+--connection default
194+SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
195+
196+--connection conn2
197 SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
198 send UPDATE t2 SET a = 15 WHERE a = 10;
199-
200 --connection default
201 SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
202-echo Thread #2 stopped, look at its state;
203-
204---replace_column 1 ### 3 ### 6 ### 7 ###
205-SHOW PROCESSLIST;
206---replace_column 1 ###
207-SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
208-SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
209-echo Let thread #2 finish its job;
210-
211+
212+--source include/percona_processlist_row_stats_show.inc
213+
214+--connection conn1
215+reap;
216 --connection conn2
217 reap;
218
219
220=== added file 'mysql-test/processlist_row_stats.patch/percona_processlist_row_stats_show.inc'
221--- mysql-test/processlist_row_stats.patch/percona_processlist_row_stats_show.inc 1970-01-01 00:00:00 +0000
222+++ mysql-test/processlist_row_stats.patch/percona_processlist_row_stats_show.inc 2011-08-03 17:46:56 +0000
223@@ -0,0 +1,7 @@
224+--replace_column 1 ### 3 ### 6 ### 7 ###
225+SHOW PROCESSLIST;
226+
227+--replace_column 1 ###
228+SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
229+
230+SET DEBUG_SYNC= 'now SIGNAL threads_dumped';

Subscribers

People subscribed via source and target branches