List:Commits« Previous MessageNext Message »
From:kroki Date:April 12 2006 3:38pm
Subject:bk commit into 5.0 tree (kroki:1.2135) BUG#15933
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tomash. When tomash does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2135 06/04/12 17:37:57 kroki@stripped +2 -0
  In test for bug#15933 we have to wait for all disconnects to finish to avoid
  a race between updating and checking Max_used_connections.  This is done in
  a loop until either disconnect finished or timeout expired.  In a latter case
  the test will fail.

  mysql-test/t/status.test
    1.15 06/04/12 17:37:51 kroki@stripped +51 -14
    Close extra conections in previous test.
    In test for bug#15933 we have to wait for all disconnects to finish to avoid
    a race between updating and checking Max_used_connections.  This is done in
    a loop until either disconnect finished or timeout expired.  In a latter case
    the test will fail.
    Use con1, con2, con3 instead of con3, con4, con5.

  mysql-test/r/status.result
    1.10 06/04/12 17:37:50 kroki@stripped +5 -5
    Update result to match changes in test case.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	kroki
# Host:	moonlight.intranet
# Root:	/home/tomash/src/mysql_ab/mysql-5.0-bug15933

--- 1.9/mysql-test/r/status.result	2006-04-07 15:30:31 +04:00
+++ 1.10/mysql-test/r/status.result	2006-04-12 17:37:50 +04:00
@@ -26,20 +26,20 @@
 FLUSH STATUS;
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
-Max_used_connections	3
+Max_used_connections	1
 SET @save_thread_cache_size=@@thread_cache_size;
 SET GLOBAL thread_cache_size=3;
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
-Max_used_connections	5
+Max_used_connections	3
 FLUSH STATUS;
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
-Max_used_connections	4
+Max_used_connections	2
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
-Max_used_connections	5
+Max_used_connections	3
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
-Max_used_connections	6
+Max_used_connections	4
 SET GLOBAL thread_cache_size=@save_thread_cache_size;

--- 1.14/mysql-test/t/status.test	2006-04-07 15:30:32 +04:00
+++ 1.15/mysql-test/t/status.test	2006-04-12 17:37:51 +04:00
@@ -36,6 +36,10 @@
 show status like 'Table_lock%';
 drop table t1;
 
+disconnect con2;
+disconnect con1;
+connection default;
+
 # End of 4.1 tests
 
 #
@@ -60,48 +64,81 @@
 #   taking a thread from the cache as well as when creating new threads
 #
 
-# Previous test uses con1, con2.  If we disconnect them, there will be
-# a race on when exactly this will happen, so we better leave them as
-# is.
-connection default;
+# Wait for at most $disconnect_timeout seconds for disconnects to finish.
+let $disconnect_timeout = 10;
 
-# Reset max_used_connections from previous tests.
+# Wait for any previous disconnects to finish.
 FLUSH STATUS;
+--disable_query_log
+--disable_result_log
+eval SET @wait_left = $disconnect_timeout;
+let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
+eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
+let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`;
+while ($wait_more)
+{
+  sleep 1;
+  FLUSH STATUS;
+  SET @wait_left = @wait_left - 1;
+  let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
+  eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
+  let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`;
+}
+--enable_query_log
+--enable_result_log
+
+# Prerequisite.
 SHOW STATUS LIKE 'max_used_connections';
 
 # Save original setting.
 SET @save_thread_cache_size=@@thread_cache_size;
 SET GLOBAL thread_cache_size=3;
 
-connect (con3,localhost,root,,);
-connect (con4,localhost,root,,);
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
 
-connection con3;
-disconnect con4;
+connection con1;
+disconnect con2;
 
 # Check that max_used_connections still reflects maximum value.
 SHOW STATUS LIKE 'max_used_connections';
 
 # Check that after flush max_used_connections equals to current number
-# of connections.
+# of connections.  First wait for previous disconnect to finish.
 FLUSH STATUS;
+--disable_query_log
+--disable_result_log
+eval SET @wait_left = $disconnect_timeout;
+let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
+eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
+let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`;
+while ($wait_more)
+{
+  sleep 1;
+  FLUSH STATUS;
+  SET @wait_left = @wait_left - 1;
+  let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
+  eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
+  let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`;
+}
+--enable_query_log
+--enable_result_log
+# Check that we don't count disconnected thread any longer.
 SHOW STATUS LIKE 'max_used_connections';
 
 # Check that max_used_connections is updated when cached thread is
 # reused...
-connect (con4,localhost,root,,);
+connect (con2,localhost,root,,);
 SHOW STATUS LIKE 'max_used_connections';
 
 # ...and when new thread is created.
-connect (con5,localhost,root,,);
+connect (con3,localhost,root,,);
 SHOW STATUS LIKE 'max_used_connections';
 
 # Restore original setting.
 connection default;
 SET GLOBAL thread_cache_size=@save_thread_cache_size;
 
-disconnect con5;
-disconnect con4;
 disconnect con3;
 disconnect con2;
 disconnect con1;
Thread
bk commit into 5.0 tree (kroki:1.2135) BUG#15933kroki12 Apr