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
=== modified file 'mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.result'
--- mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.result 2011-04-11 19:43:06 +0000
+++ mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.result 2011-08-03 17:46:56 +0000
@@ -6,69 +6,65 @@
6INSERT INTO t2 VALUES(20);6INSERT INTO t2 VALUES(20);
7INSERT INTO t2 VALUES(10);7INSERT INTO t2 VALUES(10);
8INSERT INTO t2 VALUES(20);8INSERT INTO t2 VALUES(20);
9Issuing operation that should not return any rows and stopping the thread #1
10SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';9SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
11CREATE TABLE t1 (a INT);10CREATE TABLE t1 (a INT);
12SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';11SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
13Thread #1 stopped
14Issuing row-returning query and stopping the thread #2 at the end of query
15SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';12SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
16SELECT a FROM t2 WHERE a > 15;13SELECT a FROM t2 WHERE a > 15;
17SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';14SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
18Thread #2 stopped
19Look at thread states
20SHOW PROCESSLIST;15SHOW PROCESSLIST;
21Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read16Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
22### root ### test Query ### ### SHOW PROCESSLIST 0 0 217### root ### test Query ### ### SHOW PROCESSLIST 0 0 2
23### root ### test Query ### ### CREATE TABLE t1 (a INT) 0 0 118### root ### test Query ### ### CREATE TABLE t1 (a INT) 0 0 1
24### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 2 5 619### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 2 5 6
25SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist 20SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
26ORDER BY id;
27id info rows_sent rows_examined rows_read21id info rows_sent rows_examined rows_read
28### SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist 22### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
29ORDER BY id 0 0 1
30### CREATE TABLE t1 (a INT) 0 0 123### CREATE TABLE t1 (a INT) 0 0 1
31### SELECT a FROM t2 WHERE a > 15 2 5 624### SELECT a FROM t2 WHERE a > 15 2 5 6
32Let threads #1 and #2 finish their job
33SET DEBUG_SYNC= 'now SIGNAL threads_dumped';25SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
34a26a
35202720
36202820
37Issuing row-returning query and stopping the thread #2 in the middle of query29SET DEBUG_SYNC= 'sent_row SIGNAL thread1_ready WAIT_FOR threads_dumped';
30SELECT a FROM t2 WHERE a < 15;
31SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
38SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';32SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
39SELECT a FROM t2 WHERE a > 15;33SELECT a FROM t2 WHERE a > 15;
40SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';34SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
41Thread #2 stopped, look at its state
42SHOW PROCESSLIST;35SHOW PROCESSLIST;
43Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read36Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
44### root ### test Query ### ### SHOW PROCESSLIST 0 0 437### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
45### root ### test Sleep ### ### NULL 0 0 138### root ### test Query ### ### SELECT a FROM t2 WHERE a < 15 1 0 1
46### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 1 0 339### root ### test Query ### ### SELECT a FROM t2 WHERE a > 15 1 0 3
47SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;40SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
48id rows_sent rows_examined rows_read41id info rows_sent rows_examined rows_read
49### 0 0 142### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
50### 0 0 143### SELECT a FROM t2 WHERE a < 15 1 0 1
51### 1 0 344### SELECT a FROM t2 WHERE a > 15 1 0 3
52SET DEBUG_SYNC= 'now SIGNAL threads_dumped';45SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
53Let thread #2 finish its job46a
54a4710
55204810
56204910
57Issuing an UPDATE and stopping thread #250a
5120
5220
53SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread1_ready WAIT_FOR threads_dumped';
54UPDATE t2 SET a = 15 WHERE a = 20;
55SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
58SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';56SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
59UPDATE t2 SET a = 15 WHERE a = 10;57UPDATE t2 SET a = 15 WHERE a = 10;
60SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';58SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
61Thread #2 stopped, look at its state
62SHOW PROCESSLIST;59SHOW PROCESSLIST;
63Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read60Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
64### root ### test Query ### ### SHOW PROCESSLIST 0 0 461### root ### test Query ### ### SHOW PROCESSLIST 0 0 4
65### root ### test Sleep ### ### NULL 0 0 162### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 20 0 5 6
66### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 10 0 5 663### root ### test Query ### ### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
67SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;64SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
68id rows_sent rows_examined rows_read65id info rows_sent rows_examined rows_read
69### 0 0 166### SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id 0 0 1
70### 0 0 167### UPDATE t2 SET a = 15 WHERE a = 20 0 5 6
71### 0 5 668### UPDATE t2 SET a = 15 WHERE a = 10 0 5 6
72SET DEBUG_SYNC= 'now SIGNAL threads_dumped';69SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
73Let thread #2 finish its job
74DROP TABLES t1, t2;70DROP TABLES t1, t2;
7571
=== modified file 'mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.test'
--- mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.test 2011-04-11 19:43:06 +0000
+++ mysql-test/processlist_row_stats.patch/percona_processlist_row_stats.test 2011-08-03 17:46:56 +0000
@@ -13,76 +13,63 @@
13INSERT INTO t2 VALUES(10);13INSERT INTO t2 VALUES(10);
14INSERT INTO t2 VALUES(20);14INSERT INTO t2 VALUES(20);
1515
16connect (conn1, localhost, root, ,);16--connect (conn1, localhost, root, ,)
17connect (conn2, localhost, root, ,);17--connect (conn2, localhost, root, ,)
1818
19--connection conn119--connection conn1
20echo Issuing operation that should not return any rows and stopping the thread #1;
21SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';20SET DEBUG_SYNC= 'locked_table_name SIGNAL thread1_ready WAIT_FOR threads_dumped';
22send CREATE TABLE t1 (a INT);21send CREATE TABLE t1 (a INT);
23
24--connection default22--connection default
25SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';23SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
26--echo Thread #1 stopped
2724
28--connection conn225--connection conn2
29echo Issuing row-returning query and stopping the thread #2 at the end of query;
30SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';26SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
31send SELECT a FROM t2 WHERE a > 15;27send SELECT a FROM t2 WHERE a > 15;
32
33--connection default28--connection default
34SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';29SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
35--echo Thread #2 stopped30
36--echo Look at thread states31--source include/percona_processlist_row_stats_show.inc
3732
38--replace_column 1 ### 3 ### 6 ### 7 ###33--connection conn1
39SHOW PROCESSLIST;34reap;
40# The running threads are different between SHOW above and SELECT below. Thus select info too to 35--connection conn2
41# show the difference. Results are in the same order as in SHOW.36reap;
42--replace_column 1 ###37
43SELECT id, info, rows_sent, rows_examined, rows_read FROM information_schema.processlist 38--connection conn1
44ORDER BY id;39SET DEBUG_SYNC= 'sent_row SIGNAL thread1_ready WAIT_FOR threads_dumped';
4540send SELECT a FROM t2 WHERE a < 15;
46echo Let threads #1 and #2 finish their job;41--connection default
47SET DEBUG_SYNC= 'now SIGNAL threads_dumped';42SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
4843
49--connection conn144--connection conn2
50reap;
51
52--connection conn2
53reap;
54echo Issuing row-returning query and stopping the thread #2 in the middle of query;
55SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';45SET DEBUG_SYNC= 'sent_row SIGNAL thread2_ready WAIT_FOR threads_dumped';
56send SELECT a FROM t2 WHERE a > 15;46send SELECT a FROM t2 WHERE a > 15;
57
58--connection default47--connection default
59SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';48SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
60echo Thread #2 stopped, look at its state;49
6150--source include/percona_processlist_row_stats_show.inc
62--replace_column 1 ### 3 ### 6 ### 7 ###51
63SHOW PROCESSLIST;52--connection conn1
64--replace_column 1 ###53reap;
65SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;54--connection conn2
66SET DEBUG_SYNC= 'now SIGNAL threads_dumped';55reap;
67echo Let thread #2 finish its job;56
6857--connection conn1
69--connection conn258SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread1_ready WAIT_FOR threads_dumped';
70reap;59send UPDATE t2 SET a = 15 WHERE a = 20;
71echo Issuing an UPDATE and stopping thread #2;60--connection default
61SET DEBUG_SYNC= 'now WAIT_FOR thread1_ready';
62
63--connection conn2
72SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';64SET DEBUG_SYNC= 'execute_command_after_close_tables SIGNAL thread2_ready WAIT_FOR threads_dumped';
73send UPDATE t2 SET a = 15 WHERE a = 10;65send UPDATE t2 SET a = 15 WHERE a = 10;
74
75--connection default66--connection default
76SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';67SET DEBUG_SYNC= 'now WAIT_FOR thread2_ready';
77echo Thread #2 stopped, look at its state;68
7869--source include/percona_processlist_row_stats_show.inc
79--replace_column 1 ### 3 ### 6 ### 7 ###70
80SHOW PROCESSLIST;71--connection conn1
81--replace_column 1 ###72reap;
82SELECT id,rows_sent,rows_examined,rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY Id;
83SET DEBUG_SYNC= 'now SIGNAL threads_dumped';
84echo Let thread #2 finish its job;
85
86--connection conn273--connection conn2
87reap;74reap;
8875
8976
=== added file 'mysql-test/processlist_row_stats.patch/percona_processlist_row_stats_show.inc'
--- mysql-test/processlist_row_stats.patch/percona_processlist_row_stats_show.inc 1970-01-01 00:00:00 +0000
+++ mysql-test/processlist_row_stats.patch/percona_processlist_row_stats_show.inc 2011-08-03 17:46:56 +0000
@@ -0,0 +1,7 @@
1--replace_column 1 ### 3 ### 6 ### 7 ###
2SHOW PROCESSLIST;
3
4--replace_column 1 ###
5SELECT id, info, rows_sent, rows_examined, rows_read FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
6
7SET DEBUG_SYNC= 'now SIGNAL threads_dumped';

Subscribers

People subscribed via source and target branches