diff options
author | unknown <anozdrin/alik@quad.> | 2008-03-17 14:26:00 +0300 |
---|---|---|
committer | unknown <anozdrin/alik@quad.> | 2008-03-17 14:26:00 +0300 |
commit | c1e69a77a6f6563214b5f5e8813db423c4f3a04c (patch) | |
tree | dbed4b209c7f0db9b9c6015b42e71bd1761897b8 /mysql-test/r/connect.result | |
parent | 30d644f859ee65748f12e3861abaf1fbb2c3b2c7 (diff) | |
download | mariadb-git-c1e69a77a6f6563214b5f5e8813db423c4f3a04c.tar.gz |
Avoid races in connect.test.
The problem was in a test case for Bug33507:
- when the number of active connections reaches the limit,
the server accepts only root connections. That's achieved by
accepting a connection, negotiating with the client and
checking user credentials. If it is not SUPER, the connection
is dropped.
- when the server accepts connection, it increases the counter;
- when the server drops connection, it decreases the counter;
- the race was in between of decreasing the counter and accepting
new connection:
- max_user_connections = 2;
- 2 oridinary user connections accepted;
- extra user connection is establishing;
- server checked user credentials, and sent 'Too many connections'
error;
- the client receives the error and establishes extra SUPER user
connection;
- the server however didn't decrease the counter (the extra
user connection still is "alive" in the server) -- so, the new
SUPER-user connection, will be dropped, because it exceeds
(max_user_connections + 1).
The fix is to implement "safe connect", which makes several attempts
to connect and use it in the test script.
mysql-test/r/connect.result:
Update test file.
mysql-test/t/connect.test:
Avoid races in connect.test.
mysql-test/include/connect2.inc:
Auxiliary routine to establish a connection reliably.
Diffstat (limited to 'mysql-test/r/connect.result')
-rw-r--r-- | mysql-test/r/connect.result | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index f2bacf92cc8..727433d3032 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -127,8 +127,7 @@ GRANT USAGE ON *.* TO mysqltest_u1@localhost; SET GLOBAL max_connections = 3; SET GLOBAL event_scheduler = ON; -# -- Waiting for old connections to close... - +# -- Waiting for Event Scheduler to start... # -- Disconnecting default connection... @@ -136,22 +135,33 @@ SET GLOBAL event_scheduler = ON; # -- many threads are running. # -- Connecting (1)... - -# -- Waiting for root connection to close... +# -- Establishing connection 'con_1' (user: mysqltest_u1)... +# -- Connection 'con_1' has been established. # -- Connecting (2)... +# -- Establishing connection 'con_2' (user: mysqltest_u1)... +# -- Connection 'con_2' has been established. + # -- Connecting (3)... -# -- Connecting (4)... -ERROR 08004: Too many connections +# -- Establishing connection 'con_3' (user: mysqltest_u1)... +# -- Connection 'con_3' has been established. -# -- Waiting for the last connection to close... +# -- Connecting (4) [should fail]... +# -- Establishing connection 'con_4' (user: mysqltest_u1)... +# -- Error: can not establish connection 'con_4'. # -- Check that we allow one extra SUPER-user connection. # -- Connecting super (1)... -# -- Connecting super (2)... -ERROR HY000: Too many connections +# -- Establishing connection 'con_super_1' (user: root)... +# -- Connection 'con_super_1' has been established. + +# -- Connecting super (2) [should fail]... +# -- Establishing connection 'con_super_2' (user: root)... +# -- Error: can not establish connection 'con_super_2'. +# -- Ensure that we have Event Scheduler thread, 3 ordinary user +# -- connections and one extra super-user connection. SELECT user FROM information_schema.processlist ORDER BY id; user event_scheduler @@ -165,6 +175,7 @@ SET GLOBAL max_connections = 151; # -- Stopping Event Scheduler... SET GLOBAL event_scheduler = OFF; + # -- Waiting for Event Scheduler to stop... # -- That's it. Closing connections... |