1# Tests for the performance schema
2
3# =======================================
4# HELPER include/connection_load.inc
5# =======================================
6
7call dump_all();
8
9connect (con1a, localhost, user1, , );
10select "user1 in con1a" as status;
11call dump_all();
12
13connect (con1b, localhost, user1, , );
14select "user1 in con1b" as status;
15call dump_all();
16
17connect (con1c, localhost, user1, , );
18select "user1 in con1c" as status;
19call dump_all();
20
21connect (con2a, localhost, user2, , );
22select "user2 in con2a" as status;
23call dump_all();
24
25connect (con2b, localhost, user2, , );
26select "user2 in con2b" as status;
27call dump_all();
28
29connect (con2c, localhost, user2, , );
30select "user2 in con2c" as status;
31call dump_all();
32
33connect (con3a, localhost, user3, , );
34select "user3 in con3a" as status;
35call dump_all();
36
37connect (con3b, localhost, user3, , );
38select "user3 in con3b" as status;
39call dump_all();
40
41connect (con3c, localhost, user3, , );
42select "user3 in con3c" as status;
43call dump_all();
44
45--connection default
46
47--disconnect con1a
48
49# Wait for the disconnect to complete
50let $wait_condition=
51  select count(*) = 8 from performance_schema.threads
52  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
53--source include/wait_condition.inc
54
55select "con1a disconnected" as status;
56call dump_all();
57
58--disconnect con2a
59
60# Wait for the disconnect to complete
61let $wait_condition=
62  select count(*) = 7 from performance_schema.threads
63  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
64--source include/wait_condition.inc
65
66select "con2a disconnected" as status;
67call dump_all();
68
69--disconnect con3a
70
71# Wait for the disconnect to complete
72let $wait_condition=
73  select count(*) = 6 from performance_schema.threads
74  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
75--source include/wait_condition.inc
76
77select "con3a disconnected" as status;
78call dump_all();
79
80truncate table performance_schema.accounts;
81call dump_all();
82truncate table performance_schema.users;
83call dump_all();
84truncate table performance_schema.hosts;
85call dump_all();
86
87connect (con4a, localhost, user4, , );
88select "user4 in con4a" as status;
89call dump_all();
90
91connect (con4b, localhost, user4, , );
92select "user4 in con4b" as status;
93call dump_all();
94
95connect (con4c, localhost, user4, , );
96select "user4 in con4c" as status;
97call dump_all();
98
99--connection default
100
101--disconnect con1b
102
103# Wait for the disconnect to complete
104let $wait_condition=
105  select count(*) = 8 from performance_schema.threads
106  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
107--source include/wait_condition.inc
108
109select "con1b disconnected" as status;
110call dump_all();
111
112--disconnect con2b
113
114# Wait for the disconnect to complete
115let $wait_condition=
116  select count(*) = 7 from performance_schema.threads
117  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
118--source include/wait_condition.inc
119
120select "con2b disconnected" as status;
121call dump_all();
122
123--disconnect con3b
124
125# Wait for the disconnect to complete
126let $wait_condition=
127  select count(*) = 6 from performance_schema.threads
128  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
129--source include/wait_condition.inc
130
131select "con3b disconnected" as status;
132call dump_all();
133
134--disconnect con1c
135
136# Wait for the disconnect to complete
137let $wait_condition=
138  select count(*) = 5 from performance_schema.threads
139  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
140--source include/wait_condition.inc
141
142select "con1c disconnected" as status;
143call dump_all();
144
145--disconnect con2c
146
147# Wait for the disconnect to complete
148let $wait_condition=
149  select count(*) = 4 from performance_schema.threads
150  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
151--source include/wait_condition.inc
152
153select "con2c disconnected" as status;
154call dump_all();
155
156--disconnect con3c
157
158# Wait for the disconnect to complete
159let $wait_condition=
160  select count(*) = 3 from performance_schema.threads
161  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
162--source include/wait_condition.inc
163
164select "con3c disconnected" as status;
165call dump_all();
166
167truncate table performance_schema.accounts;
168call dump_all();
169truncate table performance_schema.users;
170call dump_all();
171truncate table performance_schema.hosts;
172call dump_all();
173
174connect (con5a, localhost, user5, , );
175select "user5 in con5a" as status;
176call dump_all();
177
178connect (con5b, localhost, user5, , );
179select "user5 in con5b" as status;
180call dump_all();
181
182connect (con5c, localhost, user5, , );
183select "user5 in con5c" as status;
184call dump_all();
185
186--connection default
187
188--disconnect con4a
189
190# Wait for the disconnect to complete
191let $wait_condition=
192  select count(*) = 5 from performance_schema.threads
193  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
194--source include/wait_condition.inc
195
196--disconnect con4b
197
198# Wait for the disconnect to complete
199let $wait_condition=
200  select count(*) = 4 from performance_schema.threads
201  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
202--source include/wait_condition.inc
203
204--disconnect con4c
205
206# Wait for the disconnect to complete
207let $wait_condition=
208  select count(*) = 3 from performance_schema.threads
209  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
210--source include/wait_condition.inc
211
212--disconnect con5a
213
214# Wait for the disconnect to complete
215let $wait_condition=
216  select count(*) = 2 from performance_schema.threads
217  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
218--source include/wait_condition.inc
219
220--disconnect con5b
221
222# Wait for the disconnect to complete
223let $wait_condition=
224  select count(*) = 1 from performance_schema.threads
225  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
226--source include/wait_condition.inc
227
228--disconnect con5c
229
230# Wait for the disconnect to complete
231let $wait_condition=
232  select count(*) = 0 from performance_schema.threads
233  where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%';
234--source include/wait_condition.inc
235
236select "con 5a, 5b, 5c, 6a, 6b, 6c disconnected" as status;
237call dump_all();
238
239truncate table performance_schema.hosts;
240call dump_all();
241truncate table performance_schema.users;
242call dump_all();
243truncate table performance_schema.accounts;
244call dump_all();
245
246