List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:March 29 2011 1:54pm
Subject:bzr commit into mysql-5.5-mtr branch (bjorn.munch:3187) Bug#11753389
View as plain text  
#At file:///home/bm136801/my/disconn-55/ based on revid:bjorn.munch@stripped

 3187 Bjorn Munch	2011-03-29
      Bug #11753389 44823: MYSQLTEST "DISCONNECT" FUNCTION RETURNS BEFORE COMPLETING THE DISCONNECT
      Re-applied Philip's original patch, adding a "KILL CONNECTION_ID()"
      Added test case to mysqltest.test but with small delay since the fix
        is not perfect.
      Test wait_timeout had to be amended (it still fails though)

    modified:
      client/mysqltest.cc
      mysql-test/r/mysqltest.result
      mysql-test/t/mysqltest.test
      mysql-test/t/wait_timeout.test
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2011-03-22 14:40:25 +0000
+++ b/client/mysqltest.cc	2011-03-29 13:49:23 +0000
@@ -1209,6 +1209,16 @@ void close_connections()
     if (next_con->stmt)
       mysql_stmt_close(next_con->stmt);
     next_con->stmt= 0;
+
+    /*
+      We issue the extra KILL in order to make sure that all connections
+      are truly gone before mysqltest exits and the next test starts.
+    */
+    if (next_con->name_len > 0) 
+    {
+      mysql_query(&next_con->mysql, "KILL CONNECTION_ID()");
+    }
+
     mysql_close(&next_con->mysql);
     if (next_con->util_mysql)
       mysql_close(next_con->util_mysql);
@@ -5039,6 +5049,12 @@ void do_close_connection(struct st_comma
     mysql_stmt_close(con->stmt);
   con->stmt= 0;
 
+  /*
+    We issue the extra KILL in order to make sure the connection is truly
+    gone and removed from SHOW PROCESSLIST by the time we continue
+    with the execution of the script
+  */
+  mysql_query(&con->mysql, "KILL CONNECTION_ID()");
   mysql_close(&con->mysql);
 
   if (con->util_mysql)

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2011-01-11 14:15:25 +0000
+++ b/mysql-test/r/mysqltest.result	2011-03-29 13:49:23 +0000
@@ -529,6 +529,9 @@ connection default;
 connection con1;
 disconnect con1;
 connection default;
+SHOW PROCESSLIST;
+Id	User	Host	db	Command	Time	State	Info
+N	root	local	test	Query	0	NULL	SHOW PROCESSLIST
 Output from mysqltest-x.inc
 Output from mysqltest-x.inc
 Output from mysqltest-x.inc

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2011-01-11 14:15:25 +0000
+++ b/mysql-test/t/mysqltest.test	2011-03-29 13:49:23 +0000
@@ -1748,6 +1748,15 @@ disconnect con1;
 connection default;
 --disable_connect_log
 
+# Test that disconnected session is gone immediately
+# Must add small delay, sometimes it's not immediate.
+connect (con1,localhost,root,,);
+disconnect con1;
+connection default;
+sleep 0.02;
+--replace_column 1 N 3 local
+SHOW PROCESSLIST;
+
 # ----------------------------------------------------------------------------
 # Test mysqltest arguments
 # ----------------------------------------------------------------------------

=== modified file 'mysql-test/t/wait_timeout.test'
--- a/mysql-test/t/wait_timeout.test	2010-10-19 11:54:28 +0000
+++ b/mysql-test/t/wait_timeout.test	2011-03-29 13:49:23 +0000
@@ -22,14 +22,13 @@ SET @@global.wait_timeout= 2;
 --echo disconnect default;
 disconnect default;
 
-# Connect with another connection and reset counters
+# Connect with another connection
 --disable_query_log
 connect (wait_con,localhost,root,,test,,);
 --echo connection wait_con;
 connection wait_con;
 SET SESSION wait_timeout=100;
 let $retries=300;
-SET @aborted_clients= 0;
 --enable_query_log
 
 # Disable reconnect and do the query
@@ -44,11 +43,12 @@ SELECT 1;
 --disable_query_log
 --echo connection wait_con;
 connection wait_con;
-while (!`select @aborted_clients`)
+let $aborted= 1;
+while ($aborted == 1)
 {
   real_sleep 0.1;
   let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
-  eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
+  let $aborted= `SELECT SUBSTRING('$aborted_clients', 16)`;
 
   dec $retries;
   if (!$retries)


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20110329134923-vrojuqjc1rsxrj52.bundle
Thread
bzr commit into mysql-5.5-mtr branch (bjorn.munch:3187) Bug#11753389Bjorn Munch29 Mar