Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 0715a36

Browse files
Bug #23335880 - PS_SETUP_SHOW_ENABLED AND PS_SETUP_SHOW_DISABLED AND COMPANY ISSUES
Fixes several issues in the six stored procedures to show the enabled or disabled Performance Schema setup: * Enabled and disabled accounts are shown as host@user * Disabled users in ps_setup_show_disabled are called enabled_users * There is no explicit ordering; this can cause random changes in the output which also affects testing, e.g. the sysschem.pr_ps_setup_show_enabled test is randomly failing * Disabled users is only available for 5.7.6+ * setup_actors are not filtered either (all rows returned whether the actor is enabled or disabled) Also added several tests and improved the existing.
1 parent c2beae2 commit 0715a36

19 files changed

+797
-2038
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4716,6 +4716,9 @@ Query OK, 0 rows affected (0.32 sec)
47164716

47174717
Shows all currently disable Performance Schema configuration.
47184718

4719+
Disabled users is only available for MySQL 5.7.6 and later.
4720+
In earlier versions it was only possible to enable users.
4721+
47194722
##### Parameters
47204723

47214724
* in_show_instruments (BOOLEAN): Whether to print disabled instruments (can print many items)
@@ -4732,7 +4735,7 @@ mysql> CALL sys.ps_setup_show_disabled(TRUE, TRUE);
47324735
1 row in set (0.00 sec)
47334736
47344737
+--------------------+
4735-
| enabled_users |
4738+
| disabled_users |
47364739
+--------------------+
47374740
| 'mark'@'localhost' |
47384741
+--------------------+
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
INSERT INTO performance_schema.setup_actors
2+
VALUES ('localhost', 'foo', '%', 'YES', 'YES'),
3+
('localhost', 'bar', '%', 'NO', 'NO');
4+
UPDATE performance_schema.setup_instruments
5+
SET ENABLED = 'NO'
6+
WHERE NAME LIKE 'stage/innodb/%'
7+
OR NAME LIKE 'statement/com/%'
8+
OR NAME = 'idle';
9+
UPDATE performance_schema.setup_consumers
10+
SET ENABLED = 'NO'
11+
WHERE NAME LIKE '%\_history\_long';
12+
UPDATE performance_schema.threads SET INSTRUMENTED = 'NO' WHERE NAME LIKE 'thread/innodb/srv\_%';
13+
CALL sys.ps_setup_show_disabled(FALSE, FALSE);
14+
performance_schema_enabled
15+
1
16+
disabled_users
17+
'bar'@'localhost'
18+
object_type objects enabled timed
19+
EVENT information_schema.% NO NO
20+
EVENT mysql.% NO NO
21+
EVENT performance_schema.% NO NO
22+
FUNCTION information_schema.% NO NO
23+
FUNCTION mysql.% NO NO
24+
FUNCTION performance_schema.% NO NO
25+
PROCEDURE information_schema.% NO NO
26+
PROCEDURE mysql.% NO NO
27+
PROCEDURE performance_schema.% NO NO
28+
TABLE information_schema.% NO NO
29+
TABLE mysql.% NO NO
30+
TABLE performance_schema.% NO NO
31+
TRIGGER information_schema.% NO NO
32+
TRIGGER mysql.% NO NO
33+
TRIGGER performance_schema.% NO NO
34+
disabled_consumers
35+
events_stages_history_long
36+
events_statements_history_long
37+
events_transactions_history_long
38+
events_waits_history_long
39+
CALL sys.ps_setup_show_disabled(TRUE, FALSE);
40+
performance_schema_enabled
41+
1
42+
disabled_users
43+
'bar'@'localhost'
44+
object_type objects enabled timed
45+
EVENT information_schema.% NO NO
46+
EVENT mysql.% NO NO
47+
EVENT performance_schema.% NO NO
48+
FUNCTION information_schema.% NO NO
49+
FUNCTION mysql.% NO NO
50+
FUNCTION performance_schema.% NO NO
51+
PROCEDURE information_schema.% NO NO
52+
PROCEDURE mysql.% NO NO
53+
PROCEDURE performance_schema.% NO NO
54+
TABLE information_schema.% NO NO
55+
TABLE mysql.% NO NO
56+
TABLE performance_schema.% NO NO
57+
TRIGGER information_schema.% NO NO
58+
TRIGGER mysql.% NO NO
59+
TRIGGER performance_schema.% NO NO
60+
disabled_consumers
61+
events_stages_history_long
62+
events_statements_history_long
63+
events_transactions_history_long
64+
events_waits_history_long
65+
disabled_instruments timed
66+
idle YES
67+
stage/innodb/alter table (end) YES
68+
stage/innodb/alter table (flush) YES
69+
stage/innodb/alter table (insert) YES
70+
stage/innodb/alter table (log apply index) YES
71+
stage/innodb/alter table (log apply table) YES
72+
stage/innodb/alter table (merge sort) YES
73+
stage/innodb/alter table (read PK and internal sort) YES
74+
stage/innodb/buffer pool load YES
75+
statement/com/Binlog Dump YES
76+
statement/com/Binlog Dump GTID YES
77+
statement/com/Change user YES
78+
statement/com/Close stmt YES
79+
statement/com/Connect YES
80+
statement/com/Connect Out YES
81+
statement/com/Create DB YES
82+
statement/com/Daemon YES
83+
statement/com/Debug YES
84+
statement/com/Delayed insert YES
85+
statement/com/Drop DB YES
86+
statement/com/Error YES
87+
statement/com/Execute YES
88+
statement/com/Fetch YES
89+
statement/com/Field List YES
90+
statement/com/Init DB YES
91+
statement/com/Kill YES
92+
statement/com/Long Data YES
93+
statement/com/Ping YES
94+
statement/com/Prepare YES
95+
statement/com/Processlist YES
96+
statement/com/Quit YES
97+
statement/com/Refresh YES
98+
statement/com/Register Slave YES
99+
statement/com/Reset Connection YES
100+
statement/com/Reset stmt YES
101+
statement/com/Set option YES
102+
statement/com/Shutdown YES
103+
statement/com/Sleep YES
104+
statement/com/Statistics YES
105+
statement/com/Table Dump YES
106+
statement/com/Time YES
107+
CALL sys.ps_setup_show_disabled(FALSE, TRUE);
108+
performance_schema_enabled
109+
1
110+
disabled_users
111+
'bar'@'localhost'
112+
object_type objects enabled timed
113+
EVENT information_schema.% NO NO
114+
EVENT mysql.% NO NO
115+
EVENT performance_schema.% NO NO
116+
FUNCTION information_schema.% NO NO
117+
FUNCTION mysql.% NO NO
118+
FUNCTION performance_schema.% NO NO
119+
PROCEDURE information_schema.% NO NO
120+
PROCEDURE mysql.% NO NO
121+
PROCEDURE performance_schema.% NO NO
122+
TABLE information_schema.% NO NO
123+
TABLE mysql.% NO NO
124+
TABLE performance_schema.% NO NO
125+
TRIGGER information_schema.% NO NO
126+
TRIGGER mysql.% NO NO
127+
TRIGGER performance_schema.% NO NO
128+
disabled_consumers
129+
events_stages_history_long
130+
events_statements_history_long
131+
events_transactions_history_long
132+
events_waits_history_long
133+
disabled_threads thread_type
134+
innodb/srv_error_monitor_thread BACKGROUND
135+
innodb/srv_lock_timeout_thread BACKGROUND
136+
innodb/srv_master_thread BACKGROUND
137+
innodb/srv_monitor_thread BACKGROUND
138+
innodb/srv_purge_thread BACKGROUND
139+
innodb/srv_worker_thread BACKGROUND
140+
innodb/srv_worker_thread BACKGROUND
141+
innodb/srv_worker_thread BACKGROUND
142+
CALL sys.ps_setup_show_disabled(TRUE, TRUE);
143+
performance_schema_enabled
144+
1
145+
disabled_users
146+
'bar'@'localhost'
147+
object_type objects enabled timed
148+
EVENT information_schema.% NO NO
149+
EVENT mysql.% NO NO
150+
EVENT performance_schema.% NO NO
151+
FUNCTION information_schema.% NO NO
152+
FUNCTION mysql.% NO NO
153+
FUNCTION performance_schema.% NO NO
154+
PROCEDURE information_schema.% NO NO
155+
PROCEDURE mysql.% NO NO
156+
PROCEDURE performance_schema.% NO NO
157+
TABLE information_schema.% NO NO
158+
TABLE mysql.% NO NO
159+
TABLE performance_schema.% NO NO
160+
TRIGGER information_schema.% NO NO
161+
TRIGGER mysql.% NO NO
162+
TRIGGER performance_schema.% NO NO
163+
disabled_consumers
164+
events_stages_history_long
165+
events_statements_history_long
166+
events_transactions_history_long
167+
events_waits_history_long
168+
disabled_threads thread_type
169+
innodb/srv_error_monitor_thread BACKGROUND
170+
innodb/srv_lock_timeout_thread BACKGROUND
171+
innodb/srv_master_thread BACKGROUND
172+
innodb/srv_monitor_thread BACKGROUND
173+
innodb/srv_purge_thread BACKGROUND
174+
innodb/srv_worker_thread BACKGROUND
175+
innodb/srv_worker_thread BACKGROUND
176+
innodb/srv_worker_thread BACKGROUND
177+
disabled_instruments timed
178+
idle YES
179+
stage/innodb/alter table (end) YES
180+
stage/innodb/alter table (flush) YES
181+
stage/innodb/alter table (insert) YES
182+
stage/innodb/alter table (log apply index) YES
183+
stage/innodb/alter table (log apply table) YES
184+
stage/innodb/alter table (merge sort) YES
185+
stage/innodb/alter table (read PK and internal sort) YES
186+
stage/innodb/buffer pool load YES
187+
statement/com/Binlog Dump YES
188+
statement/com/Binlog Dump GTID YES
189+
statement/com/Change user YES
190+
statement/com/Close stmt YES
191+
statement/com/Connect YES
192+
statement/com/Connect Out YES
193+
statement/com/Create DB YES
194+
statement/com/Daemon YES
195+
statement/com/Debug YES
196+
statement/com/Delayed insert YES
197+
statement/com/Drop DB YES
198+
statement/com/Error YES
199+
statement/com/Execute YES
200+
statement/com/Fetch YES
201+
statement/com/Field List YES
202+
statement/com/Init DB YES
203+
statement/com/Kill YES
204+
statement/com/Long Data YES
205+
statement/com/Ping YES
206+
statement/com/Prepare YES
207+
statement/com/Processlist YES
208+
statement/com/Quit YES
209+
statement/com/Refresh YES
210+
statement/com/Register Slave YES
211+
statement/com/Reset Connection YES
212+
statement/com/Reset stmt YES
213+
statement/com/Set option YES
214+
statement/com/Shutdown YES
215+
statement/com/Sleep YES
216+
statement/com/Statistics YES
217+
statement/com/Table Dump YES
218+
statement/com/Time YES
219+
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
220+
TRUNCATE TABLE performance_schema.setup_actors;
221+
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
222+
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
223+
UPDATE performance_schema.threads SET instrumented = 'YES';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
UPDATE performance_schema.setup_consumers
2+
SET ENABLED = 'NO'
3+
WHERE NAME LIKE '%\_history\_long';
4+
CALL sys.ps_setup_show_disabled_consumers();
5+
disabled_consumers
6+
events_stages_history_long
7+
events_statements_history_long
8+
events_transactions_history_long
9+
events_waits_history_long
10+
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
11+
TRUNCATE TABLE performance_schema.setup_actors;
12+
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
13+
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
14+
UPDATE performance_schema.threads SET instrumented = 'YES';
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
UPDATE performance_schema.setup_instruments
2+
SET ENABLED = 'NO'
3+
WHERE NAME LIKE 'stage/innodb/%'
4+
OR NAME LIKE 'statement/com/%'
5+
OR NAME = 'idle';
6+
CALL sys.ps_setup_show_disabled_instruments();
7+
disabled_instruments timed
8+
idle YES
9+
stage/innodb/alter table (end) YES
10+
stage/innodb/alter table (flush) YES
11+
stage/innodb/alter table (insert) YES
12+
stage/innodb/alter table (log apply index) YES
13+
stage/innodb/alter table (log apply table) YES
14+
stage/innodb/alter table (merge sort) YES
15+
stage/innodb/alter table (read PK and internal sort) YES
16+
stage/innodb/buffer pool load YES
17+
statement/com/Binlog Dump YES
18+
statement/com/Binlog Dump GTID YES
19+
statement/com/Change user YES
20+
statement/com/Close stmt YES
21+
statement/com/Connect YES
22+
statement/com/Connect Out YES
23+
statement/com/Create DB YES
24+
statement/com/Daemon YES
25+
statement/com/Debug YES
26+
statement/com/Delayed insert YES
27+
statement/com/Drop DB YES
28+
statement/com/Error YES
29+
statement/com/Execute YES
30+
statement/com/Fetch YES
31+
statement/com/Field List YES
32+
statement/com/Init DB YES
33+
statement/com/Kill YES
34+
statement/com/Long Data YES
35+
statement/com/Ping YES
36+
statement/com/Prepare YES
37+
statement/com/Processlist YES
38+
statement/com/Quit YES
39+
statement/com/Refresh YES
40+
statement/com/Register Slave YES
41+
statement/com/Reset Connection YES
42+
statement/com/Reset stmt YES
43+
statement/com/Set option YES
44+
statement/com/Shutdown YES
45+
statement/com/Sleep YES
46+
statement/com/Statistics YES
47+
statement/com/Table Dump YES
48+
statement/com/Time YES
49+
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
50+
TRUNCATE TABLE performance_schema.setup_actors;
51+
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES');
52+
UPDATE performance_schema.setup_consumers SET enabled = 'YES';
53+
UPDATE performance_schema.threads SET instrumented = 'YES';

0 commit comments

Comments
 (0)