summaryrefslogtreecommitdiff
path: root/mysql-test/suite/perfschema/r/show_plugin_56.result
blob: d6e33cc98b6528919fc1289073543faf4d0de5c5 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871

================================================================================
SETUP
================================================================================
# Save the initial number of concurrent sessions

# Save current SHOW_COMPATIBILITY_56 setting
SELECT @@global.show_compatibility_56 INTO @show_compatibility_56_save;
#
# SET COMPATIBILITY MODE = ON
#
SET @@global.show_compatibility_56 = ON;

# Verify EXAMPLE plugin is not loaded
SELECT COUNT(*) = 0 AS "Expect 1" FROM information_schema.plugins WHERE plugin_name = "EXAMPLE";
Expect 1
1

# Create one session to force local and global system variables;
connect con0, localhost, root,,;
connection default;

================================================================================
TEST 1- NO PLUGIN VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

================================================================================
TEST 2 - PLUGIN LOAD, UNLOAD, RELOAD
================================================================================
================================================================================
2.1 - INSTALL PLUGIN
================================================================================
INSTALL PLUGIN example SONAME 'ha_example.so';

================================================================================
2.1a - FORCE SYNC OF LOCAL AND GLOBAL SYSTEM VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 8, double_var is 8.500000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 8, double_var is 8.500000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	8.500000
example_double_var	8.500000
example_enum_var	e1
example_ulong_var	8

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	8.500000
example_double_var	8.500000
example_enum_var	e1
example_ulong_var	8

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 8, double_var is 8.500000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 8, double_var is 8.500000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	8.500000
EXAMPLE_ULONG_VAR	8
EXAMPLE_DOUBLE_VAR	8.500000

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	8.500000
EXAMPLE_ULONG_VAR	8
EXAMPLE_DOUBLE_VAR	8.500000
disconnect con0;

================================================================================
2.2 - SET PLUGIN VARS
================================================================================
# GLOBAL
SET GLOBAL example_ulong_var = 100;
SET GLOBAL example_enum_var = e1;
SET GLOBAL example_double_var = 100.9990;
SET GLOBAL example_double_thdvar = 101.9991;
# SESSION
SET SESSION example_double_thdvar = 102.9992;

================================================================================
2.3 - VERIFY UPDATED PLUGIN VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 100, double_var is 100.999000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 100, double_var is 100.999000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	101.999100
example_double_var	100.999000
example_enum_var	e1
example_ulong_var	100

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	102.999200
example_double_var	100.999000
example_enum_var	e1
example_ulong_var	100

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 100, double_var is 100.999000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 100, double_var is 100.999000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	101.999100
EXAMPLE_ULONG_VAR	100
EXAMPLE_DOUBLE_VAR	100.999000

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	102.999200
EXAMPLE_ULONG_VAR	100
EXAMPLE_DOUBLE_VAR	100.999000

================================================================================
2.4 - UNINSTALL PLUGIN
================================================================================
UNINSTALL PLUGIN example;

================================================================================
2.5 - VERIFY NO PLUGIN VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

================================================================================
2.6 - REINSTALL PLUGIN
================================================================================
# Reinstall EXAMPLE plugin
INSTALL PLUGIN example SONAME 'ha_example.so';

================================================================================
2.7 - SET PLUGIN VARS AGAIN
================================================================================
# GLOBAL
SET GLOBAL example_ulong_var = 200;
SET GLOBAL example_enum_var = e2;
SET GLOBAL example_double_var = 200.8880;
SET GLOBAL example_double_thdvar = 201.8881;
# SESSION
SET SESSION example_double_thdvar = 202.8882;

================================================================================
2.8 - VERIFY PLUGIN VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 1, ulong_var is 200, double_var is 200.888000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 1, ulong_var is 200, double_var is 200.888000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	201.888100
example_double_var	200.888000
example_enum_var	e2
example_ulong_var	200

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	202.888200
example_double_var	200.888000
example_enum_var	e2
example_ulong_var	200

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 1, ulong_var is 200, double_var is 200.888000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 1, ulong_var is 200, double_var is 200.888000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e2
EXAMPLE_DOUBLE_THDVAR	201.888100
EXAMPLE_ULONG_VAR	200
EXAMPLE_DOUBLE_VAR	200.888000

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e2
EXAMPLE_DOUBLE_THDVAR	202.888200
EXAMPLE_ULONG_VAR	200
EXAMPLE_DOUBLE_VAR	200.888000

================================================================================
2.9 - UNINSTALL PLUGIN
================================================================================
UNINSTALL PLUGIN example;

================================================================================
2.10 - VERIFY NO PLUGIN VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

