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
1=== modified file 'mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.result'
2--- mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.result 2011-03-14 13:24:08 +0000
3+++ mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.result 2011-08-03 16:25:35 +0000
4@@ -1,4 +1,4 @@
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@@ -8,20 +8,16 @@
11 INSERT INTO t VALUES (0,1);
12 INSERT INTO t VALUES (1,2);
13 INSERT INTO t VALUES (2,3);
14-SELECT number from t where id > 0;
15-number
16-2
17-3
18-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
19-SELECT number from t where id > 0;
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+SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
24+SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
25+SELECT number from t where id > 0;
26 SHOW PROCESSLIST;
27 Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
28-Id root localhost test Sleep Time NULL Rows_sent Rows_examined Rows_read
29-Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0 Rows_sent Rows_examined Rows_read
30-Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0 Rows_sent Rows_examined Rows_read
31-Id root localhost test Query Time NULL SHOW PROCESSLIST Rows_sent Rows_examined Rows_read
32+### root ### test Query ### NULL SHOW PROCESSLIST ### ### ###
33+### root ### test Query ### Waiting on query cache mutex SELECT number from t where id > 0 ### ### ###
34+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
35+id info state
36+### SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id executing
37+### SELECT number from t where id > 0 Waiting on query cache mutex
38 DROP TABLE t;
39-set GLOBAL query_cache_size=0;
40+SET GLOBAL query_cache_size=0;
41
42=== modified file 'mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test'
43--- mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test 2011-03-14 13:24:08 +0000
44+++ mysql-test/query_cache_enhance.patch/percona_status_wait_query_cache_mutex.test 2011-08-03 16:25:35 +0000
45@@ -1,6 +1,7 @@
46 --source include/have_query_cache.inc
47 --source include/have_debug.inc
48-set GLOBAL query_cache_size=1355776;
49+--source include/have_debug_sync.inc
50+SET GLOBAL query_cache_size=1355776;
51 --source include/percona_query_cache_with_comments_clear.inc
52
53 -- disable_warnings
54@@ -10,28 +11,21 @@
55 INSERT INTO t VALUES (0,1);
56 INSERT INTO t VALUES (1,2);
57 INSERT INTO t VALUES (2,3);
58-SELECT number from t where id > 0;
59---connect (conn0,localhost,root,,)
60---connect (conn1,localhost,root,,)
61---connect (conn2,localhost,root,,)
62-
63---connection conn0
64---error 0, ER_UNKNOWN_SYSTEM_VARIABLE
65-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
66-SEND SELECT number from t where id > 0;
67-SLEEP 1.0;
68-
69---connection conn1
70---error 0, ER_UNKNOWN_SYSTEM_VARIABLE
71-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
72-SEND SELECT number from t where id > 0;
73-SLEEP 1.0;
74-
75---connection conn2
76---error 0, ER_UNKNOWN_SYSTEM_VARIABLE
77-SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
78---replace_column 1 Id 6 Time 9 Rows_sent 10 Rows_examined 11 Rows_read
79+
80+--connect (conn,localhost,root,,)
81+
82+--connection conn
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+SEND SELECT number from t where id > 0;
86+
87+--connection default
88+--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###
89 SHOW PROCESSLIST;
90
91+--replace_column 1 ###
92+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
93+
94+--disconnect conn
95 DROP TABLE t;
96-set GLOBAL query_cache_size=0;
97+SET GLOBAL query_cache_size=0;
98
99=== modified file 'query_cache_enhance.patch'
100--- query_cache_enhance.patch 2011-06-16 01:19:11 +0000
101+++ query_cache_enhance.patch 2011-08-03 16:25:35 +0000
102@@ -272,27 +272,21 @@
103 #ifdef EMBEDDED_LIBRARY
104 #include "emb_qcache.h"
105 #endif
106-@@ -454,7 +629,12 @@
107+@@ -454,7 +629,14 @@
108 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
109 DBUG_ENTER("Query_cache::try_lock");
110
111 + const char* old_proc_info= thd->proc_info;
112 + thd_proc_info(thd,"Waiting on query cache mutex");
113 mysql_mutex_lock(&structure_guard_mutex);
114-+ DBUG_EXECUTE_IF("status_wait_query_cache_mutex_sleep", {
115-+ sleep(5);
116++ DEBUG_SYNC(thd, "status_waiting_on_query_cache_mutex");
117++ DBUG_EXECUTE_IF("status_waiting_on_query_cache_mutex_sleep", {
118++ sleep(1);
119 + });
120++ thd->proc_info = old_proc_info;
121 while (1)
122 {
123 if (m_cache_lock_status == Query_cache::UNLOCKED)
124-@@ -501,6 +681,7 @@
125- }
126- }
127- mysql_mutex_unlock(&structure_guard_mutex);
128-+ thd->proc_info = old_proc_info;
129-
130- DBUG_RETURN(interrupt);
131- }
132 @@ -1274,6 +1455,8 @@
133 unlock();
134 DBUG_VOID_RETURN;

Subscribers

People subscribed via source and target branches