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