summaryrefslogtreecommitdiff
path: root/mysql-test/t/connect.test
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@quad.>2008-03-13 12:02:12 +0300
committerunknown <anozdrin/alik@quad.>2008-03-13 12:02:12 +0300
commitc167501bfb10d21a72bdf61ff59dc155280bc45e (patch)
tree7331aeb237ddb504aa5df416bc0bfb644a796fd1 /mysql-test/t/connect.test
parentb279be388e1d8208396ada701d3015b9d7cbbc4c (diff)
downloadmariadb-git-c167501bfb10d21a72bdf61ff59dc155280bc45e.tar.gz
Fix for Bug#35074: max_used_connections is not correct.
The problem was that number of threads was used to calculate max_used_connections. The fix is to use number of active connections. mysql-test/r/connect.result: Update result file. mysql-test/t/connect.test: - Add a test case for Bug#35074: max_used_connections is not correct; - Make a test case for Bug#33507 more stable. sql/mysqld.cc: Use number of connections insetad of threads to calculate max_used_connections.
Diffstat (limited to 'mysql-test/t/connect.test')
-rw-r--r--mysql-test/t/connect.test75
1 files changed, 75 insertions, 0 deletions
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index 9e8f0d9b115..c8b69a050ba 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -209,12 +209,23 @@ SELECT user FROM information_schema.processlist ORDER BY id;
--echo # -- Resetting variables...
--eval SET GLOBAL max_connections = $saved_max_connections
+
+--echo
+--echo # -- Stopping Event Scheduler...
SET GLOBAL event_scheduler = OFF;
+--echo # -- Waiting for Event Scheduler to stop...
+let $wait_condition =
+ SELECT COUNT(*) = 0
+ FROM information_schema.processlist
+ WHERE user = 'event_scheduler';
+--source include/wait_condition.inc
+
--echo
--echo # -- That's it. Closing connections...
--disconnect con_1
--disconnect con_2
+--disconnect con_3
--disconnect con_super_1
--echo
@@ -222,9 +233,73 @@ SET GLOBAL event_scheduler = OFF;
--connect (default,localhost,root,,test)
--echo
+--echo # -- Waiting for connections to close...
+let $wait_condition =
+ SELECT COUNT(*) = 1
+ FROM information_schema.processlist
+ WHERE db = 'test';
+--source include/wait_condition.inc
+
+--echo
+DROP USER mysqltest_u1@localhost;
+
+--echo
--echo # -- End of Bug#33507.
--echo
+###########################################################################
+
+--echo # -- Bug#35074: max_used_connections is not correct.
+--echo
+
+FLUSH STATUS;
+
+--echo
+SHOW STATUS LIKE 'max_used_connections';
+
+--echo
+--echo # -- Starting Event Scheduler...
+SET GLOBAL event_scheduler = ON;
+
+--echo # -- Waiting for Event Scheduler to start...
+let $wait_condition =
+ SELECT COUNT(*) = 1
+ FROM information_schema.processlist
+ WHERE user = 'event_scheduler';
+--source include/wait_condition.inc
+
+# NOTE: We should use a new connection here instead of reconnect in order to
+# avoid races (we can not for sure when the connection being disconnected is
+# actually disconnected on the server).
+
+--echo
+--echo # -- Opening a new connection to check max_used_connections...
+--connect (con_1,localhost,root)
+
+--echo
+--echo # -- Check that max_used_connections hasn't changed.
+SHOW STATUS LIKE 'max_used_connections';
+
+--echo
+--echo # -- Closing new connection...
+--disconnect con_1
+--connection default
+
+--echo
+--echo # -- Stopping Event Scheduler...
+SET GLOBAL event_scheduler = OFF;
+
+--echo # -- Waiting for Event Scheduler to stop...
+let $wait_condition =
+ SELECT COUNT(*) = 0
+ FROM information_schema.processlist
+ WHERE user = 'event_scheduler';
+--source include/wait_condition.inc
+
+--echo
+--echo # -- End of Bug#35074.
+--echo
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------