Debian Codegraph @

mysql-test/suite/perfschema/t/threads_history.test

raw
1 # Check the impact of changes done in HISTORY column in
2 # performance_schema.setup_actors.
3
4 --source include/not_embedded.inc
5 --source include/have_perfschema.inc
6 --source include/no_protocol.inc
7
8 # Presence of the query cache changes query stages,
9 # causing noise in the test output
10 #--source include/have_query_cache_disabled.inc
11
12 create user user1@localhost;
13 create user user2@localhost;
14 create user user3@localhost;
15 create user user4@localhost;
16
17 grant ALL on *.* to user1@localhost;
18 grant ALL on *.* to user2@localhost;
19 grant ALL on *.* to user3@localhost;
20 grant ALL on *.* to user4@localhost;
21
22 flush privileges;
23
24 select * from performance_schema.setup_consumers;
25
26 connect (con1, localhost, user1, , );
27
28 update performance_schema.threads
29 set INSTRUMENTED='YES', HISTORY='YES'
30 where PROCESSLIST_ID = connection_id();
31
32 let $con1_thread_id= `select THREAD_ID from performance_schema.threads
33 where PROCESSLIST_ID = connection_id()`;
34
35 connect (con2, localhost, user2, , );
36
37 update performance_schema.threads
38 set INSTRUMENTED='YES', HISTORY='NO'
39 where PROCESSLIST_ID = connection_id();
40
41 let $con2_thread_id= `select THREAD_ID from performance_schema.threads
42 where PROCESSLIST_ID = connection_id()`;
43
44 connect (con3, localhost, user3, , );
45
46 update performance_schema.threads
47 set INSTRUMENTED='NO', HISTORY='YES'
48 where PROCESSLIST_ID = connection_id();
49
50 let $con3_thread_id= `select THREAD_ID from performance_schema.threads
51 where PROCESSLIST_ID = connection_id()`;
52
53 connect (con4, localhost, user4, , );
54
55 update performance_schema.threads
56 set INSTRUMENTED='NO', HISTORY='NO'
57 where PROCESSLIST_ID = connection_id();
58
59 let $con4_thread_id= `select THREAD_ID from performance_schema.threads
60 where PROCESSLIST_ID = connection_id()`;
61
62 --connection default
63
64 truncate table performance_schema.events_transactions_current;
65 truncate table performance_schema.events_transactions_history;
66 truncate table performance_schema.events_transactions_history_long;
67 truncate table performance_schema.events_statements_current;
68 truncate table performance_schema.events_statements_history;
69 truncate table performance_schema.events_statements_history_long;
70 truncate table performance_schema.events_stages_current;
71 truncate table performance_schema.events_stages_history;
72 truncate table performance_schema.events_stages_history_long;
73 truncate table performance_schema.events_waits_current;
74 truncate table performance_schema.events_waits_history;
75 truncate table performance_schema.events_waits_history_long;
76
77 --connection con1
78
79 XA START 'XA_CON1', 'XA_BQUAL', 12;
80 select "Hi from con1";
81 XA END 'XA_CON1', 'XA_BQUAL', 12;
82 XA PREPARE 'XA_CON1', 'XA_BQUAL', 12;
83 XA COMMIT 'XA_CON1', 'XA_BQUAL', 12;
84
85 --connection con2
86
87 XA START 'XA_CON2', 'XA_BQUAL', 12;
88 select "Hi from con2";
89 XA END 'XA_CON2', 'XA_BQUAL', 12;
90 XA PREPARE 'XA_CON2', 'XA_BQUAL', 12;
91 XA COMMIT 'XA_CON2', 'XA_BQUAL', 12;
92
93 --connection con3
94
95 XA START 'XA_CON3', 'XA_BQUAL', 12;
96 select "Hi from con3";
97 XA END 'XA_CON3', 'XA_BQUAL', 12;
98 XA PREPARE 'XA_CON3', 'XA_BQUAL', 12;
99 XA COMMIT 'XA_CON3', 'XA_BQUAL', 12;
100
101 --connection con4
102
103 XA START 'XA_CON4', 'XA_BQUAL', 12;
104 select "Hi from con4";
105 XA END 'XA_CON4', 'XA_BQUAL', 12;
106 XA PREPARE 'XA_CON4', 'XA_BQUAL', 12;
107 XA COMMIT 'XA_CON4', 'XA_BQUAL', 12;
108
109 --connection default
110
111 echo ########################### Transactions user 1 - 1;
112
113 evalp select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current
114 where THREAD_ID = $con1_thread_id;
115 evalp select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history
116 where THREAD_ID = $con1_thread_id;
117 evalp select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long
118 where THREAD_ID = $con1_thread_id;
119
120 echo ########################### Transactions user 2 - 1;
121
122 evalp select /*2-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current
123 where THREAD_ID = $con2_thread_id;
124 evalp select /*2-1*/ count(*) from performance_schema.events_transactions_history
125 where THREAD_ID = $con2_thread_id;
126 evalp select /*2-1*/ count(*) from performance_schema.events_transactions_history_long
127 where THREAD_ID = $con2_thread_id;
128
129 echo ########################### Transactions user 3 - 1;
130
131 evalp select /*3-1*/ count(*) from performance_schema.events_transactions_current
132 where THREAD_ID = $con3_thread_id;
133 evalp select /*3-1*/ count(*) from performance_schema.events_transactions_history
134 where THREAD_ID = $con3_thread_id;
135 evalp select /*3-1*/ count(*) from performance_schema.events_transactions_history_long
136 where THREAD_ID = $con3_thread_id;
137
138 echo ########################### Transactions user 4 - 1;
139
140 evalp select /*4-1*/ count(*) from performance_schema.events_transactions_current
141 where THREAD_ID = $con4_thread_id;
142 evalp select /*4-1*/ count(*) from performance_schema.events_transactions_history
143 where THREAD_ID = $con4_thread_id;
144 evalp select /*4-1*/ count(*) from performance_schema.events_transactions_history_long
145 where THREAD_ID = $con4_thread_id;
146
147 echo ########################### Statements user 1 - 1;
148
149 evalp select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current
150 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
151 evalp select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history
152 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
153 evalp select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long
154 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
155
156 echo ########################### Statements user 2 - 1;
157
158 evalp select /*2-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current
159 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
160 evalp select /*2-1*/ count(*) from performance_schema.events_statements_history
161 where THREAD_ID = $con2_thread_id;
162 evalp select /*2-1*/ count(*) from performance_schema.events_statements_history_long
163 where THREAD_ID = $con2_thread_id;
164
165 echo ########################### Statements user 3 - 1;
166
167 evalp select /*3-1*/ count(*) from performance_schema.events_statements_current
168 where THREAD_ID = $con3_thread_id;
169 evalp select /*3-1*/ count(*) from performance_schema.events_statements_history
170 where THREAD_ID = $con3_thread_id;
171 evalp select /*3-1*/ count(*) from performance_schema.events_statements_history_long
172 where THREAD_ID = $con3_thread_id;
173
174 echo ########################### Statements user 4 - 1;
175
176 evalp select /*4-1*/ count(*) from performance_schema.events_statements_current
177 where THREAD_ID = $con4_thread_id;
178 evalp select /*4-1*/ count(*) from performance_schema.events_statements_history
179 where THREAD_ID = $con4_thread_id;
180 evalp select /*4-1*/ count(*) from performance_schema.events_statements_history_long
181 where THREAD_ID = $con4_thread_id;
182
183 echo ########################### Stages user 1 - 1;
184
185 evalp select /*1-1*/ EVENT_NAME from performance_schema.events_stages_current
186 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
187 evalp select /*1-1*/ EVENT_NAME from performance_schema.events_stages_history
188 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
189 evalp select /*1-1*/ EVENT_NAME from performance_schema.events_stages_history_long
190 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
191
192 echo ########################### Stages user 2 - 1;
193
194 evalp select /*2-1*/ EVENT_NAME from performance_schema.events_stages_current
195 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
196 evalp select /*2-1*/ count(*) from performance_schema.events_stages_history
197 where THREAD_ID = $con2_thread_id;
198 evalp select /*2-1*/ count(*) from performance_schema.events_stages_history_long
199 where THREAD_ID = $con2_thread_id;
200
201 echo ########################### Stages user 3 - 1;
202
203 evalp select /*3-1*/ count(*) from performance_schema.events_stages_current
204 where THREAD_ID = $con3_thread_id;
205 evalp select /*3-1*/ count(*) from performance_schema.events_stages_history
206 where THREAD_ID = $con3_thread_id;
207 evalp select /*3-1*/ count(*) from performance_schema.events_stages_history_long
208 where THREAD_ID = $con3_thread_id;
209
210 echo ########################### Stages user 4 - 1;
211
212 evalp select /*4-1*/ count(*) from performance_schema.events_stages_current
213 where THREAD_ID = $con4_thread_id;
214 evalp select /*4-1*/ count(*) from performance_schema.events_stages_history
215 where THREAD_ID = $con4_thread_id;
216 evalp select /*4-1*/ count(*) from performance_schema.events_stages_history_long
217 where THREAD_ID = $con4_thread_id;
218
219 echo ########################### Waits user 1 - 1;
220
221 evalp select /*1-1*/ EVENT_NAME from performance_schema.events_waits_current
222 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
223 evalp select /*1-1*/ (count(*) > 5) as has_waits from performance_schema.events_waits_history
224 where THREAD_ID = $con1_thread_id;
225 evalp select /*1-1*/ (count(*) > 15) as has_waits from performance_schema.events_waits_history_long
226 where THREAD_ID = $con1_thread_id;
227
228 echo ########################### Waits user 2 - 1;
229
230 evalp select /*2-1*/ EVENT_NAME from performance_schema.events_waits_current
231 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
232 evalp select /*2-1*/ count(*) from performance_schema.events_waits_history
233 where THREAD_ID = $con2_thread_id;
234 evalp select /*2-1*/ count(*) from performance_schema.events_waits_history_long
235 where THREAD_ID = $con2_thread_id;
236
237 echo ########################### Waits user 3 - 1;
238
239 evalp select /*3-1*/ count(*) from performance_schema.events_waits_current
240 where THREAD_ID = $con3_thread_id;
241 evalp select /*3-1*/ count(*) from performance_schema.events_waits_history
242 where THREAD_ID = $con3_thread_id;
243 evalp select /*3-1*/ count(*) from performance_schema.events_waits_history_long
244 where THREAD_ID = $con3_thread_id;
245
246 echo ########################### Waits user 4 - 1;
247
248 evalp select /*4-1*/ count(*) from performance_schema.events_waits_current
249 where THREAD_ID = $con4_thread_id;
250 evalp select /*4-1*/ count(*) from performance_schema.events_waits_history
251 where THREAD_ID = $con4_thread_id;
252 evalp select /*4-1*/ count(*) from performance_schema.events_waits_history_long
253 where THREAD_ID = $con4_thread_id;
254
255 --connection default
256
257 update performance_schema.setup_consumers
258 set enabled='NO' where name like "%history%";
259
260 select * from performance_schema.setup_consumers;
261
262 truncate table performance_schema.events_transactions_current;
263 truncate table performance_schema.events_transactions_history;
264 truncate table performance_schema.events_transactions_history_long;
265 truncate table performance_schema.events_statements_current;
266 truncate table performance_schema.events_statements_history;
267 truncate table performance_schema.events_statements_history_long;
268 truncate table performance_schema.events_stages_current;
269 truncate table performance_schema.events_stages_history;
270 truncate table performance_schema.events_stages_history_long;
271 truncate table performance_schema.events_waits_current;
272 truncate table performance_schema.events_waits_history;
273 truncate table performance_schema.events_waits_history_long;
274
275 --connection con1
276
277 XA START 'XA_CON1', 'XA_BQUAL', 12;
278 select "Hi from con1";
279 XA END 'XA_CON1', 'XA_BQUAL', 12;
280 XA PREPARE 'XA_CON1', 'XA_BQUAL', 12;
281 XA COMMIT 'XA_CON1', 'XA_BQUAL', 12;
282
283 --connection con2
284
285 XA START 'XA_CON2', 'XA_BQUAL', 12;
286 select "Hi from con2";
287 XA END 'XA_CON2', 'XA_BQUAL', 12;
288 XA PREPARE 'XA_CON2', 'XA_BQUAL', 12;
289 XA COMMIT 'XA_CON2', 'XA_BQUAL', 12;
290
291 --connection con3
292
293 XA START 'XA_CON3', 'XA_BQUAL', 12;
294 select "Hi from con3";
295 XA END 'XA_CON3', 'XA_BQUAL', 12;
296 XA PREPARE 'XA_CON3', 'XA_BQUAL', 12;
297 XA COMMIT 'XA_CON3', 'XA_BQUAL', 12;
298
299 --connection con4
300
301 XA START 'XA_CON4', 'XA_BQUAL', 12;
302 select "Hi from con4";
303 XA END 'XA_CON4', 'XA_BQUAL', 12;
304 XA PREPARE 'XA_CON4', 'XA_BQUAL', 12;
305 XA COMMIT 'XA_CON4', 'XA_BQUAL', 12;
306
307 --connection default
308
309 echo ########################### Transactions user 1 - 2;
310
311 evalp select /*1-2*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current
312 where THREAD_ID = $con1_thread_id;
313 evalp select /*1-2*/ count(*) from performance_schema.events_transactions_history
314 where THREAD_ID = $con1_thread_id;
315 evalp select /*1-2*/ count(*) from performance_schema.events_transactions_history_long
316 where THREAD_ID = $con1_thread_id;
317
318 echo ########################### Transactions user 2 - 2;
319
320 evalp select /*2-2*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current
321 where THREAD_ID = $con2_thread_id;
322 evalp select /*2-2*/ count(*) from performance_schema.events_transactions_history
323 where THREAD_ID = $con2_thread_id;
324 evalp select /*2-2*/ count(*) from performance_schema.events_transactions_history_long
325 where THREAD_ID = $con2_thread_id;
326
327 echo ########################### Transactions user 3 - 2;
328
329 evalp select /*3-2*/ count(*) from performance_schema.events_transactions_current
330 where THREAD_ID = $con3_thread_id;
331 evalp select /*3-2*/ count(*) from performance_schema.events_transactions_history
332 where THREAD_ID = $con3_thread_id;
333 evalp select /*3-2*/ count(*) from performance_schema.events_transactions_history_long
334 where THREAD_ID = $con3_thread_id;
335
336 echo ########################### Transactions user 4 - 2;
337
338 evalp select /*4-2*/ count(*) from performance_schema.events_transactions_current
339 where THREAD_ID = $con4_thread_id;
340 evalp select /*4-2*/ count(*) from performance_schema.events_transactions_history
341 where THREAD_ID = $con4_thread_id;
342 evalp select /*4-2*/ count(*) from performance_schema.events_transactions_history_long
343 where THREAD_ID = $con4_thread_id;
344
345 echo ########################### Statements user 1 - 2;
346
347 evalp select /*1-2*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current
348 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
349 evalp select /*1-2*/ count(*) from performance_schema.events_statements_history
350 where THREAD_ID = $con1_thread_id;
351 evalp select /*1-2*/ count(*) from performance_schema.events_statements_history_long
352 where THREAD_ID = $con1_thread_id;
353
354 echo ########################### Statements user 2 - 2;
355
356 evalp select /*2-2*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current
357 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
358 evalp select /*2-2*/ count(*) from performance_schema.events_statements_history
359 where THREAD_ID = $con2_thread_id;
360 evalp select /*2-2*/ count(*) from performance_schema.events_statements_history_long
361 where THREAD_ID = $con2_thread_id;
362
363 echo ########################### Statements user 3 - 2;
364
365 evalp select /*3-2*/ count(*) from performance_schema.events_statements_current
366 where THREAD_ID = $con3_thread_id;
367 evalp select /*3-2*/ count(*) from performance_schema.events_statements_history
368 where THREAD_ID = $con3_thread_id;
369 evalp select /*3-2*/ count(*) from performance_schema.events_statements_history_long
370 where THREAD_ID = $con3_thread_id;
371
372 echo ########################### Statements user 4 - 2;
373
374 evalp select /*4-2*/ count(*) from performance_schema.events_statements_current
375 where THREAD_ID = $con4_thread_id;
376 evalp select /*4-2*/ count(*) from performance_schema.events_statements_history
377 where THREAD_ID = $con4_thread_id;
378 evalp select /*4-2*/ count(*) from performance_schema.events_statements_history_long
379 where THREAD_ID = $con4_thread_id;
380
381 echo ########################### Stages user 1 - 2;
382
383 evalp select /*1-2*/ EVENT_NAME from performance_schema.events_stages_current
384 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
385 evalp select /*1-2*/ count(*) from performance_schema.events_stages_history
386 where THREAD_ID = $con1_thread_id;
387 evalp select /*1-2*/ count(*) from performance_schema.events_stages_history_long
388 where THREAD_ID = $con1_thread_id;
389
390 echo ########################### Stages user 2 - 2;
391
392 evalp select /*2-2*/ EVENT_NAME from performance_schema.events_stages_current
393 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
394 evalp select /*2-2*/ count(*) from performance_schema.events_stages_history
395 where THREAD_ID = $con2_thread_id;
396 evalp select /*2-2*/ count(*) from performance_schema.events_stages_history_long
397 where THREAD_ID = $con2_thread_id;
398
399 echo ########################### Stages user 3 - 2;
400
401 evalp select /*3-2*/ count(*) from performance_schema.events_stages_current
402 where THREAD_ID = $con3_thread_id;
403 evalp select /*3-2*/ count(*) from performance_schema.events_stages_history
404 where THREAD_ID = $con3_thread_id;
405 evalp select /*3-2*/ count(*) from performance_schema.events_stages_history_long
406 where THREAD_ID = $con3_thread_id;
407
408 echo ########################### Stages user 4 - 2;
409
410 evalp select /*4-2*/ count(*) from performance_schema.events_stages_current
411 where THREAD_ID = $con4_thread_id;
412 evalp select /*4-2*/ count(*) from performance_schema.events_stages_history
413 where THREAD_ID = $con4_thread_id;
414 evalp select /*4-2*/ count(*) from performance_schema.events_stages_history_long
415 where THREAD_ID = $con4_thread_id;
416
417 echo ########################### Waits user 1 - 2;
418
419 evalp select /*1-2*/ EVENT_NAME from performance_schema.events_waits_current
420 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
421 evalp select /*1-2*/ count(*) as has_waits from performance_schema.events_waits_history
422 where THREAD_ID = $con1_thread_id;
423 evalp select /*1-2*/ count(*) as has_waits from performance_schema.events_waits_history_long
424 where THREAD_ID = $con1_thread_id;
425
426 echo ########################### Waits user 2 - 2;
427
428 evalp select /*2-2*/ EVENT_NAME from performance_schema.events_waits_current
429 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
430 evalp select /*2-2*/ count(*) from performance_schema.events_waits_history
431 where THREAD_ID = $con2_thread_id;
432 evalp select /*2-2*/ count(*) from performance_schema.events_waits_history_long
433 where THREAD_ID = $con2_thread_id;
434
435 echo ########################### Waits user 3 - 2;
436
437 evalp select /*3-2*/ count(*) from performance_schema.events_waits_current
438 where THREAD_ID = $con3_thread_id;
439 evalp select /*3-2*/ count(*) from performance_schema.events_waits_history
440 where THREAD_ID = $con3_thread_id;
441 evalp select /*3-2*/ count(*) from performance_schema.events_waits_history_long
442 where THREAD_ID = $con3_thread_id;
443
444 echo ########################### Waits user 4 - 2;
445
446 evalp select /*4-2*/ count(*) from performance_schema.events_waits_current
447 where THREAD_ID = $con4_thread_id;
448 evalp select /*4-2*/ count(*) from performance_schema.events_waits_history
449 where THREAD_ID = $con4_thread_id;
450 evalp select /*4-2*/ count(*) from performance_schema.events_waits_history_long
451 where THREAD_ID = $con4_thread_id;
452
453 --connection default
454
455 update performance_schema.setup_consumers
456 set enabled='YES' where name like "%history%";
457
458 select * from performance_schema.setup_consumers;
459
460 truncate table performance_schema.events_transactions_current;
461 truncate table performance_schema.events_transactions_history;
462 truncate table performance_schema.events_transactions_history_long;
463 truncate table performance_schema.events_statements_current;
464 truncate table performance_schema.events_statements_history;
465 truncate table performance_schema.events_statements_history_long;
466 truncate table performance_schema.events_stages_current;
467 truncate table performance_schema.events_stages_history;
468 truncate table performance_schema.events_stages_history_long;
469 truncate table performance_schema.events_waits_current;
470 truncate table performance_schema.events_waits_history;
471 truncate table performance_schema.events_waits_history_long;
472
473 --connection con1
474
475 XA START 'XA_CON1', 'XA_BQUAL', 12;
476 select "Hi from con1";
477 XA END 'XA_CON1', 'XA_BQUAL', 12;
478 XA PREPARE 'XA_CON1', 'XA_BQUAL', 12;
479 XA COMMIT 'XA_CON1', 'XA_BQUAL', 12;
480
481 --connection con2
482
483 XA START 'XA_CON2', 'XA_BQUAL', 12;
484 select "Hi from con2";
485 XA END 'XA_CON2', 'XA_BQUAL', 12;
486 XA PREPARE 'XA_CON2', 'XA_BQUAL', 12;
487 XA COMMIT 'XA_CON2', 'XA_BQUAL', 12;
488
489 --connection con3
490
491 XA START 'XA_CON3', 'XA_BQUAL', 12;
492 select "Hi from con3";
493 XA END 'XA_CON3', 'XA_BQUAL', 12;
494 XA PREPARE 'XA_CON3', 'XA_BQUAL', 12;
495 XA COMMIT 'XA_CON3', 'XA_BQUAL', 12;
496
497 --connection con4
498
499 XA START 'XA_CON4', 'XA_BQUAL', 12;
500 select "Hi from con4";
501 XA END 'XA_CON4', 'XA_BQUAL', 12;
502 XA PREPARE 'XA_CON4', 'XA_BQUAL', 12;
503 XA COMMIT 'XA_CON4', 'XA_BQUAL', 12;
504
505 --connection default
506
507 echo ########################### Transactions user 1 - 3;
508
509 evalp select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current
510 where THREAD_ID = $con1_thread_id;
511 evalp select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history
512 where THREAD_ID = $con1_thread_id;
513 evalp select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long
514 where THREAD_ID = $con1_thread_id;
515
516 echo ########################### Transactions user 2 - 3;
517
518 evalp select /*2-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current
519 where THREAD_ID = $con2_thread_id;
520 evalp select /*2-3*/ count(*) from performance_schema.events_transactions_history
521 where THREAD_ID = $con2_thread_id;
522 evalp select /*2-3*/ count(*) from performance_schema.events_transactions_history_long
523 where THREAD_ID = $con2_thread_id;
524
525 echo ########################### Transactions user 3 - 3;
526
527 evalp select /*3-3*/ count(*) from performance_schema.events_transactions_current
528 where THREAD_ID = $con3_thread_id;
529 evalp select /*3-3*/ count(*) from performance_schema.events_transactions_history
530 where THREAD_ID = $con3_thread_id;
531 evalp select /*3-3*/ count(*) from performance_schema.events_transactions_history_long
532 where THREAD_ID = $con3_thread_id;
533
534 echo ########################### Transactions user 4 - 3;
535
536 evalp select /*4-3*/ count(*) from performance_schema.events_transactions_current
537 where THREAD_ID = $con4_thread_id;
538 evalp select /*4-3*/ count(*) from performance_schema.events_transactions_history
539 where THREAD_ID = $con4_thread_id;
540 evalp select /*4-3*/ count(*) from performance_schema.events_transactions_history_long
541 where THREAD_ID = $con4_thread_id;
542
543 echo ########################### Statements user 1 - 3;
544
545 evalp select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current
546 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
547 evalp select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history
548 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
549 evalp select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long
550 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
551
552 echo ########################### Statements user 2 - 3;
553
554 evalp select /*2-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current
555 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
556 evalp select /*2-3*/ count(*) from performance_schema.events_statements_history
557 where THREAD_ID = $con2_thread_id;
558 evalp select /*2-3*/ count(*) from performance_schema.events_statements_history_long
559 where THREAD_ID = $con2_thread_id;
560
561 echo ########################### Statements user 3 - 3;
562
563 evalp select /*3-3*/ count(*) from performance_schema.events_statements_current
564 where THREAD_ID = $con3_thread_id;
565 evalp select /*3-3*/ count(*) from performance_schema.events_statements_history
566 where THREAD_ID = $con3_thread_id;
567 evalp select /*3-3*/ count(*) from performance_schema.events_statements_history_long
568 where THREAD_ID = $con3_thread_id;
569
570 echo ########################### Statements user 4 - 3;
571
572 evalp select /*4-3*/ count(*) from performance_schema.events_statements_current
573 where THREAD_ID = $con4_thread_id;
574 evalp select /*4-3*/ count(*) from performance_schema.events_statements_history
575 where THREAD_ID = $con4_thread_id;
576 evalp select /*4-3*/ count(*) from performance_schema.events_statements_history_long
577 where THREAD_ID = $con4_thread_id;
578
579 echo ########################### Stages user 1 - 3;
580
581 evalp select /*1-3*/ EVENT_NAME from performance_schema.events_stages_current
582 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
583 evalp select /*1-3*/ EVENT_NAME from performance_schema.events_stages_history
584 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
585 evalp select /*1-3*/ EVENT_NAME from performance_schema.events_stages_history_long
586 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
587
588 echo ########################### Stages user 2 - 3;
589
590 evalp select /*2-3*/ EVENT_NAME from performance_schema.events_stages_current
591 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
592 evalp select /*2-3*/ count(*) from performance_schema.events_stages_history
593 where THREAD_ID = $con2_thread_id;
594 evalp select /*2-3*/ count(*) from performance_schema.events_stages_history_long
595 where THREAD_ID = $con2_thread_id;
596
597 echo ########################### Stages user 3 - 3;
598
599 evalp select /*3-3*/ count(*) from performance_schema.events_stages_current
600 where THREAD_ID = $con3_thread_id;
601 evalp select /*3-3*/ count(*) from performance_schema.events_stages_history
602 where THREAD_ID = $con3_thread_id;
603 evalp select /*3-3*/ count(*) from performance_schema.events_stages_history_long
604 where THREAD_ID = $con3_thread_id;
605
606 echo ########################### Stages user 4 - 3;
607
608 evalp select /*4-3*/ count(*) from performance_schema.events_stages_current
609 where THREAD_ID = $con4_thread_id;
610 evalp select /*4-3*/ count(*) from performance_schema.events_stages_history
611 where THREAD_ID = $con4_thread_id;
612 evalp select /*4-3*/ count(*) from performance_schema.events_stages_history_long
613 where THREAD_ID = $con4_thread_id;
614
615 echo ########################### Waits user 1 - 3;
616
617 evalp select /*1-3*/ EVENT_NAME from performance_schema.events_waits_current
618 where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID;
619 evalp select /*1-3*/ (count(*) > 5) as has_waits from performance_schema.events_waits_history
620 where THREAD_ID = $con1_thread_id;
621 evalp select /*1-3*/ (count(*) > 15) as has_waits from performance_schema.events_waits_history_long
622 where THREAD_ID = $con1_thread_id;
623
624 echo ########################### Waits user 2 - 3;
625
626 evalp select /*2-3*/ EVENT_NAME from performance_schema.events_waits_current
627 where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID;
628 evalp select /*2-3*/ count(*) from performance_schema.events_waits_history
629 where THREAD_ID = $con2_thread_id;
630 evalp select /*2-3*/ count(*) from performance_schema.events_waits_history_long
631 where THREAD_ID = $con2_thread_id;
632
633 echo ########################### Waits user 3 - 3;
634
635 evalp select /*3-3*/ count(*) from performance_schema.events_waits_current
636 where THREAD_ID = $con3_thread_id;
637 evalp select /*3-3*/ count(*) from performance_schema.events_waits_history
638 where THREAD_ID = $con3_thread_id;
639 evalp select /*3-3*/ count(*) from performance_schema.events_waits_history_long
640 where THREAD_ID = $con3_thread_id;
641
642 echo ########################### Waits user 4 - 3;
643
644 evalp select /*4-3*/ count(*) from performance_schema.events_waits_current
645 where THREAD_ID = $con4_thread_id;
646 evalp select /*4-3*/ count(*) from performance_schema.events_waits_history
647 where THREAD_ID = $con4_thread_id;
648 evalp select /*4-3*/ count(*) from performance_schema.events_waits_history_long
649 where THREAD_ID = $con4_thread_id;
650
651 --connection default
652
653 revoke all privileges, grant option from user1@localhost;
654 revoke all privileges, grant option from user2@localhost;
655 revoke all privileges, grant option from user3@localhost;
656 revoke all privileges, grant option from user4@localhost;
657 drop user user1@localhost;
658 drop user user2@localhost;
659 drop user user3@localhost;
660 drop user user4@localhost;
661 flush privileges;
662
663 truncate table performance_schema.setup_actors;
664
665 insert into performance_schema.setup_actors
666 values ('%', '%', '%', 'YES', 'YES');
667
668 select * from performance_schema.setup_actors;
669