From: Marc Alff Date: December 1 2010 10:10am Subject: bzr commit into mysql-5.5-bugteam branch (marc.alff:3158) Bug#56618 List-Archive: http://lists.mysql.com/commits/125628 X-Bug: 56618 Message-Id: <201012011010.oB11fI9h003074@acsinet15.oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2030768316919374161==" --===============2030768316919374161== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #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%"; + --===============2030768316919374161== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/marc.alff@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: marc.alff@stripped # target_branch: file:///Users/malff/BZR_TREE/mysql-5.5-bugteam-56618/ # testament_sha1: 6d1eb31f3cd49c312caa4372121819b49c83bea9 # timestamp: 2010-12-01 11:10:22 +0100 # base_revision_id: nirbhay.choubey@stripped\ # tzmx16rp33gr407v # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWf9k4NYAAvDfgAAwXnf//3ci ReC////wYAc3x52B0Bc2uuhodAAAJRJPU1PKfqNBp6U2gyaJgIGQ0aNAGEpETyaNRsjUmh6j1DQD 1BkAAaaAcwmATACYTCaYAABMmmgYSmiRqnkamQ0NqGmmgZAAAZAAcwmATACYTCaYAABMmmgYSRBN ABDSYEyIKfqn6nqekIyNGjQ3qmo7LhYWFoy3JYkqL9I2mYmF+1NXmbVytGcNQPDTwrCsyPM2mgRU jbi5um5Pq6A1iTo/lYTPMnHSVWzC8K7o10igkLUGpyPAwZmGZL/P9xVRJ7yJD5jNmQIl0i/Kk4uz M0GejZvXMlJv01DDb2DHRs2GtqHiTv8eeLGxIYgWWY6QTGiGJw8ljR+uQGSMN1Km5cacB01DhRXS oDcKL1kHuFE4bjDPKej8FIErg3NGDmwMZAskNJcK0g3+ZZCSameJ8RU6ic5Y8we24GlAMhhgYPoH hANC8HGy9w9wlvu3+RaIPQOVqOyF5n7vryrBW1cQ68bJhUBJRMeo1kjikUUS1MgYGFyDeQjExDaH EgHvgN0OtiSje7pa+oSSCADJDZDAnGAiN6moPT/ZcQVEbOpetrlRAJrMq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