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

Proposed by Oleg Tsarev
Status: Superseded
Proposed branch: lp:~tsarev/percona-server/5.5_fix_bug_878709
Merge into: lp:percona-server/5.5
Diff against target: 194 lines (+61/-62)
1 file modified
patches/query_cache_enhance.patch (+61/-62)
To merge this branch: bzr merge lp:~tsarev/percona-server/5.5_fix_bug_878709
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Fixing
Review via email: mp+82362@code.launchpad.net

This proposal has been superseded by a proposal from 2011-11-22.

Description of the change

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.

Clean Jenkins results: http://jenkins.percona.com/view/Percona%20Server%205.5/job/percona-server-5.5-param/188/

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

What is the original purpose of percona_status_wait_query_cache_mutex test? I.e. what functionality or regression etc. is tested there?

The code part looks OK - IF the test part is OK.

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

I'm testing the functionality (status "Waiting on query cache mutex" should be available)

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

1) Please remove the variable mutex_locked and just issue the SELECT directly.
2) There is an MTR var named try_lock_mutex and and DEBUG_SYNC signal name named try_lock_mutex. Please rename one of them/both to make it clearer.
3) If the last statement SET DEBUG_SYNC='reset' is redundant, please remove it.

Thanks!

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/query_cache_enhance.patch'
2--- patches/query_cache_enhance.patch 2011-10-07 06:54:28 +0000
3+++ patches/query_cache_enhance.patch 2011-11-22 13:46:26 +0000
4@@ -267,22 +267,20 @@
5 #ifdef EMBEDDED_LIBRARY
6 #include "emb_qcache.h"
7 #endif
8-@@ -454,7 +629,14 @@
9+@@ -454,7 +629,12 @@
10 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
11 DBUG_ENTER("Query_cache::try_lock");
12
13 + const char* old_proc_info= thd->proc_info;
14 + thd_proc_info(thd,"Waiting on query cache mutex");
15++ DEBUG_SYNC(thd, "before_query_cache_mutex");
16 mysql_mutex_lock(&structure_guard_mutex);
17-+ DEBUG_SYNC(thd, "status_waiting_on_query_cache_mutex");
18-+ DBUG_EXECUTE_IF("status_waiting_on_query_cache_mutex_sleep", {
19-+ sleep(1);
20-+ });
21++ DEBUG_SYNC(thd, "after_query_cache_mutex");
22 + thd->proc_info = old_proc_info;
23 while (1)
24 {
25 if (m_cache_lock_status == Query_cache::UNLOCKED)
26-@@ -1274,6 +1456,8 @@
27+@@ -1274,6 +1454,8 @@
28 unlock();
29 DBUG_VOID_RETURN;
30 }
31@@ -291,7 +289,7 @@
32
33 /* Key is query + database + flag */
34 if (thd->db_length)
35-@@ -1451,6 +1635,9 @@
36+@@ -1451,6 +1633,9 @@
37 Query_cache_block_table *block_table, *block_table_end;
38 ulong tot_length;
39 Query_cache_query_flags flags;
40@@ -301,7 +299,7 @@
41 DBUG_ENTER("Query_cache::send_result_to_client");
42
43 /*
44-@@ -1472,21 +1659,103 @@
45+@@ -1472,21 +1657,103 @@
46
47 {
48 uint i= 0;
49@@ -418,7 +416,7 @@
50 if ((my_toupper(system_charset_info, sql[i]) != 'S' ||
51 my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
52 my_toupper(system_charset_info, sql[i + 2]) != 'L') &&
53-@@ -1521,6 +1790,12 @@
54+@@ -1521,6 +1788,12 @@
55 goto err_unlock;
56
57 Query_cache_block *query_block;
58@@ -431,7 +429,7 @@
59
60 tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
61 if (thd->db_length)
62-@@ -1587,6 +1862,8 @@
63+@@ -1587,6 +1860,8 @@
64 (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
65 query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql,
66 tot_length);
67@@ -2785,32 +2783,6 @@
68 +SET GLOBAL query_cache_size= default;
69 +set global query_cache_strip_comments=OFF;
70 --- /dev/null
71-+++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
72-@@ -0,0 +1,23 @@
73-+SET GLOBAL query_cache_size=1355776;
74-+flush query cache;
75-+flush query cache;
76-+reset query cache;
77-+flush status;
78-+DROP TABLE IF EXISTS t;
79-+CREATE TABLE t(id INT, number INT);
80-+INSERT INTO t VALUES (0,1);
81-+INSERT INTO t VALUES (1,2);
82-+INSERT INTO t VALUES (2,3);
83-+SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
84-+SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
85-+SELECT number from t where id > 0;
86-+SHOW PROCESSLIST;
87-+Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
88-+### root ### test Query ### NULL SHOW PROCESSLIST ### ### ###
89-+### root ### test Query ### Waiting on query cache mutex SELECT number from t where id > 0 ### ### ###
90-+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
91-+id info state
92-+### SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id executing
93-+### SELECT number from t where id > 0 Waiting on query cache mutex
94-+DROP TABLE t;
95-+SET GLOBAL query_cache_size=0;
96---- /dev/null
97 +++ b/mysql-test/t/percona_query_cache_with_comments.test
98 @@ -0,0 +1,5 @@
99 +--disable_ps_protocol
100@@ -3062,37 +3034,41 @@
101 +set global query_cache_strip_comments=OFF;
102 --- /dev/null
103 +++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
104-@@ -0,0 +1,31 @@
105+@@ -0,0 +1,35 @@
106 +--source include/have_query_cache.inc
107 +--source include/have_debug.inc
108 +--source include/have_debug_sync.inc
109 +SET GLOBAL query_cache_size=1355776;
110 +--source include/percona_query_cache_with_comments_clear.inc
111-+
112-+-- disable_warnings
113-+DROP TABLE IF EXISTS t;
114-+-- enable_warnings
115-+CREATE TABLE t(id INT, number INT);
116-+INSERT INTO t VALUES (0,1);
117-+INSERT INTO t VALUES (1,2);
118-+INSERT INTO t VALUES (2,3);
119-+
120-+--connect (conn,localhost,root,,)
121-+
122-+--connection conn
123-+SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
124-+SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
125-+SEND SELECT number from t where id > 0;
126-+
127-+--connection default
128-+--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###
129-+SHOW PROCESSLIST;
130-+
131-+--replace_column 1 ###
132-+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
133-+
134-+--disconnect conn
135-+DROP TABLE t;
136++--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action
137++
138++--connect (mutex_locked_conn, localhost, root,,)
139++--connect (try_mutex_lock_conn, localhost, root,,)
140++
141++--connection mutex_locked_conn
142++SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
143++send SELECT "mutex_locked_query" as action;
144++
145++--connection default
146++SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
147++
148++--connection try_mutex_lock_conn
149++SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
150++send_eval $try_lock_mutex_query;
151++
152++--connection default
153++SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
154++eval SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='$try_lock_mutex_query';
155++SET DEBUG_SYNC='now SIGNAL unlock_mutex';
156++
157++--connection mutex_locked_conn
158++reap;
159++--connection try_mutex_lock_conn
160++reap;
161++
162++--connection default
163++--disconnect mutex_locked_conn
164++--disconnect try_mutex_lock_conn
165 +SET GLOBAL query_cache_size=0;
166 --- a/mysql-test/r/mysqld--help-notwin.result
167 +++ b/mysql-test/r/mysqld--help-notwin.result
168@@ -3115,3 +3091,26 @@
169 query-cache-type ON
170 query-cache-wlock-invalidate FALSE
171 query-prealloc-size 8192
172+--- /dev/null
173++++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
174+@@ -0,0 +1,20 @@
175++SET GLOBAL query_cache_size=1355776;
176++flush query cache;
177++flush query cache;
178++reset query cache;
179++flush status;
180++SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
181++SELECT "mutex_locked_query" as action;
182++SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
183++SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
184++SELECT "try_lock_mutex_query" as action;
185++SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
186++SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='SELECT "try_lock_mutex_query" as action';
187++state
188++Waiting on query cache mutex
189++SET DEBUG_SYNC='now SIGNAL unlock_mutex';
190++action
191++mutex_locked_query
192++action
193++try_lock_mutex_query
194++SET GLOBAL query_cache_size=0;

Subscribers

People subscribed via source and target branches