forked from alibaba/AliSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect_debug.test
80 lines (60 loc) · 2.12 KB
/
connect_debug.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# This test makes no sense with the embedded server
--source include/not_embedded.inc
--source include/have_debug_sync.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo
--echo # -- Bug#20201006: Spamming show processlist prevents old connection
--echo # -- threads from cleaning up.
--enable_connect_log
SET @saved_max_connections = @@global.max_connections;
SET GLOBAL max_connections = 2;
--echo
--echo # -- Check that we allow only max_connections + 1 connections here
--connect (con_1, localhost, root)
--connect (con_2, localhost, root)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error ER_CON_COUNT_ERROR
--connect (con_3, localhost, root)
--echo
--echo # -- Ensure we have max_connections + 1 connections.
SELECT count(*)= @@global.max_connections + 1 FROM information_schema.processlist;
--echo
--echo # -- Take LOCK_thd_remove and close one connection then
--echo # attempt new one [should fail]...
SET DEBUG_SYNC='fill_schema_processlist_after_copying_threads SIGNAL disconnect_connection WAIT_FOR continue';
--send SELECT user FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY user;
--connection default
SET DEBUG_SYNC='now WAIT_FOR disconnect_connection';
--disconnect con_1
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error ER_CON_COUNT_ERROR
--connect (con_3, localhost, root)
--echo
--echo # -- Release the lock. Now new connection should go through
SET DEBUG_SYNC='now SIGNAL continue';
--connection con_2
reap;
SET DEBUG_SYNC='RESET';
--echo
--echo # -- Waiting for connection to close...
let $wait_condition =
SELECT COUNT(*) = 2
FROM information_schema.processlist;
--source include/wait_condition.inc
--connect (con_3, localhost, root)
--echo
--echo # -- Closing connections...
--disconnect con_3
--disconnect con_2
--source include/wait_until_disconnected.inc
--connection default
--echo
--echo # -- Resetting variables...
SET GLOBAL max_connections= @saved_max_connections;
--disable_connect_log
--echo
--echo # -- End of Bug#20201006.
--echo
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc