MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:October 8 2010 12:21pm
Subject:bzr push into mysql-trunk-merge branch (davi:3250 to 3251)
View as plain text  
 3251 Davi Arnaut	2010-10-08 [merge]
      Merge of mysql-5.5-bugteam into mysql-trunk-merge.

    modified:
      mysql-test/r/query_cache_debug.result
      mysql-test/t/query_cache_debug.test
      sql/sql_cache.cc
 3250 Tor Didriksen	2010-10-08 [merge]
      Merge  57209 from 5.5-bugteam

    modified:
      mysql-test/r/func_math.result
      mysql-test/t/func_math.test
      sql/item_strfunc.cc
=== modified file 'mysql-test/r/query_cache_debug.result'
--- a/mysql-test/r/query_cache_debug.result	2010-10-07 22:51:37 +0000
+++ b/mysql-test/r/query_cache_debug.result	2010-10-08 12:16:20 +0000
@@ -123,16 +123,20 @@ SET DEBUG_SYNC="now WAIT_FOR parked1_1";
 ** On THD2: Insert a result into the cache. This attempt will be blocked
 ** because of a debug hook placed just before the mutex lock after which
 ** the first part of the result set is written.
-SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2";
+SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2 EXECUTE 1";
 SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3;
+=================================== Connection default
+** Assert that the SELECT-stmt thread reaches the sync point.
+SET DEBUG_SYNC="now WAIT_FOR parked2";
+**
+**
 =================================== Connection thd3
 ** On THD3: Insert another result into the cache and block on the same
 ** debug hook.
-SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3";
-SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;;
+SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3 EXECUTE 1";
+SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;
 =================================== Connection default
-** Assert that the two SELECT-stmt threads to reach the hook.
-SET DEBUG_SYNC="now WAIT_FOR parked2";
+** Assert that the SELECT-stmt thread reaches the sync point.
 SET DEBUG_SYNC="now WAIT_FOR parked3";
 **
 **

=== modified file 'mysql-test/t/query_cache_debug.test'
--- a/mysql-test/t/query_cache_debug.test	2010-10-07 22:51:37 +0000
+++ b/mysql-test/t/query_cache_debug.test	2010-10-08 12:16:20 +0000
@@ -170,20 +170,26 @@ connection thd2;
 --echo ** On THD2: Insert a result into the cache. This attempt will be blocked
 --echo ** because of a debug hook placed just before the mutex lock after which
 --echo ** the first part of the result set is written.
-SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2";
+SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2 EXECUTE 1";
 --send SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3
 
+connection default;
+--echo =================================== Connection default
+--echo ** Assert that the SELECT-stmt thread reaches the sync point.
+SET DEBUG_SYNC="now WAIT_FOR parked2";
+--echo **
+--echo **
+
 connection thd3;
 --echo =================================== Connection thd3
 --echo ** On THD3: Insert another result into the cache and block on the same
 --echo ** debug hook.
-SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3";
---send SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;
+SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3 EXECUTE 1";
+--send SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5
 
 connection default;
 --echo =================================== Connection default
---echo ** Assert that the two SELECT-stmt threads to reach the hook.
-SET DEBUG_SYNC="now WAIT_FOR parked2";
+--echo ** Assert that the SELECT-stmt thread reaches the sync point.
 SET DEBUG_SYNC="now WAIT_FOR parked3";
 --echo **
 --echo **

=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc	2010-10-08 00:12:56 +0000
+++ b/sql/sql_cache.cc	2010-10-08 12:20:29 +0000
@@ -385,6 +385,22 @@ TODO list:
 
 
 /**
+  Macro that executes the requested action at a synchronization point
+  only if the thread has a associated THD session.
+*/
+#if defined(ENABLED_DEBUG_SYNC)
+#define QC_DEBUG_SYNC(name)               \
+  do {                                    \
+    THD *thd= current_thd;                \
+    if (thd)                              \
+      DEBUG_SYNC(thd, name);              \
+  } while (0)
+#else
+#define QC_DEBUG_SYNC(name)
+#endif
+
+
+/**
   Thread state to be used when the query cache lock needs to be acquired.
   Sets the thread state name in the constructor, resets on destructor.
 */
@@ -879,7 +895,7 @@ Query_cache::insert(Query_cache_tls *que
   if (is_disabled() || query_cache_tls->first_query_block == NULL)
     DBUG_VOID_RETURN;
 
-  DEBUG_SYNC(current_thd, "wait_in_query_cache_insert");
+  QC_DEBUG_SYNC("wait_in_query_cache_insert");
 
   if (try_lock())
     DBUG_VOID_RETURN;
@@ -1975,7 +1991,7 @@ void Query_cache::flush()
   if (is_disabled())
     DBUG_VOID_RETURN;
 
-  DEBUG_SYNC(current_thd, "wait_in_query_cache_flush1");
+  QC_DEBUG_SYNC("wait_in_query_cache_flush1");
 
   lock_and_suspend();
   if (query_cache_size > 0)
@@ -2315,7 +2331,7 @@ void Query_cache::free_cache()
 
 void Query_cache::flush_cache()
 {
-  DEBUG_SYNC(current_thd, "wait_in_query_cache_flush2");
+  QC_DEBUG_SYNC("wait_in_query_cache_flush2");
 
   my_hash_reset(&queries);
   while (queries_blocks != 0)


Attachment: [text/bzr-bundle] bzr/davi.arnaut@oracle.com-20101008122029-a9huh3dacf24kcbr.bundle
Thread
bzr push into mysql-trunk-merge branch (davi:3250 to 3251) Davi Arnaut8 Oct