================================================================================
TEST 3 - SESSION PLUGIN VARS ON MULTIPLE CONNECTIONS
================================================================================

================================================================================
3.1 - INSTALL PLUGIN
================================================================================
INSTALL PLUGIN example SONAME 'ha_example.so';

================================================================================
3.2 - SET GLOBAL AND DEFAULT CONNECTION VARS
================================================================================
connection default;
SET GLOBAL example_ulong_var = 300;
SET GLOBAL example_enum_var = e1;
SET GLOBAL example_double_var = 301.0000;
SET GLOBAL example_double_thdvar = 302.0000;
SET SESSION example_double_thdvar = 300.0000;

================================================================================
3.3 - CONNECT 3 CLIENTS, SET LOCAL PLUGIN VARS
================================================================================
connect con1, localhost, root,,;
SET SESSION example_double_thdvar = 300.1111;

connect con2, localhost, root,,;
SET SESSION example_double_thdvar = 300.2222;

connect con3, localhost, root,,;
SET SESSION example_double_thdvar = 300.3333;

connection default;

================================================================================
3.4 - VERIFY GLOBAL AND SESSION PLUGIN VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	302.000000
example_double_var	301.000000
example_enum_var	e1
example_ulong_var	300

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	300.000000
example_double_var	301.000000
example_enum_var	e1
example_ulong_var	300

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	302.000000
EXAMPLE_ULONG_VAR	300
EXAMPLE_DOUBLE_VAR	301.000000

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	300.000000
EXAMPLE_ULONG_VAR	300
EXAMPLE_DOUBLE_VAR	301.000000

# Variables by thread
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread
WHERE variable_name LIKE "example_%" ORDER BY variable_value;
variable_name	variable_value
example_double_thdvar	300.000000
example_double_thdvar	300.111100
example_double_thdvar	300.222200
example_double_thdvar	300.333300

================================================================================
3.5 - DISCONNECT CLIENTS
================================================================================
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection default;

================================================================================
3.6 - VERIFY SESSION VARS ARE REMOVED
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	302.000000
example_double_var	301.000000
example_enum_var	e1
example_ulong_var	300

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	300.000000
example_double_var	301.000000
example_enum_var	e1
example_ulong_var	300

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	302.000000
EXAMPLE_ULONG_VAR	300
EXAMPLE_DOUBLE_VAR	301.000000

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	300.000000
EXAMPLE_ULONG_VAR	300
EXAMPLE_DOUBLE_VAR	301.000000

# Variables by thread
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread
WHERE variable_name LIKE "example_%" ORDER BY variable_value;
variable_name	variable_value
example_double_thdvar	300.000000

================================================================================
3.7 - RECONNECT 3 CLIENTS, SET SESSION VARS FOR EACH
================================================================================
connect con1, localhost, root,,;
SET SESSION example_double_thdvar = 311.1111;

connect con2, localhost, root,,;
SET SESSION example_double_thdvar = 322.2222;

connect con3, localhost, root,,;
SET SESSION example_double_thdvar = 333.3333;

connection default;

================================================================================
3.8 - VERIFY GLOBAL AND SESSION VARS
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value
example_func_example	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
example_status_array_var1	100
example_status_array_var2	20.010000
example_status_var3	three hundred
example_status_var4	ON
example_status_var5	OFF
example_status_var6	8250

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	302.000000
example_double_var	301.000000
example_enum_var	e1
example_ulong_var	300

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value
example_double_thdvar	300.000000
example_double_var	301.000000
example_enum_var	e1
example_ulong_var	300

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_FUNC_EXAMPLE	enum_var is 0, ulong_var is 300, double_var is 301.000000, really
EXAMPLE_STATUS_ARRAY_VAR1	100
EXAMPLE_STATUS_ARRAY_VAR2	20.010000
EXAMPLE_STATUS_VAR3	three hundred
EXAMPLE_STATUS_VAR4	ON
EXAMPLE_STATUS_VAR5	OFF
EXAMPLE_STATUS_VAR6	8250

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	302.000000
EXAMPLE_ULONG_VAR	300
EXAMPLE_DOUBLE_VAR	301.000000

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value
EXAMPLE_ENUM_VAR	e1
EXAMPLE_DOUBLE_THDVAR	300.000000
EXAMPLE_ULONG_VAR	300
EXAMPLE_DOUBLE_VAR	301.000000

# Variables by thread
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread
WHERE variable_name LIKE "example_%" ORDER BY variable_value;
variable_name	variable_value
example_double_thdvar	300.000000
example_double_thdvar	311.111100
example_double_thdvar	322.222200
example_double_thdvar	333.333300

================================================================================
3.9 - UNINSTALL PLUGIN, LEAVE CLIENTS CONNECTED
================================================================================
UNINSTALL PLUGIN example;

