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