Debian Codegraph @

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

raw
1 --echo ##
2 --echo ## Test the Performance Schema-based implementation of SHOW PROCESSLIST.
3 --echo ## Verify behavior for regular users and PROCESS_ACL.
4 --echo ##
5
6 --source include/no_protocol.inc
7 --source include/not_embedded.inc
8
9 SELECT @@global.performance_schema_show_processlist INTO @save_processlist;
10
11 --source include/add_anonymous_users.inc
12
13 SET @@global.performance_schema_show_processlist = OFF;
14
15 CREATE USER 'regular'@'localhost';
16
17 connect (reg,localhost,regular,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
18
19 SHOW GRANTS;
20
21 # Self rows only
22 SELECT USER, INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
23
24 # Self rows only
25 SELECT USER, INFO FROM performance_schema.processlist;
26
27 # Self rows only
28 --disable_result_log
29 SHOW PROCESSLIST;
30 --enable_result_log
31
32 SELECT "Previous statement is now completed." as status;
33
34 connection default;
35
36 # Returns ROWS_SENT = 0 even when SHOW PROCESSLIST has rows
37 SELECT EVENT_NAME, SQL_TEXT, ROWS_SENT as BROKEN_ROWS_SENT
38 FROM performance_schema.events_statements_history
39 WHERE SQL_TEXT = "SHOW PROCESSLIST";
40
41 TRUNCATE TABLE performance_schema.events_statements_history;
42 SET @@global.performance_schema_show_processlist = ON;
43
44 connection reg;
45
46 SHOW GRANTS;
47
48 # Self rows only
49 SELECT USER, INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
50
51 # Self rows only
52 SELECT USER, INFO FROM performance_schema.processlist;
53
54 # Self rows only
55 --disable_result_log
56 SHOW PROCESSLIST;
57 --enable_result_log
58
59 SELECT "Previous statement is now completed." as status;
60
61 connection default;
62
63 SELECT EVENT_NAME, SQL_TEXT, ROWS_SENT
64 FROM performance_schema.events_statements_history
65 WHERE SQL_TEXT = "SHOW PROCESSLIST";
66
67 TRUNCATE TABLE performance_schema.events_statements_history;
68
69 disconnect reg;
70
71 GRANT PROCESS ON *.* TO 'regular'@'localhost';
72
73 SET @@global.performance_schema_show_processlist = OFF;
74
75 connect (reg2,localhost,regular,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
76
77 SHOW GRANTS;
78
79 # Full rows
80 SELECT count(*) >= 2 FROM INFORMATION_SCHEMA.PROCESSLIST;
81
82 # Full rows
83 SELECT count(*) >= 2 FROM performance_schema.processlist;
84
85 # Full rows
86 --disable_result_log
87 SHOW PROCESSLIST;
88 --enable_result_log
89
90 SELECT "Previous statement is now completed." as status;
91
92 connection default;
93
94 # Returns ROWS_SENT = 0 even when SHOW PROCESSLIST has rows
95 SELECT EVENT_NAME, SQL_TEXT, ROWS_SENT as BROKEN_ROWS_SENT
96 FROM performance_schema.events_statements_history
97 WHERE SQL_TEXT = "SHOW PROCESSLIST";
98
99 TRUNCATE TABLE performance_schema.events_statements_history;
100 SET @@global.performance_schema_show_processlist = ON;
101
102 connection reg2;
103
104 SHOW GRANTS;
105
106 # Full rows
107 SELECT count(*) >= 2 FROM INFORMATION_SCHEMA.PROCESSLIST;
108
109 # Full rows
110 SELECT count(*) >= 2 FROM performance_schema.processlist;
111
112 # Full rows
113 --disable_result_log
114 SHOW PROCESSLIST;
115 --enable_result_log
116
117 SELECT "Previous statement is now completed." as status;
118
119 connection default;
120
121 SELECT EVENT_NAME, SQL_TEXT, ROWS_SENT >= 2
122 FROM performance_schema.events_statements_history
123 WHERE SQL_TEXT = "SHOW PROCESSLIST";
124
125 TRUNCATE TABLE performance_schema.events_statements_history;
126
127 disconnect reg2;
128
129 --source include/delete_anonymous_users.inc
130
131 SET @@global.performance_schema_show_processlist = @save_processlist;
132
133 DROP USER 'regular'@'localhost';
134