blob: ef2acc995d522bd2cb0ca9d3f8cc05916bedfa02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# Copyright (C) 2009 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Tests for PERFORMANCE_SCHEMA
--disable_warnings
drop table if exists test.t1;
--enable_warnings
## The result of show grants is not consistent across platforms ...
## show grants;
## Not enforced yet: deny CREATE_ACL and DROP_ACL
## Waiting to remove .FRM files first
##
## --error ER_DBACCESS_DENIED_ERROR
## create table performance_schema.t1(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
## drop table performance_schema.t1;
##
## --error ER_DBACCESS_DENIED_ERROR
## create table performance_schema.SETUP_INSTRUMENTS(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
## create table performance_schema.EVENTS_WAITS_CURRENT(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
## create table performance_schema.FILE_INSTANCES(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
## drop table performance_schema.SETUP_INSTRUMENTS;
##
## --error ER_DBACCESS_DENIED_ERROR
## drop table performance_schema.EVENTS_WAITS_CURRENT;
##
## --error ER_DBACCESS_DENIED_ERROR
## drop table performance_schema.FILE_INSTANCES;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.SETUP_INSTRUMENTS to test.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.FILE_INSTANCES to test.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.FILE_INSTANCES to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.SETUP_INSTRUMENTS
to performance_schema.EVENTS_WAITS_CURRENT;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.EVENTS_WAITS_CURRENT
to performance_schema.SETUP_INSTRUMENTS;
--error ER_DBACCESS_DENIED_ERROR
create procedure performance_schema.my_proc() begin end;
--error ER_DBACCESS_DENIED_ERROR
create function performance_schema.my_func() returns int return 0;
--error ER_DBACCESS_DENIED_ERROR
create event performance_schema.my_event on schedule every 15 minute
do begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_setup_instruments
before insert on performance_schema.SETUP_INSTRUMENTS
for each row begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_events_waits_current
before insert on performance_schema.EVENTS_WAITS_CURRENT
for each row begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_file_instances
before insert on performance_schema.FILE_INSTANCES
for each row begin end;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1 like performance_schema.SETUP_INSTRUMENTS;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1 like performance_schema.FILE_INSTANCES;
--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
insert into performance_schema.SETUP_INSTRUMENTS
set name="foo";
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
insert into performance_schema.EVENTS_WAITS_CURRENT
set name="foo";
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
insert into performance_schema.FILE_INSTANCES
set name="foo";
--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
delete from performance_schema.SETUP_INSTRUMENTS;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
delete from performance_schema.EVENTS_WAITS_CURRENT;
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
delete from performance_schema.FILE_INSTANCES;
lock table performance_schema.SETUP_INSTRUMENTS read;
unlock tables;
lock table performance_schema.SETUP_INSTRUMENTS write;
unlock tables;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.EVENTS_WAITS_CURRENT read;
unlock tables;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.EVENTS_WAITS_CURRENT write;
unlock tables;
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.FILE_INSTANCES read;
unlock tables;
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.FILE_INSTANCES write;
unlock tables;
--echo #
--echo # WL#4818, NFS2: Can use grants to give normal user access
--echo # to view data from _CURRENT and _HISTORY tables
--echo #
--echo # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
--echo # (Except for EVENTS_WAITS_CURRENT, which is granted.)
# Errors here will be caught by the diff afterwards
--disable_abort_on_error
--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1;
--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1;
--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1;
--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1;
--enable_abort_on_error
|