Commit 8881e660 authored by kroki@mysql.com's avatar kroki@mysql.com

Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0

into  mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug15933
parents 739ee02c 4a81c0df
...@@ -26,20 +26,20 @@ Last_query_cost 0.000000 ...@@ -26,20 +26,20 @@ Last_query_cost 0.000000
FLUSH STATUS; FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 3 Max_used_connections 1
SET @save_thread_cache_size=@@thread_cache_size; SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3; SET GLOBAL thread_cache_size=3;
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 5 Max_used_connections 3
FLUSH STATUS; FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 4 Max_used_connections 2
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 5 Max_used_connections 3
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
Variable_name Value Variable_name Value
Max_used_connections 6 Max_used_connections 4
SET GLOBAL thread_cache_size=@save_thread_cache_size; SET GLOBAL thread_cache_size=@save_thread_cache_size;
...@@ -36,6 +36,10 @@ reap; ...@@ -36,6 +36,10 @@ reap;
show status like 'Table_lock%'; show status like 'Table_lock%';
drop table t1; drop table t1;
disconnect con2;
disconnect con1;
connection default;
# End of 4.1 tests # End of 4.1 tests
# #
...@@ -60,48 +64,81 @@ show status like 'last_query_cost'; ...@@ -60,48 +64,81 @@ show status like 'last_query_cost';
# taking a thread from the cache as well as when creating new threads # 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 # Wait for at most $disconnect_timeout seconds for disconnects to finish.
# a race on when exactly this will happen, so we better leave them as let $disconnect_timeout = 10;
# is.
connection default;
# Reset max_used_connections from previous tests. # Wait for any previous disconnects to finish.
FLUSH STATUS; 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'; SHOW STATUS LIKE 'max_used_connections';
# Save original setting. # Save original setting.
SET @save_thread_cache_size=@@thread_cache_size; SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3; SET GLOBAL thread_cache_size=3;
connect (con3,localhost,root,,); connect (con1,localhost,root,,);
connect (con4,localhost,root,,); connect (con2,localhost,root,,);
connection con3; connection con1;
disconnect con4; disconnect con2;
# Check that max_used_connections still reflects maximum value. # Check that max_used_connections still reflects maximum value.
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
# Check that after flush max_used_connections equals to current number # Check that after flush max_used_connections equals to current number
# of connections. # of connections. First wait for previous disconnect to finish.
FLUSH STATUS; 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'; SHOW STATUS LIKE 'max_used_connections';
# Check that max_used_connections is updated when cached thread is # Check that max_used_connections is updated when cached thread is
# reused... # reused...
connect (con4,localhost,root,,); connect (con2,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
# ...and when new thread is created. # ...and when new thread is created.
connect (con5,localhost,root,,); connect (con3,localhost,root,,);
SHOW STATUS LIKE 'max_used_connections'; SHOW STATUS LIKE 'max_used_connections';
# Restore original setting. # Restore original setting.
connection default; connection default;
SET GLOBAL thread_cache_size=@save_thread_cache_size; SET GLOBAL thread_cache_size=@save_thread_cache_size;
disconnect con5;
disconnect con4;
disconnect con3; disconnect con3;
disconnect con2; disconnect con2;
disconnect con1; disconnect con1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment