Debian Codegraph @

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

raw
1 # Tests for PERFORMANCE_SCHEMA
2
3 # The query result are not re producible,
4 # due to variations in platforms and plugins
5 # We still execute the select statement, for:
6 # - code coverage
7 # - make sure it does not crash
8 # - valgrind coverage
9
10 --disable_result_log
11 select * from performance_schema.setup_instruments;
12 --enable_result_log
13
14 # DEBUG_SYNC::mutex is dependent on the build (DEBUG only)
15
16 select * from performance_schema.setup_instruments
17 where name like 'Wait/Synch/Mutex/sql/%'
18 and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex')
19 order by name limit 10;
20
21 # CRYPTO_dynlock_value::lock is dependent on the build (SSL)
22 # LOCK_named_pipe_full_access_group is dependent on the build (Windows only)
23
24 select * from performance_schema.setup_instruments
25 where name like 'Wait/Synch/Rwlock/sql/%'
26 and name not in (
27 'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
28 'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
29 order by name limit 10;
30
31 # COND_handler_count is dependent on the build (Windows only)
32 # DEBUG_SYNC::cond is dependent on the build (DEBUG only)
33 # COND_main_thread_in_use is dependent on the build (non Windows)
34 # COND_start_signal_handler is dependent on the build (non Windows)
35
36 select * from performance_schema.setup_instruments
37 where name like 'Wait/Synch/Cond/sql/%'
38 and name not in (
39 'wait/synch/cond/sql/COND_open',
40 'wait/synch/cond/sql/COND_handler_count',
41 'wait/synch/cond/sql/DEBUG_SYNC::cond',
42 'wait/synch/cond/sql/COND_socket_listener_active',
43 'wait/synch/cond/sql/COND_start_signal_handler')
44 order by name limit 10;
45
46 --disable_result_log
47 select * from performance_schema.setup_instruments
48 where name='Wait';
49 --enable_result_log
50
51 --disable_result_log
52 select * from performance_schema.setup_instruments
53 where enabled='YES';
54 --enable_result_log
55
56 --error ER_TABLEACCESS_DENIED_ERROR
57 insert into performance_schema.setup_instruments
58 set name='FOO', enabled='YES', timed='YES';
59
60 --error ER_WRONG_PERFSCHEMA_USAGE
61 update performance_schema.setup_instruments
62 set name='FOO';
63
64 update performance_schema.setup_instruments
65 set enabled='NO';
66
67 update performance_schema.setup_instruments
68 set timed='NO';
69
70 --disable_result_log
71 select * from performance_schema.setup_instruments;
72 --enable_result_log
73
74 update performance_schema.setup_instruments
75 set enabled='YES', timed='YES';
76
77 --error ER_TABLEACCESS_DENIED_ERROR
78 delete from performance_schema.setup_instruments;
79
80 --error ER_TABLEACCESS_DENIED_ERROR
81 delete from performance_schema.setup_instruments
82 where name like 'Wait/Synch/%';
83
84 LOCK TABLES performance_schema.setup_instruments READ;
85 UNLOCK TABLES;
86
87 LOCK TABLES performance_schema.setup_instruments WRITE;
88 UNLOCK TABLES;
89
90 --echo
91 --echo # Bug#13813193 ASSERTION `TABLE->READ_SET ==
92 --echo # &TABLE->DEF_READ_SET' FAILED / MYSQL_UPDATE
93 --echo
94 UPDATE performance_schema.setup_instruments SET timed='NO'
95 ORDER BY RAND();
96
97 # PROPERTIES column
98
99 --error ER_WRONG_PERFSCHEMA_USAGE
100 update performance_schema.setup_instruments
101 set PROPERTIES='singleton';
102
103 # Global instruments should not have controlled by default
104 # NOW() as fixme is to prevent recording 'exceptions' in .result
105 select NOW() as fixme, NAME, PROPERTIES, FLAGS
106 from performance_schema.setup_instruments
107 where NAME like 'memory/%'
108 AND (find_in_set('global_statistics', PROPERTIES) != 0)
109 AND (find_in_set('controlled_by_default', PROPERTIES) != 0);
110
111 # FLAGS column
112
113 select distinct FLAGS from performance_schema.setup_instruments
114 ORDER BY FLAGS;
115
116 # 'controlled_by_default' are 'controlled'
117 select distinct FLAGS from performance_schema.setup_instruments
118 WHERE (find_in_set('controlled_by_default', PROPERTIES) != 0);
119
120 # Not 'controlled_by_default' are not 'controlled'
121 select distinct FLAGS from performance_schema.setup_instruments
122 WHERE (find_in_set('controlled_by_default', PROPERTIES) = 0);
123
124 select * from performance_schema.setup_instruments
125 WHERE (FLAGS IS NULL) AND (NAME LIKE "memory/%");
126
127 select * from performance_schema.setup_instruments
128 WHERE (FLAGS IS NOT NULL) AND (NAME NOT LIKE "memory/%");
129
130 --disable_result_log
131 # WARN_DATA_TRUNCATED, prints a row number
132 --error 1265
133 update performance_schema.setup_instruments
134 set FLAGS='garbage' where name like "wait/%";
135 --enable_result_log
136
137 select distinct FLAGS from performance_schema.setup_instruments
138 where name like "wait/%";
139
140 update performance_schema.setup_instruments
141 set FLAGS = NULL where name like "wait/%";
142
143 select distinct FLAGS from performance_schema.setup_instruments
144 where name like "wait/%";
145
146 update performance_schema.setup_instruments
147 set FLAGS = '' where name like "wait/%";
148
149 select distinct FLAGS from performance_schema.setup_instruments
150 where name like "wait/%";
151
152 update performance_schema.setup_instruments
153 set FLAGS = 'controlled' where name like "wait/%";
154
155 select distinct FLAGS from performance_schema.setup_instruments
156 where name like "wait/%";
157
158 --disable_result_log
159 # WARN_DATA_TRUNCATED, prints a row number
160 --error 1265
161 update performance_schema.setup_instruments
162 set FLAGS = 'garbage' where name like "memory/%";
163 --enable_result_log
164
165 select distinct FLAGS from performance_schema.setup_instruments
166 where name like "memory/%";
167
168 update performance_schema.setup_instruments
169 set FLAGS = NULL where name like "memory/%";
170
171 select distinct FLAGS from performance_schema.setup_instruments
172 where name like "memory/%";
173
174 update performance_schema.setup_instruments
175 set FLAGS = '' where name like "memory/%";
176
177 select distinct FLAGS from performance_schema.setup_instruments
178 where name like "memory/%";
179
180 # Set the controlled flag on everything,
181 # and see on which instruments it is actually set.
182 update performance_schema.setup_instruments
183 set FLAGS = 'controlled' where name like "memory/%";
184
185 # Global instruments are never controlled,
186 select count(*) from performance_schema.setup_instruments
187 where name like "memory/%"
188 and (find_in_set('global_statistics', PROPERTIES) != 0)
189 and (FLAGS = 'controlled');
190
191 # session instruments are controlled
192 select count(*) from performance_schema.setup_instruments
193 where name like "memory/%"
194 and (find_in_set('global_statistics', PROPERTIES) = 0)
195 and (find_in_set('controlled', FLAGS) = 0);
196
197 # Test cleanup
198
199 update performance_schema.setup_instruments
200 set enabled='YES', TIMED='YES';
201
202 update performance_schema.setup_instruments
203 set FLAGS = '';
204
205 update performance_schema.setup_instruments
206 set FLAGS = 'controlled'
207 where (find_in_set('controlled_by_default', PROPERTIES));
208
209