]> git.pld-linux.org Git - packages/percona-server.git/blobdiff - query_cache_enhance.patch
- rel 2; update percona patches
[packages/percona-server.git] / query_cache_enhance.patch
index e8680d94c0c571d13bf16ed921cf046717d40fbe..211d4ebdec5da946757d4e742eafc0d2b5f99b2f 100644 (file)
  #ifdef EMBEDDED_LIBRARY
  #include "emb_qcache.h"
  #endif
-@@ -454,7 +629,14 @@
+@@ -454,7 +629,12 @@
    Query_cache_wait_state wait_state(thd, __func__, __FILE__, __LINE__);
    DBUG_ENTER("Query_cache::try_lock");
  
 +  const char* old_proc_info= thd->proc_info;
 +  thd_proc_info(thd,"Waiting on query cache mutex");
++  DEBUG_SYNC(thd, "before_query_cache_mutex");
    mysql_mutex_lock(&structure_guard_mutex);
-+  DEBUG_SYNC(thd, "status_waiting_on_query_cache_mutex");
-+  DBUG_EXECUTE_IF("status_waiting_on_query_cache_mutex_sleep", {
-+      sleep(1);
-+    });
++  DEBUG_SYNC(thd, "after_query_cache_mutex");
 +  thd->proc_info = old_proc_info;
    while (1)
    {
      if (m_cache_lock_status == Query_cache::UNLOCKED)
-@@ -1274,6 +1456,8 @@
+@@ -1274,6 +1454,8 @@
        unlock();
        DBUG_VOID_RETURN;
      }
  
      /* Key is query + database + flag */
      if (thd->db_length)
-@@ -1451,6 +1635,9 @@
+@@ -1451,6 +1633,9 @@
    Query_cache_block_table *block_table, *block_table_end;
    ulong tot_length;
    Query_cache_query_flags flags;
    DBUG_ENTER("Query_cache::send_result_to_client");
  
    /*
-@@ -1472,21 +1659,103 @@
+@@ -1472,21 +1657,103 @@
  
    {
      uint i= 0;
      if ((my_toupper(system_charset_info, sql[i])     != 'S' ||
           my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
           my_toupper(system_charset_info, sql[i + 2]) != 'L') &&
-@@ -1521,6 +1790,12 @@
+@@ -1521,6 +1788,12 @@
      goto err_unlock;
  
    Query_cache_block *query_block;
  
    tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
    if (thd->db_length)
-@@ -1587,6 +1862,8 @@
+@@ -1587,6 +1860,8 @@
         (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE);
    query_block = (Query_cache_block *)  my_hash_search(&queries, (uchar*) sql,
                                                        tot_length);
 +SET GLOBAL query_cache_size= default;
 +set global query_cache_strip_comments=OFF;
 --- /dev/null
-+++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
-@@ -0,0 +1,23 @@
-+SET GLOBAL query_cache_size=1355776;
-+flush query cache;
-+flush query cache;
-+reset query cache;
-+flush status;
-+DROP TABLE IF EXISTS t;
-+CREATE TABLE t(id INT, number INT);
-+INSERT INTO t VALUES (0,1);
-+INSERT INTO t VALUES (1,2);
-+INSERT INTO t VALUES (2,3);
-+SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
-+SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
-+SELECT number from t where id > 0;
-+SHOW PROCESSLIST;
-+Id    User    Host    db      Command Time    State   Info    Rows_sent       Rows_examined   Rows_read
-+###   root    ###     test    Query   ###     NULL    SHOW PROCESSLIST        ###     ###     ###
-+###   root    ###     test    Query   ###     Waiting on query cache mutex    SELECT number from t where id > 0       ###     ###     ###
-+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
-+id    info    state
-+###   SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id  executing
-+###   SELECT number from t where id > 0       Waiting on query cache mutex
-+DROP TABLE t;
-+SET GLOBAL query_cache_size=0;
---- /dev/null
 +++ b/mysql-test/t/percona_query_cache_with_comments.test
 @@ -0,0 +1,5 @@
 +--disable_ps_protocol
 +set global query_cache_strip_comments=OFF;
 --- /dev/null
 +++ b/mysql-test/t/percona_status_wait_query_cache_mutex.test
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,35 @@
 +--source include/have_query_cache.inc
 +--source include/have_debug.inc
 +--source include/have_debug_sync.inc
 +SET GLOBAL query_cache_size=1355776;
 +--source include/percona_query_cache_with_comments_clear.inc
++--let try_lock_mutex_query=SELECT "try_lock_mutex_query" as action
 +
-+-- disable_warnings
-+DROP TABLE IF EXISTS t;
-+-- enable_warnings
-+CREATE TABLE t(id INT, number INT);
-+INSERT INTO t VALUES (0,1);
-+INSERT INTO t VALUES (1,2);
-+INSERT INTO t VALUES (2,3);
++--connect (mutex_locked_conn, localhost, root,,)
++--connect (try_mutex_lock_conn, localhost, root,,)
 +
-+--connect (conn,localhost,root,,)
++--connection mutex_locked_conn
++SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
++send SELECT "mutex_locked_query" as action;
++
++--connection default
++SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
 +
-+--connection conn
-+SET SESSION debug="+d,status_waiting_on_query_cache_mutex_sleep";
-+SET DEBUG_SYNC='status_waiting_on_query_cache_mutex SIGNAL thread_ready';
-+SEND SELECT number from t where id > 0;
++--connection try_mutex_lock_conn
++SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
++send_eval $try_lock_mutex_query;
 +
 +--connection default
-+--replace_column 1 ### 3 ### 6 ### 9 ### 10 ### 11 ###
-+SHOW PROCESSLIST;
++SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
++eval SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='$try_lock_mutex_query';
++SET DEBUG_SYNC='now SIGNAL unlock_mutex';
 +
-+--replace_column 1 ###
-+SELECT id, info, state FROM INFORMATION_SCHEMA.PROCESSLIST ORDER BY id;
++--connection mutex_locked_conn
++reap;
++--connection try_mutex_lock_conn
++reap;
 +
-+--disconnect conn
-+DROP TABLE t;
++--connection default
++--disconnect mutex_locked_conn
++--disconnect try_mutex_lock_conn
 +SET GLOBAL query_cache_size=0;
 --- a/mysql-test/r/mysqld--help-notwin.result
 +++ b/mysql-test/r/mysqld--help-notwin.result
  query-cache-type ON
  query-cache-wlock-invalidate FALSE
  query-prealloc-size 8192
+--- /dev/null
++++ b/mysql-test/r/percona_status_wait_query_cache_mutex.result
+@@ -0,0 +1,20 @@
++SET GLOBAL query_cache_size=1355776;
++flush query cache;
++flush query cache;
++reset query cache;
++flush status;
++SET DEBUG_SYNC='after_query_cache_mutex SIGNAL mutex_locked WAIT_FOR unlock_mutex';
++SELECT "mutex_locked_query" as action;
++SET DEBUG_SYNC='now WAIT_FOR mutex_locked';
++SET DEBUG_SYNC='before_query_cache_mutex SIGNAL try_lock_mutex';
++SELECT "try_lock_mutex_query" as action;
++SET DEBUG_SYNC='now WAIT_FOR try_lock_mutex';
++SELECT SQL_NO_CACHE state FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info='SELECT "try_lock_mutex_query" as action';
++state
++Waiting on query cache mutex
++SET DEBUG_SYNC='now SIGNAL unlock_mutex';
++action
++mutex_locked_query
++action
++try_lock_mutex_query
++SET GLOBAL query_cache_size=0;
This page took 0.042522 seconds and 4 git commands to generate.