Debian Codegraph @

mysql-test/suite/plugins/t/feedback_plugin_load.test

raw
1 if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'feedback' and plugin_status='active'`)
2 {
3 --skip Feedback plugin is not active
4 }
5 if (`select @@feedback_url = ""`)
6 {
7 --skip Feedback plugin is not active
8 }
9
10 select plugin_status from information_schema.plugins where plugin_name='feedback';
11
12 # Every SELECT from INFORMATION_SCHEMA.FEEDBACK increases the value of 'FEEDBACK used'.
13 # We cannot record the actual value, because the test can be executed more than once,
14 # but we can check that the value indeed increases as expected.
15 # There is still a room for some race condition, e.g. if at the very moment
16 # between first SELECT to store the value and the next SELECT to check that it increases,
17 # the feedback plugin is activated. But the probability of it is close to 0,
18 # so lets get back to it if it ever happens.
19
20 # Lets say the plugin was used X times before this SELECT
21 --disable_cursor_protocol
22 SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
23 --enable_cursor_protocol
24
25 # Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT
26 SELECT variable_value = @feedback_used + 1 as 'MUST BE 1' FROM information_schema.feedback where variable_name = 'FEEDBACK used';
27
28 # Now when we are happy with 'FEEDBACK used', we can check everything else
29
30 --replace_result https http
31 --sorted_result
32 select * from information_schema.feedback where variable_name like 'feed%'
33 and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
34 and variable_name not like '%debug%';
35
36 # Embedded server does not use the table mysqld.user and thus
37 # does not automatically use utf8mb4 on startup. Use it manually.
38 --disable_query_log
39 if (`SELECT VERSION() LIKE '%embedded%'`)
40 {
41 create temporary table t1 (a json);
42 }
43 --enable_query_log
44 SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK
45 WHERE VARIABLE_NAME LIKE 'Collation used %'
46 ORDER BY VARIABLE_NAME;
47
48 prepare stmt from "SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' ORDER BY VARIABLE_NAME";
49
50 execute stmt;
51 execute stmt;
52
53 deallocate prepare stmt;