Merge lp:~tsarev/percona-server/5.1_fix_bug_878709 into lp:percona-server/5.1

Proposed by Oleg Tsarev
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 411
Proposed branch: lp:~tsarev/percona-server/5.1_fix_bug_878709
Merge into: lp:percona-server/5.1
Diff against target: 155 lines (+52/-61)
3 files modified
Percona-Server/mysql-test/r/percona_status_wait_query_cache_mutex.result (+16/-23)
Percona-Server/mysql-test/t/percona_status_wait_query_cache_mutex.test (+32/-34)
Percona-Server/sql/sql_cache.cc (+4/-4)
To merge this branch: bzr merge lp:~tsarev/percona-server/5.1_fix_bug_878709
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+84305@code.launchpad.net

This proposal supersedes a proposal from 2011-11-25.

Description of the change

Jenkins: http://jenkins.percona.com/view/Percona%20Server%205.1/job/percona-server-5.1-param/208/

Fixed sporadic test fails of main.percona_status_wait_query_cache_mutex.
Bug #878709.
Reason of bug - incorrect test synchronisation.
I removed sleep(1) from code, replace by "before_query_cache_mutex" and "after_query_cache_mutex" debug sync points.

Same for https://code.launchpad.net/~tsarev/percona-server/5.5_fix_bug_878709/+merge/83030

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

LGTM, thank you.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/mysql-test/r/percona_status_wait_query_cache_mutex.result'
2--- Percona-Server/mysql-test/r/percona_status_wait_query_cache_mutex.result 2011-11-24 02:01:05 +0000
3+++ Percona-Server/mysql-test/r/percona_status_wait_query_cache_mutex.result 2011-12-02 17:54:27 +0000
4@@ -1,27 +1,20 @@
5-set GLOBAL query_cache_size=1355776;
6+SET GLOBAL query_cache_size=1355776;
7 flush query cache;
8 flush query cache;
9 reset query cache;
10 flush status;
11-DROP TABLE IF EXISTS t;
12-CREATE TABLE t(id INT, number INT);
13-INSERT INTO t VALUES (0,1);
14-INSERT INTO t VALUES (1,2);
15-INSERT INTO t VALUES (2,3);
16-SELECT number from t where id > 0;
17-number
18-2
19-3
20-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
21-SELECT number from t where id > 0;
22-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
23-SELECT number from t where id > 0;
24-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
25-SHOW PROCESSLIST;
26-Id User Host db Command Time State Info
27-Id root localhost test Sleep Time NULL
28-Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
29-Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
30-Id root localhost test Query Time NULL SHOW PROCESSLIST
31-DROP TABLE t;
32-set GLOBAL query_cache_size=0;
33+SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
34+SELECT "mutex_locked_query" as action;
35+SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
36+SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
37+SELECT "try_lock_mutex_query" as action;
38+SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
39+SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='SELECT "try_lock_mutex_query" as action';
40+state
41+Waiting on query cache mutex
42+SET DEBUG_SYNC='now SIGNAL unlock_mutex';
43+action
44+mutex_locked_query
45+action
46+try_lock_mutex_query
47+SET GLOBAL query_cache_size=0;
48
49=== modified file 'Percona-Server/mysql-test/t/percona_status_wait_query_cache_mutex.test'
50--- Percona-Server/mysql-test/t/percona_status_wait_query_cache_mutex.test 2011-11-24 02:01:05 +0000
51+++ Percona-Server/mysql-test/t/percona_status_wait_query_cache_mutex.test 2011-12-02 17:54:27 +0000
52@@ -1,37 +1,35 @@
53 --source include/have_query_cache.inc
54 --source include/have_debug.inc
55-set GLOBAL query_cache_size=1355776;
56+--source include/have_debug_sync.inc
57+SET GLOBAL query_cache_size=1355776;
58 --source include/percona_query_cache_with_comments_clear.inc
59-
60--- disable_warnings
61-DROP TABLE IF EXISTS t;
62--- enable_warnings
63-CREATE TABLE t(id INT, number INT);
64-INSERT INTO t VALUES (0,1);
65-INSERT INTO t VALUES (1,2);
66-INSERT INTO t VALUES (2,3);
67-SELECT number from t where id > 0;
68---connect (conn0,localhost,root,,)
69---connect (conn1,localhost,root,,)
70---connect (conn2,localhost,root,,)
71-
72---connection conn0
73---error 0, ER_UNKNOWN_SYSTEM_VARIABLE
74-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
75-SEND SELECT number from t where id > 0;
76-SLEEP 1.0;
77-
78---connection conn1
79---error 0, ER_UNKNOWN_SYSTEM_VARIABLE
80-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
81-SEND SELECT number from t where id > 0;
82-SLEEP 1.0;
83-
84---connection conn2
85---error 0, ER_UNKNOWN_SYSTEM_VARIABLE
86-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
87---replace_column 1 Id 6 Time
88-SHOW PROCESSLIST;
89-
90-DROP TABLE t;
91-set GLOBAL query_cache_size=0;
92+--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action
93+
94+--connect (mutex_locked_conn, localhost, root,,)
95+--connect (try_mutex_lock_conn, localhost, root,,)
96+
97+--connection mutex_locked_conn
98+SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
99+send SELECT "mutex_locked_query" as action;
100+
101+--connection default
102+SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
103+
104+--connection try_mutex_lock_conn
105+SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
106+send_eval $try_lock_mutex_query;
107+
108+--connection default
109+SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
110+eval SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='$try_lock_mutex_query';
111+SET DEBUG_SYNC='now SIGNAL unlock_mutex';
112+
113+--connection mutex_locked_conn
114+reap;
115+--connection try_mutex_lock_conn
116+reap;
117+
118+--connection default
119+--disconnect mutex_locked_conn
120+--disconnect try_mutex_lock_conn
121+SET GLOBAL query_cache_size=0;
122
123=== modified file 'Percona-Server/sql/sql_cache.cc'
124--- Percona-Server/sql/sql_cache.cc 2011-11-24 16:33:30 +0000
125+++ Percona-Server/sql/sql_cache.cc 2011-12-02 17:54:27 +0000
126@@ -329,6 +329,7 @@
127 (This could be done with almost no speed penalty)
128 */
129
130+#include "debug_sync.h"
131 #include "mysql_priv.h"
132 #ifdef HAVE_QUERY_CACHE
133 #include <m_ctype.h>
134@@ -616,10 +617,10 @@
135 THD *thd = current_thd;
136 const char* old_proc_info= thd->proc_info;
137 thd_proc_info(thd,"Waiting on query cache mutex");
138+ DEBUG_SYNC(thd, "before_query_cache_mutex");
139 pthread_mutex_lock(&structure_guard_mutex);
140- DBUG_EXECUTE_IF("status_wait_query_cache_mutex_sleep", {
141- sleep(5);
142- });
143+ DEBUG_SYNC(thd, "after_query_cache_mutex");
144+ thd->proc_info = old_proc_info;
145 while (1)
146 {
147 if (m_cache_lock_status == Query_cache::UNLOCKED)
148@@ -667,7 +668,6 @@
149 }
150 }
151 pthread_mutex_unlock(&structure_guard_mutex);
152- thd->proc_info = old_proc_info;
153
154 DBUG_RETURN(interrupt);
155 }

Subscribers

People subscribed via source and target branches