================================================================================
3.10 - VERIFY SESSION VARS ARE REMOVED
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

# VARIABLES BY THREAD
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread
WHERE variable_name LIKE "example_%" ORDER BY variable_value;
variable_name	variable_value

================================================================================
3.11 - DISCONNECT CLIENTS
================================================================================
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection default;

================================================================================
3.12 - VERIFY CLIENTS ARE REMOVED
================================================================================

SHOW GLOBAL STATUS LIKE "example_%";
Variable_name	Value

SHOW SESSION STATUS LIKE "example_%";
Variable_name	Value

SHOW GLOBAL VARIABLES LIKE "example_%";
Variable_name	Value

SHOW SESSION VARIABLES LIKE "example_%";
Variable_name	Value

SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
variable_name	variable_value

# VARIABLES BY THREAD
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread
WHERE variable_name LIKE "example_%" ORDER BY variable_value;
variable_name	variable_value

================================================================================
TEST 4 - BUG#18008907: DEADLOCK WITH CHANGE_USER, SHOW VARIABLES, INSTALL PLUGIN
================================================================================

CREATE PROCEDURE install_no_such_plugin()
BEGIN
INSTALL PLUGIN no_such_plugin SONAME 'no_such_object';
END|

CREATE PROCEDURE show_vars()
BEGIN
-- select on information_schema.global_variables
-- will fail, still need to cover execution of the code
-- to verify potential dead locks.
declare continue handler for sqlexception
begin
end;
SELECT COUNT(*) FROM information_schema.global_variables;
SELECT COUNT(*) FROM performance_schema.global_variables;
END|

================================================================================
4.1 - DEADLOCK SCENARIO 1:
con1 - has LOCK_system_variables_hash and waits on LOCK_plugin AND
default - has LOCK_plugin and waits on LOCK_system_variables_hash
================================================================================
connect con1, localhost, root,,;
SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR cont_show_vars';
call show_vars();;
connection default;
SET DEBUG_SYNC='now WAIT_FOR install_plugin';
SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL cont_show_vars';
call install_no_such_plugin();;
connection con1;

# Without fix, reap will hang.
COUNT(*)
#
COUNT(*)
#
SET DEBUG_SYNC='RESET';
connection default;
ERROR HY000: Can't open shared library

SET DEBUG_SYNC='RESET';

================================================================================
4.2 - DEADLOCK SCENARIO 2:
default - has LOCK_system_variables_hash, waits on LOCK_global_system_variables
con1 - has LOCK_plugin, waits on LOCK_system_variables_hash AND
con2 - has LOCK_global_system_variables, waits on LOCK_plugin
================================================================================
SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR nothing TIMEOUT 10';
call show_vars();;
connection con1;
SET DEBUG_SYNC='now WAIT_FOR install_plugin';
SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL create_connection WAIT_FOR nothing TIMEOUT 10';
call install_no_such_plugin();;
connect con2, localhost, root,,;
SET DEBUG_SYNC='now WAIT_FOR create_connection';

# Without fix, deadlock situation will occur on timeout of debug_syncs in
# default and con1.  Because of this, change_user operation hangs.
change_user
connection con1;
ERROR HY000: Can't open shared library

connection default;
COUNT(*)
#
COUNT(*)
#

disconnect con2;

================================================================================
4.3 - DEADLOCK SCENARIO 3: CONCURRENT SHOW VARIABLES AND UNINSTALL PLUGIN
================================================================================
#
# INSTALL PLUGIN
#
INSTALL PLUGIN example SONAME 'ha_example.so';
connection con1;

# Acquiring LOCK_system_variables_hash and LOCK_plugin_delete
SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL uninstall_plugin WAIT_FOR go';
call show_vars();;
connect con2, localhost, root,,;
#
# UNINSTALL PLUGIN
#
SET DEBUG_SYNC='now WAIT_FOR uninstall_plugin';
UNINSTALL PLUGIN example;;
connection default;

# Uninstall will wait until SHOW VARIABLES releases LOCK_plugin_delete.
SET DEBUG_SYNC='now SIGNAL go';
# Connect con1 - reap
connection con1;
COUNT(*)
#
COUNT(*)
#
# Connect con2 - reap
connection con2;

================================================================================
CLEAN UP
================================================================================
connection default;

DROP PROCEDURE show_vars;
DROP PROCEDURE install_no_such_plugin;
SET DEBUG_SYNC='RESET';

disconnect con1;
disconnect con2;

# Restore SHOW_COMPATIBILITY_56 setting
SET @@global.show_compatibility_56 = @show_compatibility_56_save;

# Wait till we reached the initial number of concurrent sessions