List:Commits« Previous MessageNext Message »
From:Marc Alff Date:December 1 2010 10:10am
Subject:bzr commit into mysql-5.5-bugteam branch (marc.alff:3158) Bug#56618
View as plain text  
#At file:///Users/malff/BZR_TREE/mysql-5.5-bugteam-56618/ based on revid:nirbhay.choubey@stripped

 3158 Marc Alff	2010-12-01
      Bug#56618 Thread_ID is not assigned in ascending sequence (after disconnect)
      
      Before this fix, the test thread_cache failed with spurious failures.
      
      The test used:
      -- disconnect X
      -- connect Y
      
      while assuming that connection Y would reuse connection X slot in the thread cache.
      
      For this to happen, the disconnect X operation must be given enough time to complete,
      otherwise connect Y can be executed in the server before X actually finishes.
      
      This fix uses wait conditions to make the test execution more controlled,
      and more reproductible.

    modified:
      mysql-test/suite/perfschema/r/thread_cache.result
      mysql-test/suite/perfschema/t/thread_cache.test
=== modified file 'mysql-test/suite/perfschema/r/thread_cache.result'
--- a/mysql-test/suite/perfschema/r/thread_cache.result	2010-07-16 13:50:50 +0000
+++ b/mysql-test/suite/perfschema/r/thread_cache.result	2010-12-01 10:10:15 +0000
@@ -1,3 +1,4 @@
+flush status;
 SET @saved_thread_cache_size = @@global.thread_cache_size;
 set global thread_cache_size = 0;
 show variables like "thread_cache_size";
@@ -32,3 +33,7 @@ select @thread_id_increment;
 @thread_id_increment
 1
 set global thread_cache_size = @saved_thread_cache_size;
+show status like "performance_schema_thread%";
+Variable_name	Value
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0

=== modified file 'mysql-test/suite/perfschema/t/thread_cache.test'
--- a/mysql-test/suite/perfschema/t/thread_cache.test	2010-11-03 15:42:33 +0000
+++ b/mysql-test/suite/perfschema/t/thread_cache.test	2010-12-01 10:10:15 +0000
@@ -20,6 +20,8 @@
 
 # Setup
 
+flush status;
+
 SET @saved_thread_cache_size = @@global.thread_cache_size;
 
 set global thread_cache_size = 0;
@@ -40,7 +42,7 @@ let $con2_ID=`select connection_id()`;
 let $con2_THREAD_ID=`select thread_id from performance_schema.threads
   where PROCESSLIST_ID = connection_id()`;
 
-connection default;
+--connection default
 
 --disable_query_log
 eval select ($con2_ID - $con1_ID) into @id_increment;
@@ -52,7 +54,15 @@ select @id_increment;
 # Expect 1, THREAD_ID is incremented for each new connection
 select @thread_id_increment;
 
-disconnect con2;
+--disconnect con2
+
+--connection default
+
+# Wait for the disconnect con2 to complete
+let $wait_condition=
+  select count(*) = 2 from performance_schema.threads
+  where name like "thread/sql/one_connection";
+--source include/wait_condition.inc
 
 connect (con3, localhost, root, , );
 
@@ -61,10 +71,16 @@ let $con3_ID=`select connection_id()`;
 let $con3_THREAD_ID=`select thread_id from performance_schema.threads
   where PROCESSLIST_ID = connection_id()`;
 
-disconnect con3;
-disconnect con1;
+--disconnect con3
+--disconnect con1
+
+--connection default
 
-connection default;
+# Wait for the disconnect con1 and con3 to complete
+let $wait_condition=
+  select count(*) = 1 from performance_schema.threads
+  where name like "thread/sql/one_connection";
+--source include/wait_condition.inc
 
 --disable_query_log
 eval select ($con3_ID - $con2_ID) into @id_increment;
@@ -92,7 +108,7 @@ let $con2_ID=`select connection_id()`;
 let $con2_THREAD_ID=`select thread_id from performance_schema.threads
   where PROCESSLIST_ID = connection_id()`;
 
-connection default;
+--connection default
 
 --disable_query_log
 eval select ($con2_ID - $con1_ID) into @id_increment;
@@ -102,7 +118,15 @@ eval select ($con2_THREAD_ID - $con1_THR
 select @id_increment;
 select @thread_id_increment;
 
-disconnect con2;
+--disconnect con2
+
+--connection default
+
+# Wait for the disconnect con2 to complete
+let $wait_condition=
+  select count(*) = 2 from performance_schema.threads
+  where name like "thread/sql/one_connection";
+--source include/wait_condition.inc
 
 connect (con3, localhost, root, , );
 
@@ -111,10 +135,16 @@ let $con3_ID=`select connection_id()`;
 let $con3_THREAD_ID=`select thread_id from performance_schema.threads
   where PROCESSLIST_ID = connection_id()`;
 
-disconnect con3;
-disconnect con1;
+--disconnect con3
+--disconnect con1
 
-connection default;
+--connection default
+
+# Wait for the disconnect con1 and con3 to complete
+let $wait_condition=
+  select count(*) = 1 from performance_schema.threads
+  where name like "thread/sql/one_connection";
+--source include/wait_condition.inc
 
 --disable_query_log
 eval select ($con3_ID - $con2_ID) into @id_increment;
@@ -132,3 +162,5 @@ select @thread_id_increment;
 
 set global thread_cache_size = @saved_thread_cache_size;
 
+show status like "performance_schema_thread%";
+


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20101201101015-twc6wvnj9ahlin1k.bundle
Thread
bzr commit into mysql-5.5-bugteam branch (marc.alff:3158) Bug#56618Marc Alff1 Dec