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
=== modified file 'patches/query_cache_enhance.patch'
--- patches/query_cache_enhance.patch 2011-10-07 06:54:28 +0000
+++ patches/query_cache_enhance.patch 2011-11-22 13:46:26 +0000
@@ -267,22 +267,20 @@
267 #ifdef EMBEDDED_LIBRARY267 #ifdef EMBEDDED_LIBRARY
268 #include "emb_qcache.h"268 #include "emb_qcache.h"
269 #endif269 #endif
270@@ -454,7 +629,14 @@270@@ -454,7 +629,12 @@
271 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);271 Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
272 DBUG_ENTER("Query_cache::try_lock");272 DBUG_ENTER("Query_cache::try_lock");
273 273
274+ const char* old_proc_info= thd->proc_info;274+ const char* old_proc_info= thd->proc_info;
275+ thd_proc_info(thd,"Waiting on query cache mutex");275+ thd_proc_info(thd,"Waiting on query cache mutex");
276+ DEBUG_SYNC(thd, "before_query_cache_mutex");
276 mysql_mutex_lock(&structure_guard_mutex);277 mysql_mutex_lock(&structure_guard_mutex);
277+ DEBUG_SYNC(thd, "status_waiting_on_query_cache_mutex");278+ DEBUG_SYNC(thd, "after_query_cache_mutex");
278+ DBUG_EXECUTE_IF("status_waiting_on_query_cache_mutex_sleep", {
279+ sleep(1);
280+ });
281+ thd->proc_info = old_proc_info;279+ thd->proc_info = old_proc_info;
282 while (1)280 while (1)
283 {281 {
284 if (m_cache_lock_status == Query_cache::UNLOCKED)282 if (m_cache_lock_status == Query_cache::UNLOCKED)
285@@ -1274,6 +1456,8 @@283@@ -1274,6 +1454,8 @@
286 unlock();284 unlock();
287 DBUG_VOID_RETURN;285 DBUG_VOID_RETURN;
288 }286 }
@@ -291,7 +289,7 @@
291 289
292 /* Key is query + database + flag */290 /* Key is query + database + flag */
293 if (thd->db_length)291 if (thd->db_length)
294@@ -1451,6 +1635,9 @@292@@ -1451,6 +1633,9 @@
295 Query_cache_block_table *block_table, *block_table_end;293 Query_cache_block_table *block_table, *block_table_end;
296 ulong tot_length;294 ulong tot_length;
297 Query_cache_query_flags flags;295 Query_cache_query_flags flags;
@@ -301,7 +299,7 @@
301 DBUG_ENTER("Query_cache::send_result_to_client");299 DBUG_ENTER("Query_cache::send_result_to_client");
302 300
303 /*301 /*
304@@ -1472,21 +1659,103 @@302@@ -1472,21 +1657,103 @@
305 303
306 {304 {
307 uint i= 0;305 uint i= 0;
@@ -418,7 +416,7 @@
418 if ((my_toupper(system_charset_info, sql[i]) != 'S' ||416 if ((my_toupper(system_charset_info, sql[i]) != 'S' ||
419 my_toupper(system_charset_info, sql[i + 1]) != 'E' ||417 my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
420 my_toupper(system_charset_info, sql[i + 2]) != 'L') &&418 my_toupper(system_charset_info, sql[i + 2]) != 'L') &&
421@@ -1521,6 +1790,12 @@419@@ -1521,6 +1788,12 @@
422 goto err_unlock;420 goto err_unlock;
423 421
424 Query_cache_block *query_block;422 Query_cache_block *query_block;
@@ -431,7 +429,7 @@
431 429
432 tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;430 tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
433 if (thd->db_length)431 if (thd->db_length)
434@@ -1587,6 +1862,8 @@432@@ -1587,6 +1860,8 @@
435 (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);433 (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
436 query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql,434 query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql,
437 tot_length);435 tot_length);
@@ -2785,32 +2783,6 @@
2785+SET GLOBAL query_cache_size= default;2783+SET GLOBAL query_cache_size= default;
2786+set global query_cache_strip_comments=OFF;2784+set global query_cache_strip_comments=OFF;
2787--- /dev/null2785--- /dev/null
2788+++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
2789@@ -0,0 +1,23 @@
2790+SET GLOBAL query_cache_size=1355776;
2791+flush query cache;
2792+flush query cache;
2793+reset query cache;
2794+flush status;
2795+DROP TABLE IF EXISTS t;
2796+CREATE TABLE t(id INT, number INT);
2797+INSERT INTO t VALUES (0,1);
2798+INSERT INTO t VALUES (1,2);
2799+INSERT INTO t VALUES (2,3);
2800+SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
2801+SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
2802+SELECT number from t where id > 0;
2803+SHOW PROCESSLIST;
2804+Id User Host db Command Time State Info Rows_sent Rows_examined Rows_read
2805+### root ### test Query ### NULL SHOW PROCESSLIST ### ### ###
2806+### root ### test Query ### Waiting on query cache mutex SELECT number from t where id > 0 ### ### ###
2807+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
2808+id info state
2809+### SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id executing
2810+### SELECT number from t where id > 0 Waiting on query cache mutex
2811+DROP TABLE t;
2812+SET GLOBAL query_cache_size=0;
2813--- /dev/null
2814+++ b/mysql-test/t/percona_query_cache_with_comments.test2786+++ b/mysql-test/t/percona_query_cache_with_comments.test
2815@@ -0,0 +1,5 @@2787@@ -0,0 +1,5 @@
2816+--disable_ps_protocol2788+--disable_ps_protocol
@@ -3062,37 +3034,41 @@
3062+set global query_cache_strip_comments=OFF;3034+set global query_cache_strip_comments=OFF;
3063--- /dev/null3035--- /dev/null
3064+++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test3036+++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
3065@@ -0,0 +1,31 @@3037@@ -0,0 +1,35 @@
3066+--source include/have_query_cache.inc3038+--source include/have_query_cache.inc
3067+--source include/have_debug.inc3039+--source include/have_debug.inc
3068+--source include/have_debug_sync.inc3040+--source include/have_debug_sync.inc
3069+SET GLOBAL query_cache_size=1355776;3041+SET GLOBAL query_cache_size=1355776;
3070+--source include/percona_query_cache_with_comments_clear.inc3042+--source include/percona_query_cache_with_comments_clear.inc
3071+3043+--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action
3072+-- disable_warnings3044+
3073+DROP TABLE IF EXISTS t;3045+--connect (mutex_locked_conn, localhost, root,,)
3074+-- enable_warnings3046+--connect (try_mutex_lock_conn, localhost, root,,)
3075+CREATE TABLE t(id INT, number INT);3047+
3076+INSERT INTO t VALUES (0,1);3048+--connection mutex_locked_conn
3077+INSERT INTO t VALUES (1,2);3049+SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
3078+INSERT INTO t VALUES (2,3);3050+send SELECT "mutex_locked_query" as action;
3079+3051+
3080+--connect (conn,localhost,root,,)3052+--connection default
3081+3053+SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
3082+--connection conn3054+
3083+SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";3055+--connection try_mutex_lock_conn
3084+SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';3056+SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
3085+SEND SELECT number from t where id > 0;3057+send_eval $try_lock_mutex_query;
3086+3058+
3087+--connection default3059+--connection default
3088+--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###3060+SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
3089+SHOW PROCESSLIST;3061+eval SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='$try_lock_mutex_query';
3090+3062+SET DEBUG_SYNC='now SIGNAL unlock_mutex';
3091+--replace_column 1 ###3063+
3092+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;3064+--connection mutex_locked_conn
3093+3065+reap;
3094+--disconnect conn3066+--connection try_mutex_lock_conn
3095+DROP TABLE t;3067+reap;
3068+
3069+--connection default
3070+--disconnect mutex_locked_conn
3071+--disconnect try_mutex_lock_conn
3096+SET GLOBAL query_cache_size=0;3072+SET GLOBAL query_cache_size=0;
3097--- a/mysql-test/r/mysqld--help-notwin.result3073--- a/mysql-test/r/mysqld--help-notwin.result
3098+++ b/mysql-test/r/mysqld--help-notwin.result3074+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -3115,3 +3091,26 @@
3115 query-cache-type ON3091 query-cache-type ON
3116 query-cache-wlock-invalidate FALSE3092 query-cache-wlock-invalidate FALSE
3117 query-prealloc-size 81923093 query-prealloc-size 8192
3094--- /dev/null
3095+++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
3096@@ -0,0 +1,20 @@
3097+SET GLOBAL query_cache_size=1355776;
3098+flush query cache;
3099+flush query cache;
3100+reset query cache;
3101+flush status;
3102+SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
3103+SELECT "mutex_locked_query" as action;
3104+SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
3105+SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
3106+SELECT "try_lock_mutex_query" as action;
3107+SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
3108+SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='SELECT "try_lock_mutex_query" as action';
3109+state
3110+Waiting on query cache mutex
3111+SET DEBUG_SYNC='now SIGNAL unlock_mutex';
3112+action
3113+mutex_locked_query
3114+action
3115+try_lock_mutex_query
3116+SET GLOBAL query_cache_size=0;

Subscribers

People subscribed via source and target branches