Merge lp:~tsarev/percona-server/5.5-query_cache_enhance-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-query_cache_enhance-fix
Merge into: lp:percona-server/5.5
Diff against target: 134 lines (+33/-49)
3 files modified
mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.result (+11/-15)
mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test (+17/-23)
query_cache_enhance.patch (+5/-11)
To merge this branch: bzr merge lp:~tsarev/percona-server/5.5-query_cache_enhance-fix
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Stewart Smith Pending
Review via email: mp+70331@code.launchpad.net

Description of the change

Fix bug in query_cache_enhanve.patch: I added new status of thread - "Waiting on query cache mutex " incorrect - I backup old status before trying to lock mutex, but restore and after mutex lock, but after many other things.
As result - in 5.5.14 query_cache_debug fail

I also remove some SLEEP from tests, replace by debug_sync.
I can't remove all sleep, because DEBUG_SYNC change the status of thread, and I testing status.

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.result'
--- mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.result 2011-03-14 13:24:08 +0000
+++ mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.result 2011-08-03 16:25:35 +0000
@@ -1,4 +1,4 @@
1set GLOBAL query_cache_size=1355776;1SET GLOBAL query_cache_size=1355776;
2flush query cache;2flush query cache;
3flush query cache;3flush query cache;
4reset query cache;4reset query cache;
@@ -8,20 +8,16 @@
8INSERT INTO t VALUES (0,1);8INSERT INTO t VALUES (0,1);
9INSERT INTO t VALUES (1,2);9INSERT INTO t VALUES (1,2);
10INSERT INTO t VALUES (2,3);10INSERT INTO t VALUES (2,3);
11SELECT number from t where id > 0;11SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
12number12SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
13213SELECT number from t where id > 0;
143
15SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
16SELECT number from t where id > 0;
17SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
18SELECT number from t where id > 0;
19SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
20SHOW PROCESSLIST;14SHOW PROCESSLIST;
21Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read15Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
22Id root localhost test Sleep Time NULL Rows_sent Rows_examined Rows_read16### root ### test Query ### NULL SHOW PROCESSLIST ### ### ###
23Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0 Rows_sent Rows_examined Rows_read17### root ### test Query ### Waiting on query cache mutex SELECT number from t where id > 0 ### ### ###
24Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0 Rows_sent Rows_examined Rows_read18SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
25Id root localhost test Query Time NULL SHOW PROCESSLIST Rows_sent Rows_examined Rows_read19id info state
20### SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id executing
21### SELECT number from t where id > 0 Waiting on query cache mutex
26DROP TABLE t;22DROP TABLE t;
27set GLOBAL query_cache_size=0;23SET GLOBAL query_cache_size=0;
2824
=== modified file 'mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test'
--- mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test 2011-03-14 13:24:08 +0000
+++ mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test 2011-08-03 16:25:35 +0000
@@ -1,6 +1,7 @@
1--source include/have_query_cache.inc1--source include/have_query_cache.inc
2--source include/have_debug.inc2--source include/have_debug.inc
3set GLOBAL query_cache_size=1355776;3--source include/have_debug_sync.inc
4SET GLOBAL query_cache_size=1355776;
4--source include/percona_query_cache_with_comments_clear.inc5--source include/percona_query_cache_with_comments_clear.inc
56
6-- disable_warnings7-- disable_warnings
@@ -10,28 +11,21 @@
10INSERT INTO t VALUES (0,1);11INSERT INTO t VALUES (0,1);
11INSERT INTO t VALUES (1,2);12INSERT INTO t VALUES (1,2);
12INSERT INTO t VALUES (2,3);13INSERT INTO t VALUES (2,3);
13SELECT number from t where id > 0;14
14--connect (conn0,localhost,root,,)15--connect (conn,localhost,root,,)
15--connect (conn1,localhost,root,,)16
16--connect (conn2,localhost,root,,)17--connection conn
1718SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
18--connection conn019SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
19--error 0, ER_UNKNOWN_SYSTEM_VARIABLE20SEND SELECT number from t where id > 0;
20SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";21
21SEND SELECT number from t where id > 0;22--connection default
22SLEEP 1.0;23--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###
23
24--connection conn1
25--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
26SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
27SEND SELECT number from t where id > 0;
28SLEEP 1.0;
29
30--connection conn2
31--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
32SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
33--replace_column 1 Id 6 Time 9 Rows_sent 10 Rows_examined 11 Rows_read
34SHOW PROCESSLIST;24SHOW PROCESSLIST;
3525
26--replace_column 1 ###
27SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
28
29--disconnect conn
36DROP TABLE t;30DROP TABLE t;
37set GLOBAL query_cache_size=0;31SET GLOBAL query_cache_size=0;
3832
=== modified file 'query_cache_enhance.patch'
--- query_cache_enhance.patch 2011-06-16 01:19:11 +0000
+++ query_cache_enhance.patch 2011-08-03 16:25:35 +0000
@@ -272,27 +272,21 @@
272 #ifdef EMBEDDED_LIBRARY272 #ifdef EMBEDDED_LIBRARY
273 #include "emb_qcache.h"273 #include "emb_qcache.h"
274 #endif274 #endif
275@@ -454,7 +629,12 @@275@@ -454,7 +629,14 @@
276 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);276 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
277 DBUG_ENTER("Query_cache::try_lock");277 DBUG_ENTER("Query_cache::try_lock");
278 278
279+ const char* old_proc_info= thd->proc_info;279+ const char* old_proc_info= thd->proc_info;
280+ thd_proc_info(thd,"Waiting on query cache mutex");280+ thd_proc_info(thd,"Waiting on query cache mutex");
281 mysql_mutex_lock(&structure_guard_mutex);281 mysql_mutex_lock(&structure_guard_mutex);
282+ DBUG_EXECUTE_IF("status_wait_query_cache_mutex_sleep", {282+ DEBUG_SYNC(thd, "status_waiting_on_query_cache_mutex");
283+ sleep(5);283+ DBUG_EXECUTE_IF("status_waiting_on_query_cache_mutex_sleep", {
284+ sleep(1);
284+ });285+ });
286+ thd->proc_info = old_proc_info;
285 while (1)287 while (1)
286 {288 {
287 if (m_cache_lock_status == Query_cache::UNLOCKED)289 if (m_cache_lock_status == Query_cache::UNLOCKED)
288@@ -501,6 +681,7 @@
289 }
290 }
291 mysql_mutex_unlock(&structure_guard_mutex);
292+ thd->proc_info = old_proc_info;
293
294 DBUG_RETURN(interrupt);
295 }
296@@ -1274,6 +1455,8 @@290@@ -1274,6 +1455,8 @@
297 unlock();291 unlock();
298 DBUG_VOID_RETURN;292 DBUG_VOID_RETURN;

Subscribers

People subscribed via source and target branches