diff options
author | Marc Alff <marc.alff@sun.com> | 2010-01-11 18:47:27 -0700 |
---|---|---|
committer | Marc Alff <marc.alff@sun.com> | 2010-01-11 18:47:27 -0700 |
commit | e0e0f9e3d46917fe9b611fc9769e64032c267446 (patch) | |
tree | c111d4c62b1e1eb7a74ec68860756418e29cb61e /mysql-test/suite | |
parent | 3d915225611a921fad03934e58bf281b48fc15b0 (diff) | |
download | mariadb-git-e0e0f9e3d46917fe9b611fc9769e64032c267446.tar.gz |
WL#2360 Performance schema
Part V: performance schema implementation
Diffstat (limited to 'mysql-test/suite')
186 files changed, 9015 insertions, 10 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result index 1cc9281f3fc..eba93c3ae14 100644 --- a/mysql-test/suite/binlog/r/binlog_database.result +++ b/mysql-test/suite/binlog/r/binlog_database.result @@ -116,4 +116,5 @@ Database information_schema mtr mysql +performance_schema test diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index 5ad12d953ab..1b36ce8f0d0 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -320,10 +320,10 @@ INSERT INTO t2 SET a = func_modify_t1(); SHOW BINLOG EVENTS FROM 12283; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 12283 Query 1 12351 BEGIN -master-bin.000001 12351 Table_map 1 12393 table_id: 44 (test.t2) -master-bin.000001 12393 Table_map 1 12435 table_id: 45 (test.t1) -master-bin.000001 12435 Write_rows 1 12473 table_id: 45 -master-bin.000001 12473 Write_rows 1 12511 table_id: 44 flags: STMT_END_F +master-bin.000001 12351 Table_map 1 12393 table_id: 62 (test.t2) +master-bin.000001 12393 Table_map 1 12435 table_id: 63 (test.t1) +master-bin.000001 12435 Write_rows 1 12473 table_id: 63 +master-bin.000001 12473 Write_rows 1 12511 table_id: 62 flags: STMT_END_F master-bin.000001 12511 Query 1 12580 COMMIT DROP TABLE t1,t2; DROP FUNCTION func_modify_t1; @@ -347,12 +347,12 @@ INSERT INTO t1 SET a = 2; SHOW BINLOG EVENTS FROM 13426; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 13426 Query 1 13494 BEGIN -master-bin.000001 13494 Table_map 1 13535 table_id: 47 (test.t1) -master-bin.000001 13535 Table_map 1 13577 table_id: 48 (test.t3) -master-bin.000001 13577 Table_map 1 13619 table_id: 49 (test.t2) -master-bin.000001 13619 Write_rows 1 13657 table_id: 49 -master-bin.000001 13657 Write_rows 1 13695 table_id: 48 -master-bin.000001 13695 Write_rows 1 13729 table_id: 47 flags: STMT_END_F +master-bin.000001 13494 Table_map 1 13535 table_id: 65 (test.t1) +master-bin.000001 13535 Table_map 1 13577 table_id: 66 (test.t3) +master-bin.000001 13577 Table_map 1 13619 table_id: 67 (test.t2) +master-bin.000001 13619 Write_rows 1 13657 table_id: 67 +master-bin.000001 13657 Write_rows 1 13695 table_id: 66 +master-bin.000001 13695 Write_rows 1 13729 table_id: 65 flags: STMT_END_F master-bin.000001 13729 Query 1 13798 COMMIT DROP TABLE t1,t2,t3; SET SESSION binlog_format = STATEMENT; diff --git a/mysql-test/suite/funcs_1/r/is_schemata.result b/mysql-test/suite/funcs_1/r/is_schemata.result index d96ad497da0..92e01814b0e 100644 --- a/mysql-test/suite/funcs_1/r/is_schemata.result +++ b/mysql-test/suite/funcs_1/r/is_schemata.result @@ -56,6 +56,7 @@ catalog_name schema_name sql_path def information_schema NULL def mtr NULL def mysql NULL +def performance_schema NULL def test NULL ############################################################################### # Testcases 3.2.9.2+3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information diff --git a/mysql-test/suite/jp/r/jp_create_db_sjis.result b/mysql-test/suite/jp/r/jp_create_db_sjis.result index fd66609b7bc..b7c09fbfbe9 100644 --- a/mysql-test/suite/jp/r/jp_create_db_sjis.result +++ b/mysql-test/suite/jp/r/jp_create_db_sjis.result @@ -13,6 +13,7 @@ information_schema “ú–{Œê ÆÎÝºÞ mysql +performance_schema test USE `ÆÎݺÞ`; USE `“ú–{Œê`; diff --git a/mysql-test/suite/jp/r/jp_create_db_ucs2.result b/mysql-test/suite/jp/r/jp_create_db_ucs2.result index 3a3316ecbaf..3832ff5a0c7 100644 --- a/mysql-test/suite/jp/r/jp_create_db_ucs2.result +++ b/mysql-test/suite/jp/r/jp_create_db_ucs2.result @@ -14,6 +14,7 @@ information_schema íÜíÝíÞ ŽÆŽÎŽÝŽºŽÞ mysql +performance_schema test USE `ŽÆŽÎŽÝŽºŽÞ`; USE `ÆüËܸì`; diff --git a/mysql-test/suite/jp/r/jp_create_db_ujis.result b/mysql-test/suite/jp/r/jp_create_db_ujis.result index 4d6561b88ce..d6bf31336fd 100644 --- a/mysql-test/suite/jp/r/jp_create_db_ujis.result +++ b/mysql-test/suite/jp/r/jp_create_db_ujis.result @@ -13,6 +13,7 @@ information_schema íÜíÝíÞ ŽÆŽÎŽÝŽºŽÞ mysql +performance_schema test USE `ŽÆŽÎŽÝŽºŽÞ`; USE `ÆüËܸì`; diff --git a/mysql-test/suite/jp/r/jp_create_db_utf8.result b/mysql-test/suite/jp/r/jp_create_db_utf8.result index 2f70903ac71..62202d43df0 100644 --- a/mysql-test/suite/jp/r/jp_create_db_utf8.result +++ b/mysql-test/suite/jp/r/jp_create_db_utf8.result @@ -13,6 +13,7 @@ information_schema 龔龖龗 ニホï¾ï½ºï¾ž mysql +performance_schema test USE `ニホï¾ï½ºï¾ž`; USE `日本語`; diff --git a/mysql-test/suite/perfschema/include/binlog_common.inc b/mysql-test/suite/perfschema/include/binlog_common.inc new file mode 100644 index 00000000000..10afe54ab5b --- /dev/null +++ b/mysql-test/suite/perfschema/include/binlog_common.inc @@ -0,0 +1,49 @@ +# 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 + +RESET MASTER; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; + +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; + +--disable_warnings +drop table if exists test.t1; +drop table if exists test.t2; +--enable_warnings + +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); + +insert into test.t1 + select thread_id from performance_schema.EVENTS_WAITS_CURRENT; + +insert into test.t2 + select name from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/rwlock/%"; + +drop table test.t1; +drop table test.t2; + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; + +--source include/show_binlog_events.inc + diff --git a/mysql-test/suite/perfschema/include/cleanup_helper.inc b/mysql-test/suite/perfschema/include/cleanup_helper.inc new file mode 100644 index 00000000000..5c2429ddb97 --- /dev/null +++ b/mysql-test/suite/perfschema/include/cleanup_helper.inc @@ -0,0 +1,25 @@ +# 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 + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; + +disconnect con1; +disconnect con2; +disconnect con3; + +connection default; + diff --git a/mysql-test/suite/perfschema/include/privilege.inc b/mysql-test/suite/perfschema/include/privilege.inc new file mode 100644 index 00000000000..ef2acc995d5 --- /dev/null +++ b/mysql-test/suite/perfschema/include/privilege.inc @@ -0,0 +1,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 + diff --git a/mysql-test/suite/perfschema/include/setup_helper.inc b/mysql-test/suite/perfschema/include/setup_helper.inc new file mode 100644 index 00000000000..8a2dfa86496 --- /dev/null +++ b/mysql-test/suite/perfschema/include/setup_helper.inc @@ -0,0 +1,54 @@ +# 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 + +let $MYSQLD_DATADIR= `select @@datadir`; +let $MYSQLD_TMPDIR= `select @@tmpdir`; + +--disable_query_log +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_CONSUMERS set enabled='YES'; +--enable_query_log + +connect (con1, localhost, root, , ); + +let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID in (select connection_id())`; + +connect (con2, localhost, root, , ); + +let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID in (select connection_id())`; + +connect (con3, localhost, root, , ); + +let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST + where ID in (select connection_id())`; + +connection default; + +--disable_query_log +prepare stmt_dump_events from + "select event_name, + left(source, locate(\":\", source)) as short_source, + operation, number_of_bytes + from performance_schema.EVENTS_WAITS_HISTORY_LONG + where thread_id=? order by event_id;"; + +prepare stmt_dump_thread from + "select name from performance_schema.PROCESSLIST where thread_id=? ;"; +--enable_query_log + diff --git a/mysql-test/suite/perfschema/include/start_server_common.inc b/mysql-test/suite/perfschema/include/start_server_common.inc new file mode 100644 index 00000000000..fa1cb953f59 --- /dev/null +++ b/mysql-test/suite/perfschema/include/start_server_common.inc @@ -0,0 +1,62 @@ +# Copyright (C) 2008-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 + +show databases; + +select count(*) from performance_schema.PERFORMANCE_TIMERS; +select count(*) from performance_schema.SETUP_CONSUMERS; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +select count(*) from performance_schema.SETUP_TIMERS; + +# Make sure we don't crash, no matter what the starting parameters are + +--disable_result_log +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +--enable_result_log + +# This has a stable output, printing the result: +show variables like "performance_schema%"; + +# This has an unrepeatable output, it does depends too much on +# - the platform hardware (sizeof structures, padding) +# - the compiler used (sizeof(enum)) +# - the platform header files (sizeof(size_t)) +# - the code path in the server (what gets executed and instrumented +# at runtime) + +--disable_result_log +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +--enable_result_log + diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result new file mode 100644 index 00000000000..598f9297cc5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/aggregate.result @@ -0,0 +1,101 @@ +"General cleanup" +drop table if exists t1; +update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO'; +update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS +set enabled = 'YES', timed = 'YES'; +create table t1 ( +id INT PRIMARY KEY, +b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); +update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; +set @dump_all=FALSE; +"Verifying file aggregate consistency" +SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) +OR @dump_all; +EVENT_NAME COUNT_READ SUM(i.COUNT_READ) +SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) +OR @dump_all; +EVENT_NAME COUNT_WRITE SUM(i.COUNT_WRITE) +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) +OR @dump_all; +EVENT_NAME SUM_NUMBER_OF_BYTES_READ SUM(i.SUM_NUMBER_OF_BYTES_READ) +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) +OR @dump_all; +EVENT_NAME SUM_NUMBER_OF_BYTES_WRITE SUM(i.SUM_NUMBER_OF_BYTES_WRITE) +"Verifying waits aggregate consistency (instance)" +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT) +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT)) +AND (MIN(i.MIN_TIMER_WAIT) != 0) +OR @dump_all; +EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT) +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT) +"Verifying waits aggregate consistency (thread)" +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT) +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT)) +AND (MIN(t.MIN_TIMER_WAIT) != 0) +OR @dump_all; +EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT) +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT)) +OR @dump_all; +EVENT_NAME MAX_TIMER_WAIT MAX(t.MAX_TIMER_WAIT) +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS +set enabled = 'YES', timed = 'YES'; +drop table test.t1; diff --git a/mysql-test/suite/perfschema/r/bad_option_1.result b/mysql-test/suite/perfschema/r/bad_option_1.result new file mode 100644 index 00000000000..02fd04afd33 --- /dev/null +++ b/mysql-test/suite/perfschema/r/bad_option_1.result @@ -0,0 +1,2 @@ +Found: unknown variable 'performance-schema-enabled=maybe' +Found: Aborting diff --git a/mysql-test/suite/perfschema/r/bad_option_2.result b/mysql-test/suite/perfschema/r/bad_option_2.result new file mode 100644 index 00000000000..d8fda2af3b6 --- /dev/null +++ b/mysql-test/suite/perfschema/r/bad_option_2.result @@ -0,0 +1 @@ +Found: ambiguous option '--performance-schema-max_=12' diff --git a/mysql-test/suite/perfschema/r/binlog_mix.result b/mysql-test/suite/perfschema/r/binlog_mix.result new file mode 100644 index 00000000000..b437f4eda1f --- /dev/null +++ b/mysql-test/suite/perfschema/r/binlog_mix.result @@ -0,0 +1,49 @@ +set binlog_format=mixed; +RESET MASTER; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +count(*) > 0 +1 +drop table if exists test.t1; +drop table if exists test.t2; +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); +insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +drop table test.t1; +drop table test.t2; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table if exists test.t1 +master-bin.000001 # Query # # use `test`; drop table if exists test.t2 +master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer) +master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128)) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table test.t1 +master-bin.000001 # Query # # use `test`; drop table test.t2 +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_row.result b/mysql-test/suite/perfschema/r/binlog_row.result new file mode 100644 index 00000000000..50a201a81d9 --- /dev/null +++ b/mysql-test/suite/perfschema/r/binlog_row.result @@ -0,0 +1,49 @@ +set binlog_format=row; +RESET MASTER; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +count(*) > 0 +1 +drop table if exists test.t1; +drop table if exists test.t2; +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); +insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +drop table test.t1; +drop table test.t2; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table if exists test.t1 +master-bin.000001 # Query # # use `test`; drop table if exists test.t2 +master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer) +master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128)) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table test.t1 +master-bin.000001 # Query # # use `test`; drop table test.t2 +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS) +master-bin.000001 # Update_rows # # table_id: # +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/perfschema/r/binlog_stmt.result b/mysql-test/suite/perfschema/r/binlog_stmt.result new file mode 100644 index 00000000000..cec46b20670 --- /dev/null +++ b/mysql-test/suite/perfschema/r/binlog_stmt.result @@ -0,0 +1,48 @@ +set binlog_format=statement; +RESET MASTER; +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%"; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT; +count(*) > 0 +1 +drop table if exists test.t1; +drop table if exists test.t2; +create table test.t1 (thread_id integer); +create table test.t2 (name varchar(128)); +insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +drop table test.t1; +drop table test.t2; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%"; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='NO' + where name like "wait/synch/rwlock/%" +master-bin.000001 # Query # # use `test`; drop table if exists test.t1 +master-bin.000001 # Query # # use `test`; drop table if exists test.t2 +master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer) +master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128)) +master-bin.000001 # Query # # use `test`; insert into test.t1 +select thread_id from performance_schema.EVENTS_WAITS_CURRENT +master-bin.000001 # Query # # use `test`; insert into test.t2 +select name from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%" +master-bin.000001 # Query # # use `test`; drop table test.t1 +master-bin.000001 # Query # # use `test`; drop table test.t2 +master-bin.000001 # Query # # use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/rwlock/%" diff --git a/mysql-test/suite/perfschema/r/cnf_option.result b/mysql-test/suite/perfschema/r/cnf_option.result new file mode 100644 index 00000000000..85adfb5113d --- /dev/null +++ b/mysql-test/suite/perfschema/r/cnf_option.result @@ -0,0 +1,6 @@ +show variables like 'performance_schema_max_thread_classes'; +Variable_name Value +performance_schema_max_thread_classes 12 +show variables like 'performance_schema_max_thread_instances'; +Variable_name Value +performance_schema_max_thread_instances 318 diff --git a/mysql-test/suite/perfschema/r/column_privilege.result b/mysql-test/suite/perfschema/r/column_privilege.result new file mode 100644 index 00000000000..7bbc59ac452 --- /dev/null +++ b/mysql-test/suite/perfschema/r/column_privilege.result @@ -0,0 +1,27 @@ +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION; +grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT +to 'pfs_user_5'@localhost; +grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS +to 'pfs_user_5'@localhost; +flush privileges; +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; +select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +select event_name from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT' +select thread_id, event_id, event_name +from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: SELECT command denied to user 'pfs_user_5'@'localhost' for column 'event_name' in table 'EVENTS_WAITS_CURRENT' +update performance_schema.SETUP_INSTRUMENTS set name='illegal'; +ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'name' in table 'SETUP_INSTRUMENTS' +update performance_schema.SETUP_INSTRUMENTS set timed='NO'; +ERROR 42000: UPDATE command denied to user 'pfs_user_5'@'localhost' for column 'timed' in table 'SETUP_INSTRUMENTS' +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost; +DROP USER 'pfs_user_5'@localhost; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/r/ddl_cond_instances.result b/mysql-test/suite/perfschema/r/ddl_cond_instances.result new file mode 100644 index 00000000000..33adcebaceb --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_cond_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.COND_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.COND_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_current.result b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result new file mode 100644 index 00000000000..a438c93affe --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_current.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_CURRENT; +ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result new file mode 100644 index 00000000000..748dc2f29cd --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_HISTORY; +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result new file mode 100644 index 00000000000..1a047a765f6 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_events_waits_history_long.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result new file mode 100644 index 00000000000..74fc4e1a640 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result new file mode 100644 index 00000000000..4a35565bae0 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_instance.result @@ -0,0 +1,7 @@ +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result new file mode 100644 index 00000000000..18d98006220 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_ews_by_thread_by_event_name.result @@ -0,0 +1,9 @@ +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index +ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_file_instances.result b/mysql-test/suite/perfschema/r/ddl_file_instances.result new file mode 100644 index 00000000000..21e65c62405 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_file_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.FILE_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result new file mode 100644 index 00000000000..2f21ef56832 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_fs_by_event_name.result @@ -0,0 +1,7 @@ +alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result new file mode 100644 index 00000000000..8e256d1fd8d --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_fs_by_instance.result @@ -0,0 +1,7 @@ +alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; +ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_mutex_instances.result b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result new file mode 100644 index 00000000000..35397a5294d --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_mutex_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.MUTEX_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.MUTEX_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_performance_timers.result b/mysql-test/suite/perfschema/r/ddl_performance_timers.result new file mode 100644 index 00000000000..5de8193b205 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_performance_timers.result @@ -0,0 +1,8 @@ +alter table performance_schema.PERFORMANCE_TIMERS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.PERFORMANCE_TIMERS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_processlist.result b/mysql-test/suite/perfschema/r/ddl_processlist.result new file mode 100644 index 00000000000..5a9eb766349 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_processlist.result @@ -0,0 +1,8 @@ +alter table performance_schema.PROCESSLIST add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.PROCESSLIST; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result new file mode 100644 index 00000000000..849d191b17f --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_rwlock_instances.result @@ -0,0 +1,8 @@ +alter table performance_schema.RWLOCK_INSTANCES add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.RWLOCK_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_consumers.result b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result new file mode 100644 index 00000000000..f141725ee1f --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_consumers.result @@ -0,0 +1,8 @@ +alter table performance_schema.SETUP_CONSUMERS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_CONSUMERS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_instruments.result b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result new file mode 100644 index 00000000000..42e54b587d8 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_instruments.result @@ -0,0 +1,8 @@ +alter table performance_schema.SETUP_INSTRUMENTS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_objects.result b/mysql-test/suite/perfschema/r/ddl_setup_objects.result new file mode 100644 index 00000000000..c0f00745963 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_objects.result @@ -0,0 +1,7 @@ +alter table performance_schema.SETUP_OBJECTS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_OBJECTS; +ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/ddl_setup_timers.result b/mysql-test/suite/perfschema/r/ddl_setup_timers.result new file mode 100644 index 00000000000..fc74730bd50 --- /dev/null +++ b/mysql-test/suite/perfschema/r/ddl_setup_timers.result @@ -0,0 +1,8 @@ +alter table performance_schema.SETUP_TIMERS add column foo integer; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +truncate table performance_schema.SETUP_TIMERS; +ERROR HY000: Invalid performance_schema usage. +ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' diff --git a/mysql-test/suite/perfschema/r/dml_cond_instances.result b/mysql-test/suite/perfschema/r/dml_cond_instances.result new file mode 100644 index 00000000000..8adc632b91b --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_cond_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.COND_INSTANCES limit 1; +NAME OBJECT_INSTANCE_BEGIN +# # +select * from performance_schema.COND_INSTANCES +where name='FOO'; +NAME OBJECT_INSTANCE_BEGIN +insert into performance_schema.COND_INSTANCES +set name='FOO', object_instance_begin=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +update performance_schema.COND_INSTANCES +set name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +delete from performance_schema.COND_INSTANCES +where name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +delete from performance_schema.COND_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +LOCK TABLES performance_schema.COND_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.COND_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'COND_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_current.result b/mysql-test/suite/perfschema/r/dml_events_waits_current.result new file mode 100644 index 00000000000..5cd0dba7ad1 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_events_waits_current.result @@ -0,0 +1,28 @@ +select * from performance_schema.EVENTS_WAITS_CURRENT +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_CURRENT +where event_name='FOO'; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +insert into performance_schema.EVENTS_WAITS_CURRENT +set thread_id='1', event_id=1, +event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +update performance_schema.EVENTS_WAITS_CURRENT +set timer_start=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +update performance_schema.EVENTS_WAITS_CURRENT +set timer_start=12 where thread_id=0; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.EVENTS_WAITS_CURRENT +where thread_id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history.result b/mysql-test/suite/perfschema/r/dml_events_waits_history.result new file mode 100644 index 00000000000..953922868fb --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_events_waits_history.result @@ -0,0 +1,36 @@ +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name='FOO'; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name like 'Wait/Synch/%' order by timer_wait limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY +where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +insert into performance_schema.EVENTS_WAITS_HISTORY +set thread_id='1', event_id=1, +event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +update performance_schema.EVENTS_WAITS_HISTORY +set timer_start=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +update performance_schema.EVENTS_WAITS_HISTORY +set timer_start=12 where thread_id=0; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +delete from performance_schema.EVENTS_WAITS_HISTORY +where thread_id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +delete from performance_schema.EVENTS_WAITS_HISTORY; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result new file mode 100644 index 00000000000..494469a0db8 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_events_waits_history_long.result @@ -0,0 +1,36 @@ +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name='FOO'; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name like 'Wait/Synch/%' order by timer_wait limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG +where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +# # # # # # # # NULL NULL NULL # NULL # NULL 0 +insert into performance_schema.EVENTS_WAITS_HISTORY_LONG +set thread_id='1', event_id=1, +event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +update performance_schema.EVENTS_WAITS_HISTORY_LONG +set timer_start=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +update performance_schema.EVENTS_WAITS_HISTORY_LONG +set timer_start=12 where thread_id=0; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG +where thread_id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result new file mode 100644 index 00000000000..675fba021fe --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result @@ -0,0 +1,28 @@ +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +where event_name like 'Wait/Synch/%' limit 1; +EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +where event_name='FOO'; +EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3, +avg_timer_wait=4, max_timer_wait=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +set count_star=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +set count_star=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +where count_star=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_instance.result b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result new file mode 100644 index 00000000000..dc262982340 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result @@ -0,0 +1,45 @@ +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where event_name like 'Wait/Synch/%' limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where event_name='FOO'; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +order by count_star limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +order by count_star desc limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where min_timer_wait > 0 order by count_star limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where min_timer_wait > 0 order by count_star desc limit 1; +EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +set event_name='FOO', object_instance_begin=0, +count_star=1, sum_timer_wait=2, min_timer_wait=3, +avg_timer_wait=4, max_timer_wait=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +set count_star=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +set count_star=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE +where count_star=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result new file mode 100644 index 00000000000..2a085659431 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result @@ -0,0 +1,29 @@ +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +where event_name like 'Wait/Synch/%' limit 1; +THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +# # # # # # # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +where event_name='FOO'; +THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +set event_name='FOO', thread_id=1, +count_star=1, sum_timer_wait=2, min_timer_wait=3, +avg_timer_wait=4, max_timer_wait=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +set count_star=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +set count_star=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +where count_star=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +UNLOCK TABLES; +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_instances.result b/mysql-test/suite/perfschema/r/dml_file_instances.result new file mode 100644 index 00000000000..e15d68cbad3 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_file_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.FILE_INSTANCES limit 1; +FILE_NAME EVENT_NAME OPEN_COUNT +# # # +select * from performance_schema.FILE_INSTANCES +where file_name='FOO'; +FILE_NAME EVENT_NAME OPEN_COUNT +insert into performance_schema.FILE_INSTANCES +set file_name='FOO', event_name='BAR', open_count=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +update performance_schema.FILE_INSTANCES +set file_name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.FILE_INSTANCES +where event_name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +LOCK TABLES performance_schema.FILE_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.FILE_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result new file mode 100644 index 00000000000..1ecc82f40a5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result @@ -0,0 +1,28 @@ +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +where event_name like 'Wait/io/%' limit 1; +EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +# # # # # +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +where event_name='FOO'; +EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME +set event_name='FOO', count_read=1, count_write=2, +sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +set count_read=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME +set count_write=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME +where count_read=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_EVENT_NAME' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result new file mode 100644 index 00000000000..05b204cc1a9 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result @@ -0,0 +1,28 @@ +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +where event_name like 'Wait/io/%' limit 1; +FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +# # # # # # +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE +where event_name='FOO'; +FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE +insert into performance_schema.FILE_SUMMARY_BY_INSTANCE +set event_name='FOO', count_read=1, count_write=2, +sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +update performance_schema.FILE_SUMMARY_BY_INSTANCE +set count_read=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +update performance_schema.FILE_SUMMARY_BY_INSTANCE +set count_write=12 where event_name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE +where count_read=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_mutex_instances.result b/mysql-test/suite/perfschema/r/dml_mutex_instances.result new file mode 100644 index 00000000000..655ca811c06 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_mutex_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.MUTEX_INSTANCES limit 1; +NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID +# # NULL +select * from performance_schema.MUTEX_INSTANCES +where name='FOO'; +NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID +insert into performance_schema.MUTEX_INSTANCES +set name='FOO', object_instance_begin=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +update performance_schema.MUTEX_INSTANCES +set name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +delete from performance_schema.MUTEX_INSTANCES +where name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +delete from performance_schema.MUTEX_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +LOCK TABLES performance_schema.MUTEX_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'MUTEX_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_performance_timers.result b/mysql-test/suite/perfschema/r/dml_performance_timers.result new file mode 100644 index 00000000000..99c1c74b797 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_performance_timers.result @@ -0,0 +1,29 @@ +select * from performance_schema.PERFORMANCE_TIMERS; +TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD +CYCLE <frequency> <resolution> <overhead> +NANOSECOND <frequency> <resolution> <overhead> +MICROSECOND <frequency> <resolution> <overhead> +MILLISECOND <frequency> <resolution> <overhead> +TICK <frequency> <resolution> <overhead> +select * from performance_schema.PERFORMANCE_TIMERS +where timer_name='CYCLE'; +TIMER_NAME TIMER_FREQUENCY TIMER_RESOLUTION TIMER_OVERHEAD +CYCLE <frequency> <resolution> <overhead> +insert into performance_schema.PERFORMANCE_TIMERS +set timer_name='FOO', timer_frequency=1, +timer_resolution=2, timer_overhead=3; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +update performance_schema.PERFORMANCE_TIMERS +set timer_frequency=12 where timer_name='CYCLE'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +delete from performance_schema.PERFORMANCE_TIMERS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +delete from performance_schema.PERFORMANCE_TIMERS +where timer_name='CYCLE'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +UNLOCK TABLES; +LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PERFORMANCE_TIMERS' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_processlist.result b/mysql-test/suite/perfschema/r/dml_processlist.result new file mode 100644 index 00000000000..ee0da5a7f1d --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_processlist.result @@ -0,0 +1,27 @@ +select * from performance_schema.PROCESSLIST +where name like 'Thread/%' limit 1; +THREAD_ID ID NAME +# # # +select * from performance_schema.PROCESSLIST +where name='FOO'; +THREAD_ID ID NAME +insert into performance_schema.PROCESSLIST +set name='FOO', thread_id=1, id=2; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PROCESSLIST' +update performance_schema.PROCESSLIST +set thread_id=12; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +update performance_schema.PROCESSLIST +set thread_id=12 where name like "FOO"; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +delete from performance_schema.PROCESSLIST +where id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +delete from performance_schema.PROCESSLIST; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST' +LOCK TABLES performance_schema.PROCESSLIST READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST' +UNLOCK TABLES; +LOCK TABLES performance_schema.PROCESSLIST WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result new file mode 100644 index 00000000000..62b5fbeaa8a --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result @@ -0,0 +1,23 @@ +select * from performance_schema.RWLOCK_INSTANCES limit 1; +NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT +# # NULL 0 +select * from performance_schema.RWLOCK_INSTANCES +where name='FOO'; +NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT +insert into performance_schema.RWLOCK_INSTANCES +set name='FOO', object_instance_begin=12; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +update performance_schema.RWLOCK_INSTANCES +set name='FOO'; +ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +delete from performance_schema.RWLOCK_INSTANCES +where name like "wait/%"; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +delete from performance_schema.RWLOCK_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +LOCK TABLES performance_schema.RWLOCK_INSTANCES READ; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +UNLOCK TABLES; +LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'RWLOCK_INSTANCES' +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_consumers.result b/mysql-test/suite/perfschema/r/dml_setup_consumers.result new file mode 100644 index 00000000000..44ed751dcd2 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_consumers.result @@ -0,0 +1,45 @@ +select * from performance_schema.SETUP_CONSUMERS; +NAME ENABLED +events_waits_current YES +events_waits_history YES +events_waits_history_long YES +events_waits_summary_by_thread_by_event_name YES +events_waits_summary_by_event_name YES +events_waits_summary_by_instance YES +file_summary_by_event_name YES +file_summary_by_instance YES +select * from performance_schema.SETUP_CONSUMERS +where name='events_waits_current'; +NAME ENABLED +events_waits_current YES +select * from performance_schema.SETUP_CONSUMERS +where enabled='YES'; +NAME ENABLED +events_waits_current YES +events_waits_history YES +events_waits_history_long YES +events_waits_summary_by_thread_by_event_name YES +events_waits_summary_by_event_name YES +events_waits_summary_by_instance YES +file_summary_by_event_name YES +file_summary_by_instance YES +select * from performance_schema.SETUP_CONSUMERS +where enabled='NO'; +NAME ENABLED +insert into performance_schema.SETUP_CONSUMERS +set name='FOO', enabled='YES'; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' +update performance_schema.SETUP_CONSUMERS +set name='FOO'; +ERROR HY000: Invalid performance_schema usage. +update performance_schema.SETUP_CONSUMERS +set enabled='YES'; +delete from performance_schema.SETUP_CONSUMERS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' +delete from performance_schema.SETUP_CONSUMERS +where name='events_waits_current'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_CONSUMERS' +LOCK TABLES performance_schema.SETUP_CONSUMERS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result new file mode 100644 index 00000000000..3a457578b3d --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -0,0 +1,72 @@ +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/Mutex/sql/%' + and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex') +order by name limit 10; +NAME ENABLED TIMED +wait/synch/mutex/sql/Cversion_lock YES YES +wait/synch/mutex/sql/Delayed_insert::mutex YES YES +wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state YES YES +wait/synch/mutex/sql/hash_filo::lock YES YES +wait/synch/mutex/sql/LOCK_active_mi YES YES +wait/synch/mutex/sql/LOCK_connection_count YES YES +wait/synch/mutex/sql/LOCK_crypt YES YES +wait/synch/mutex/sql/LOCK_delayed_create YES YES +wait/synch/mutex/sql/LOCK_delayed_insert YES YES +wait/synch/mutex/sql/LOCK_delayed_status YES YES +select * from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/Rwlock/sql/%' + order by name limit 10; +NAME ENABLED TIMED +wait/synch/rwlock/sql/LOCK_dboptions YES YES +wait/synch/rwlock/sql/LOCK_grant YES YES +wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES +wait/synch/rwlock/sql/LOCK_sys_init_connect YES YES +wait/synch/rwlock/sql/LOCK_sys_init_slave YES YES +wait/synch/rwlock/sql/LOGGER::LOCK_logger YES YES +wait/synch/rwlock/sql/Query_cache_query::lock YES YES +wait/synch/rwlock/sql/THR_LOCK_servers YES YES +wait/synch/rwlock/sql/THR_LOCK_udf YES YES +select * from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/Cond/sql/%' + and name not in ( +'wait/synch/cond/sql/COND_handler_count', +'wait/synch/cond/sql/DEBUG_SYNC::cond') +order by name limit 10; +NAME ENABLED TIMED +wait/synch/cond/sql/COND_flush_thread_cache YES YES +wait/synch/cond/sql/COND_global_read_lock YES YES +wait/synch/cond/sql/COND_manager YES YES +wait/synch/cond/sql/COND_queue_state YES YES +wait/synch/cond/sql/COND_refresh YES YES +wait/synch/cond/sql/COND_rpl_status YES YES +wait/synch/cond/sql/COND_server_started YES YES +wait/synch/cond/sql/COND_thread_cache YES YES +wait/synch/cond/sql/COND_thread_count YES YES +wait/synch/cond/sql/Delayed_insert::cond YES YES +select * from performance_schema.SETUP_INSTRUMENTS +where name='Wait'; +select * from performance_schema.SETUP_INSTRUMENTS +where enabled='YES'; +insert into performance_schema.SETUP_INSTRUMENTS +set name='FOO', enabled='YES', timed='YES'; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +update performance_schema.SETUP_INSTRUMENTS +set name='FOO'; +ERROR HY000: Invalid performance_schema usage. +update performance_schema.SETUP_INSTRUMENTS +set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS +set timed='NO'; +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS +set enabled='YES', timed='YES'; +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.SETUP_INSTRUMENTS +where name like 'Wait/Synch/%'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_objects.result b/mysql-test/suite/perfschema/r/dml_setup_objects.result new file mode 100644 index 00000000000..a9d97357227 --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_objects.result @@ -0,0 +1,35 @@ +select * from performance_schema.SETUP_OBJECTS; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +select * from performance_schema.SETUP_OBJECTS +where object_type = 'TABLE'; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +select * from performance_schema.SETUP_OBJECTS +where enabled='YES'; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +insert into performance_schema.SETUP_OBJECTS +set object_type='TABLE', object_schema='FOO', object_name='BAR', +enabled='YES', timed='YES', aggregated='YES'; +ERROR HY000: Table storage engine for 'SETUP_OBJECTS' doesn't have this option +update performance_schema.SETUP_OBJECTS +set object_type='TABLE'; +update performance_schema.SETUP_OBJECTS +set object_schema='ILLEGAL'; +update performance_schema.SETUP_OBJECTS +set object_name='ILLEGAL'; +update performance_schema.SETUP_OBJECTS +set enabled='NO'; +update performance_schema.SETUP_OBJECTS +set timed='NO'; +update performance_schema.SETUP_OBJECTS +set aggregated='NO'; +select * from performance_schema.SETUP_OBJECTS; +OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED AGGREGATED +update performance_schema.SETUP_OBJECTS +set enabled='YES', timed='YES', aggregated='YES'; +delete from performance_schema.SETUP_OBJECTS +where object_type = 'TABLE'; +delete from performance_schema.SETUP_OBJECTS; +LOCK TABLES performance_schema.SETUP_OBJECTS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_OBJECTS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/dml_setup_timers.result b/mysql-test/suite/perfschema/r/dml_setup_timers.result new file mode 100644 index 00000000000..a9bee916cde --- /dev/null +++ b/mysql-test/suite/perfschema/r/dml_setup_timers.result @@ -0,0 +1,33 @@ +select * from performance_schema.SETUP_TIMERS; +NAME TIMER_NAME +wait CYCLE +select * from performance_schema.SETUP_TIMERS +where name='Wait'; +NAME TIMER_NAME +wait CYCLE +select * from performance_schema.SETUP_TIMERS +where timer_name='CYCLE'; +NAME TIMER_NAME +wait CYCLE +insert into performance_schema.SETUP_TIMERS +set name='FOO', timer_name='CYCLE'; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' +update performance_schema.SETUP_TIMERS +set name='FOO'; +ERROR HY000: Invalid performance_schema usage. +update performance_schema.SETUP_TIMERS +set timer_name='MILLISECOND'; +select * from performance_schema.SETUP_TIMERS; +NAME TIMER_NAME +wait MILLISECOND +update performance_schema.SETUP_TIMERS +set timer_name='CYCLE'; +delete from performance_schema.SETUP_TIMERS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' +delete from performance_schema.SETUP_TIMERS +where name='Wait'; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_TIMERS' +LOCK TABLES performance_schema.SETUP_TIMERS READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.SETUP_TIMERS WRITE; +UNLOCK TABLES; diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result new file mode 100644 index 00000000000..69e6072fc22 --- /dev/null +++ b/mysql-test/suite/perfschema/r/func_file_io.result @@ -0,0 +1,117 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD')); +SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; +has_instrumentation +Success +SELECT * FROM t1 WHERE id < 4; +id b +1 initial value +2 initial value +3 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; +test_ff1_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO'; +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); +SELECT * FROM t1 WHERE id < 6; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') +AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed; +test_ff2_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id > 4; +id b +5 initial value +6 initial value +7 initial value +8 initial value +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE TIMER_WAIT != NULL +OR TIMER_START != NULL +OR TIMER_END != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE TIMER_WAIT != NULL +OR TIMER_START != NULL +OR TIMER_END != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE TIMER_WAIT != NULL +OR TIMER_START != NULL +OR TIMER_END != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES'; +SELECT * FROM t1 WHERE id < 4; +id b +1 initial value +2 initial value +3 initial value +DROP TABLE t1; +SELECT SUM(COUNT_READ) AS sum_count_read, +SUM(COUNT_WRITE) AS sum_count_write, +SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, +SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; +SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +WHERE COUNT_STAR > 0 +ORDER BY SUM_TIMER_WAIT DESC +LIMIT 10; +SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT +# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user +ORDER BY SUM_WAIT DESC +LIMIT 20; +SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +WHERE p.ID = 1 +GROUP BY h.EVENT_NAME +HAVING TOTAL_WAIT > 0; +SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user, h.operation +HAVING BYTES > 0 +ORDER BY i.user, h.operation; diff --git a/mysql-test/suite/perfschema/r/func_mutex.result b/mysql-test/suite/perfschema/r/func_mutex.result new file mode 100644 index 00000000000..e32d7267bb1 --- /dev/null +++ b/mysql-test/suite/perfschema/r/func_mutex.result @@ -0,0 +1,113 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed; +test_fm1_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/mutex/sql/LOCK_open'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; +test_fm2_timed +Success +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed; +test_fm1_rw_timed +Success +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +SELECT * FROM t1 WHERE id = 1; +id b +1 initial value +SET @before_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT * FROM t1; +id b +1 initial value +2 initial value +3 initial value +4 initial value +5 initial value +6 initial value +7 initial value +8 initial value +SET @after_count = (SELECT SUM(TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed; +test_fm2_rw_timed +Success +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/global_read_lock.result b/mysql-test/suite/perfschema/r/global_read_lock.result new file mode 100644 index 00000000000..93d6adfd049 --- /dev/null +++ b/mysql-test/suite/perfschema/r/global_read_lock.result @@ -0,0 +1,33 @@ +use performance_schema; +grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; +flush privileges; +connect (con1, localhost, pfsuser, , test); +lock tables performance_schema.SETUP_INSTRUMENTS read; +select * from performance_schema.SETUP_INSTRUMENTS; +unlock tables; +lock tables performance_schema.SETUP_INSTRUMENTS write; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; +connection default; +flush tables with read lock; +connection con1; +lock tables performance_schema.SETUP_INSTRUMENTS read; +select * from performance_schema.SETUP_INSTRUMENTS; +unlock tables; +lock tables performance_schema.SETUP_INSTRUMENTS write; +connection default; +select event_name, +left(source, locate(":", source)) as short_source, +timer_end, timer_wait, operation +from performance_schema.EVENTS_WAITS_CURRENT +where event_name like "wait/synch/cond/sql/COND_global_read_lock"; +event_name short_source timer_end timer_wait operation +wait/synch/cond/sql/COND_global_read_lock lock.cc: NULL NULL wait +unlock tables; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; +connection default; +drop user pfsuser@localhost; +flush privileges; diff --git a/mysql-test/suite/perfschema/r/information_schema.result b/mysql-test/suite/perfschema/r/information_schema.result new file mode 100644 index 00000000000..86ebe80768c --- /dev/null +++ b/mysql-test/suite/perfschema/r/information_schema.result @@ -0,0 +1,198 @@ +select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +TABLE_SCHEMA upper(TABLE_NAME) TABLE_CATALOG +performance_schema COND_INSTANCES def +performance_schema EVENTS_WAITS_CURRENT def +performance_schema EVENTS_WAITS_HISTORY def +performance_schema EVENTS_WAITS_HISTORY_LONG def +performance_schema EVENTS_WAITS_SUMMARY_BY_EVENT_NAME def +performance_schema EVENTS_WAITS_SUMMARY_BY_INSTANCE def +performance_schema EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME def +performance_schema FILE_INSTANCES def +performance_schema FILE_SUMMARY_BY_EVENT_NAME def +performance_schema FILE_SUMMARY_BY_INSTANCE def +performance_schema MUTEX_INSTANCES def +performance_schema PERFORMANCE_TIMERS def +performance_schema PROCESSLIST def +performance_schema RWLOCK_INSTANCES def +performance_schema SETUP_CONSUMERS def +performance_schema SETUP_INSTRUMENTS def +performance_schema SETUP_OBJECTS def +performance_schema SETUP_TIMERS def +select upper(TABLE_NAME), TABLE_TYPE, ENGINE +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_TYPE ENGINE +COND_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_CURRENT BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_HISTORY BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_HISTORY_LONG BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA +FILE_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +FILE_SUMMARY_BY_EVENT_NAME BASE TABLE PERFORMANCE_SCHEMA +FILE_SUMMARY_BY_INSTANCE BASE TABLE PERFORMANCE_SCHEMA +MUTEX_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +PERFORMANCE_TIMERS BASE TABLE PERFORMANCE_SCHEMA +PROCESSLIST BASE TABLE PERFORMANCE_SCHEMA +RWLOCK_INSTANCES BASE TABLE PERFORMANCE_SCHEMA +SETUP_CONSUMERS BASE TABLE PERFORMANCE_SCHEMA +SETUP_INSTRUMENTS BASE TABLE PERFORMANCE_SCHEMA +SETUP_OBJECTS BASE TABLE PERFORMANCE_SCHEMA +SETUP_TIMERS BASE TABLE PERFORMANCE_SCHEMA +select upper(TABLE_NAME), VERSION, ROW_FORMAT +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) VERSION ROW_FORMAT +COND_INSTANCES 10 Dynamic +EVENTS_WAITS_CURRENT 10 Dynamic +EVENTS_WAITS_HISTORY 10 Dynamic +EVENTS_WAITS_HISTORY_LONG 10 Dynamic +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 10 Dynamic +EVENTS_WAITS_SUMMARY_BY_INSTANCE 10 Dynamic +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 10 Dynamic +FILE_INSTANCES 10 Dynamic +FILE_SUMMARY_BY_EVENT_NAME 10 Dynamic +FILE_SUMMARY_BY_INSTANCE 10 Dynamic +MUTEX_INSTANCES 10 Dynamic +PERFORMANCE_TIMERS 10 Fixed +PROCESSLIST 10 Dynamic +RWLOCK_INSTANCES 10 Dynamic +SETUP_CONSUMERS 10 Dynamic +SETUP_INSTRUMENTS 10 Dynamic +SETUP_OBJECTS 10 Dynamic +SETUP_TIMERS 10 Dynamic +select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_ROWS AVG_ROW_LENGTH +COND_INSTANCES 1000 0 +EVENTS_WAITS_CURRENT 1000 0 +EVENTS_WAITS_HISTORY 1000 0 +EVENTS_WAITS_HISTORY_LONG 10000 0 +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 1000 0 +EVENTS_WAITS_SUMMARY_BY_INSTANCE 1000 0 +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 1000 0 +FILE_INSTANCES 1000 0 +FILE_SUMMARY_BY_EVENT_NAME 1000 0 +FILE_SUMMARY_BY_INSTANCE 1000 0 +MUTEX_INSTANCES 1000 0 +PERFORMANCE_TIMERS 5 0 +PROCESSLIST 1000 0 +RWLOCK_INSTANCES 1000 0 +SETUP_CONSUMERS 8 0 +SETUP_INSTRUMENTS 1000 0 +SETUP_OBJECTS 1000 0 +SETUP_TIMERS 1 0 +select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) DATA_LENGTH MAX_DATA_LENGTH +COND_INSTANCES 0 0 +EVENTS_WAITS_CURRENT 0 0 +EVENTS_WAITS_HISTORY 0 0 +EVENTS_WAITS_HISTORY_LONG 0 0 +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 0 0 +EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 +FILE_INSTANCES 0 0 +FILE_SUMMARY_BY_EVENT_NAME 0 0 +FILE_SUMMARY_BY_INSTANCE 0 0 +MUTEX_INSTANCES 0 0 +PERFORMANCE_TIMERS 0 0 +PROCESSLIST 0 0 +RWLOCK_INSTANCES 0 0 +SETUP_CONSUMERS 0 0 +SETUP_INSTRUMENTS 0 0 +SETUP_OBJECTS 0 0 +SETUP_TIMERS 0 0 +select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) INDEX_LENGTH DATA_FREE AUTO_INCREMENT +COND_INSTANCES 0 0 NULL +EVENTS_WAITS_CURRENT 0 0 NULL +EVENTS_WAITS_HISTORY 0 0 NULL +EVENTS_WAITS_HISTORY_LONG 0 0 NULL +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME 0 0 NULL +EVENTS_WAITS_SUMMARY_BY_INSTANCE 0 0 NULL +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME 0 0 NULL +FILE_INSTANCES 0 0 NULL +FILE_SUMMARY_BY_EVENT_NAME 0 0 NULL +FILE_SUMMARY_BY_INSTANCE 0 0 NULL +MUTEX_INSTANCES 0 0 NULL +PERFORMANCE_TIMERS 0 0 NULL +PROCESSLIST 0 0 NULL +RWLOCK_INSTANCES 0 0 NULL +SETUP_CONSUMERS 0 0 NULL +SETUP_INSTRUMENTS 0 0 NULL +SETUP_OBJECTS 0 0 NULL +SETUP_TIMERS 0 0 NULL +select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) CREATE_TIME UPDATE_TIME CHECK_TIME +COND_INSTANCES NULL NULL NULL +EVENTS_WAITS_CURRENT NULL NULL NULL +EVENTS_WAITS_HISTORY NULL NULL NULL +EVENTS_WAITS_HISTORY_LONG NULL NULL NULL +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME NULL NULL NULL +EVENTS_WAITS_SUMMARY_BY_INSTANCE NULL NULL NULL +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME NULL NULL NULL +FILE_INSTANCES NULL NULL NULL +FILE_SUMMARY_BY_EVENT_NAME NULL NULL NULL +FILE_SUMMARY_BY_INSTANCE NULL NULL NULL +MUTEX_INSTANCES NULL NULL NULL +PERFORMANCE_TIMERS NULL NULL NULL +PROCESSLIST NULL NULL NULL +RWLOCK_INSTANCES NULL NULL NULL +SETUP_CONSUMERS NULL NULL NULL +SETUP_INSTRUMENTS NULL NULL NULL +SETUP_OBJECTS NULL NULL NULL +SETUP_TIMERS NULL NULL NULL +select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_COLLATION CHECKSUM +COND_INSTANCES utf8_general_ci NULL +EVENTS_WAITS_CURRENT utf8_general_ci NULL +EVENTS_WAITS_HISTORY utf8_general_ci NULL +EVENTS_WAITS_HISTORY_LONG utf8_general_ci NULL +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL +EVENTS_WAITS_SUMMARY_BY_INSTANCE utf8_general_ci NULL +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME utf8_general_ci NULL +FILE_INSTANCES utf8_general_ci NULL +FILE_SUMMARY_BY_EVENT_NAME utf8_general_ci NULL +FILE_SUMMARY_BY_INSTANCE utf8_general_ci NULL +MUTEX_INSTANCES utf8_general_ci NULL +PERFORMANCE_TIMERS utf8_general_ci NULL +PROCESSLIST utf8_general_ci NULL +RWLOCK_INSTANCES utf8_general_ci NULL +SETUP_CONSUMERS utf8_general_ci NULL +SETUP_INSTRUMENTS utf8_general_ci NULL +SETUP_OBJECTS utf8_general_ci NULL +SETUP_TIMERS utf8_general_ci NULL +select upper(TABLE_NAME), TABLE_COMMENT +from information_schema.tables +where TABLE_SCHEMA='performance_schema'; +upper(TABLE_NAME) TABLE_COMMENT +COND_INSTANCES +EVENTS_WAITS_CURRENT +EVENTS_WAITS_HISTORY +EVENTS_WAITS_HISTORY_LONG +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +EVENTS_WAITS_SUMMARY_BY_INSTANCE +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +FILE_INSTANCES +FILE_SUMMARY_BY_EVENT_NAME +FILE_SUMMARY_BY_INSTANCE +MUTEX_INSTANCES +PERFORMANCE_TIMERS +PROCESSLIST +RWLOCK_INSTANCES +SETUP_CONSUMERS +SETUP_INSTRUMENTS +SETUP_OBJECTS +SETUP_TIMERS diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result new file mode 100644 index 00000000000..d944b4b1d3d --- /dev/null +++ b/mysql-test/suite/perfschema/r/misc.result @@ -0,0 +1,13 @@ +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN +(SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN +(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS +WHERE NAME LIKE "wait/synch/%") +LIMIT 1; +create table test.t1(a int) engine=performance_schema; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table performance_schema.t1(a int); +ERROR 42000: CREATE command denied to user 'root'@'localhost' for table 't1' diff --git a/mysql-test/suite/perfschema/r/myisam_file_io.result b/mysql-test/suite/perfschema/r/myisam_file_io.result new file mode 100644 index 00000000000..66c37c7d6d8 --- /dev/null +++ b/mysql-test/suite/perfschema/r/myisam_file_io.result @@ -0,0 +1,59 @@ +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/io/file/myisam/%"; +update performance_schema.SETUP_CONSUMERS +set enabled='YES'; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +drop table if exists test.no_index_tab; +create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; +select event_name, +left(source, locate(":", source)) as short_source, +operation, number_of_bytes, +substring(object_name, locate("no_index_tab", object_name)) as short_name +from performance_schema.EVENTS_WAITS_HISTORY_LONG +where operation not like "tell" + order by thread_id, event_id; +event_name short_source operation number_of_bytes short_name +wait/io/file/myisam/kfile mi_create.c: create NULL no_index_tab.MYI +wait/io/file/myisam/dfile mi_create.c: create NULL no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 176 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 100 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: write 7 no_index_tab.MYI +wait/io/file/myisam/kfile mi_create.c: chsize 1024 no_index_tab.MYI +wait/io/file/myisam/dfile mi_create.c: close NULL no_index_tab.MYD +wait/io/file/myisam/kfile mi_create.c: close NULL no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: open NULL no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: read 24 no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: seek NULL no_index_tab.MYI +wait/io/file/myisam/kfile mi_open.c: read 297 no_index_tab.MYI +wait/io/file/myisam/dfile mi_open.c: open NULL no_index_tab.MYD +wait/io/file/myisam/kfile mi_locking.c: write 3 no_index_tab.MYI +wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI +wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI +wait/io/file/myisam/dfile mi_dynrec.c: write 20 no_index_tab.MYD +wait/io/file/myisam/kfile mi_open.c: write 124 no_index_tab.MYI +show status like 'performance_schema_%'; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +drop table test.no_index_tab; diff --git a/mysql-test/suite/perfschema/r/no_threads.result b/mysql-test/suite/perfschema/r/no_threads.result new file mode 100644 index 00000000000..b38dc9fd733 --- /dev/null +++ b/mysql-test/suite/perfschema/r/no_threads.result @@ -0,0 +1,43 @@ +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_CONSUMERS set enabled='YES'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; +drop table if exists test.t1; +truncate table performance_schema.EVENTS_WAITS_CURRENT; +truncate table performance_schema.EVENTS_WAITS_HISTORY; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +show variables like "thread_handling"; +Variable_name Value +thread_handling no-threads +create table test.t1(a int) engine=MYISAM; +show variables like "performance_schema"; +Variable_name Value +performance_schema ON +show variables like "performance_schema_max_thread%"; +Variable_name Value +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 10 +select count(*) from performance_schema.PROCESSLIST +where name like "thread/sql/main"; +count(*) +1 +select count(*) from performance_schema.PROCESSLIST +where name like "thread/sql/OneConnection"; +count(*) +0 +select event_name, operation, +left(source, locate(":", source)) as short_source +from performance_schema.EVENTS_WAITS_CURRENT; +event_name operation short_source +wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: +select event_name, operation, +left(source, locate(":", source)) as short_source +from performance_schema.EVENTS_WAITS_HISTORY; +event_name operation short_source +wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: +select event_name, operation, +left(source, locate(":", source)) as short_source +from performance_schema.EVENTS_WAITS_HISTORY_LONG; +event_name operation short_source +wait/synch/mutex/mysys/THR_LOCK_myisam lock mi_create.c: +drop table test.t1; diff --git a/mysql-test/suite/perfschema/r/one_thread_per_con.result b/mysql-test/suite/perfschema/r/one_thread_per_con.result new file mode 100644 index 00000000000..9677a09933a --- /dev/null +++ b/mysql-test/suite/perfschema/r/one_thread_per_con.result @@ -0,0 +1,38 @@ +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; +drop table if exists test.t1; +drop table if exists test.t2; +drop table if exists test.t3; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; +show variables like "thread_handling"; +Variable_name Value +thread_handling one-thread-per-connection +"----------------- Connection 1" +create table test.t1(a int) engine=MYISAM; +"----------------- Connection 2" +create table test.t2(a int) engine=MYISAM; +"----------------- Connection 3" +create table test.t3(a int) engine=MYISAM; +"----------------- Connection default" +execute stmt_dump_events using @tid; +event_name short_source operation number_of_bytes +wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL +execute stmt_dump_thread using @tid; +name +thread/sql/one_connection +execute stmt_dump_events using @tid; +event_name short_source operation number_of_bytes +wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL +execute stmt_dump_thread using @tid; +name +thread/sql/one_connection +execute stmt_dump_events using @tid; +event_name short_source operation number_of_bytes +wait/synch/mutex/mysys/THR_LOCK_myisam mi_create.c: lock NULL +execute stmt_dump_thread using @tid; +name +thread/sql/one_connection +drop table test.t1; +drop table test.t2; +drop table test.t3; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result new file mode 100644 index 00000000000..ddbc150a72a --- /dev/null +++ b/mysql-test/suite/perfschema/r/privilege.result @@ -0,0 +1,577 @@ +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION; +grant ALL on performance_schema.* to 'pfs_user_2'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.* to 'pfs_user_2'@localhost; +grant DROP on performance_schema.* to 'pfs_user_2'@localhost; +grant REFERENCES on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE TEMPORARY TABLES on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant EXECUTE on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant EVENT on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.* to 'pfs_user_2'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SELECT on performance_schema.* to 'pfs_user_2'@localhost; +grant INSERT on performance_schema.* to 'pfs_user_2'@localhost; +grant UPDATE on performance_schema.* to 'pfs_user_2'@localhost; +grant DELETE on performance_schema.* to 'pfs_user_2'@localhost; +grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost; +grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +with GRANT OPTION; +grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost +with GRANT OPTION; +grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost +with GRANT OPTION; +grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +with GRANT OPTION; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: INSERT,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: UPDATE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; +ERROR 42000: DELETE,GRANT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost +with GRANT OPTION; +grant LOCK TABLES on performance_schema.* to 'pfs_user_3'@localhost +with GRANT OPTION; +flush privileges; +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_1'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_2'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +can select +can select +drop table if exists test.t1; +rename table performance_schema.SETUP_INSTRUMENTS to test.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to test.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.FILE_INSTANCES to performance_schema.t1; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.SETUP_INSTRUMENTS +to performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +rename table performance_schema.EVENTS_WAITS_CURRENT +to performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create procedure performance_schema.my_proc() begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create function performance_schema.my_func() returns int return 0; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create event performance_schema.my_event on schedule every 15 minute +do begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_setup_instruments +before insert on performance_schema.SETUP_INSTRUMENTS +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_events_waits_current +before insert on performance_schema.EVENTS_WAITS_CURRENT +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create trigger performance_schema.bi_file_instances +before insert on performance_schema.FILE_INSTANCES +for each row begin end; +ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' +create table test.t1(a int) engine=PERFORMANCE_SCHEMA; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.SETUP_INSTRUMENTS; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; +ERROR HY000: Invalid performance_schema usage. +create table test.t1 like performance_schema.FILE_INSTANCES; +ERROR HY000: Invalid performance_schema usage. +insert into performance_schema.SETUP_INSTRUMENTS +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS' +insert into performance_schema.EVENTS_WAITS_CURRENT +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +insert into performance_schema.FILE_INSTANCES +set name="foo"; +ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +delete from performance_schema.SETUP_INSTRUMENTS; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'SETUP_INSTRUMENTS' +delete from performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +delete from performance_schema.FILE_INSTANCES; +ERROR 42000: DELETE command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +lock table performance_schema.SETUP_INSTRUMENTS read; +unlock tables; +lock table performance_schema.SETUP_INSTRUMENTS write; +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.EVENTS_WAITS_CURRENT write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_CURRENT' +unlock tables; +lock table performance_schema.FILE_INSTANCES read; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +lock table performance_schema.FILE_INSTANCES write; +ERROR 42000: SELECT,LOCK TABL command denied to user 'pfs_user_3'@'localhost' for table 'FILE_INSTANCES' +unlock tables; +# +# WL#4818, NFS2: Can use grants to give normal user access +# to view data from _CURRENT and _HISTORY tables +# +# Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3. +# (Except for EVENTS_WAITS_CURRENT, which is granted.) +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1; +can select +can select +SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1; +ERROR 42000: SELECT command denied to user 'pfs_user_3'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +revoke all privileges, grant option from 'pfs_user_1'@localhost; +revoke all privileges, grant option from 'pfs_user_2'@localhost; +revoke all privileges, grant option from 'pfs_user_3'@localhost; +drop user 'pfs_user_1'@localhost; +drop user 'pfs_user_2'@localhost; +drop user 'pfs_user_3'@localhost; +flush privileges; +# Test cases from WL#4818 +# Setup user +CREATE user pfs_user_4; +# +# WL#4818, NFS4: Normal user does not have access to view data +# without grants +# +# Select as pfs_user_4 should fail without grant +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY' +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT' +SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE; +ERROR 42000: SELECT command denied to user 'pfs_user_4'@'localhost' for table 'FILE_SUMMARY_BY_INSTANCE' +# +# WL#4818, NFS3: Normal user does not have access to change what is +# instrumented without grants +# +# User pfs_user_4 should not be allowed to tweak instrumentation without +# explicit grant +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS' +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_INSTRUMENTS' +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_CONSUMERS' +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; +ERROR 42000: UPDATE command denied to user 'pfs_user_4'@'localhost' for table 'SETUP_TIMERS' +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY_LONG' +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_HISTORY' +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +ERROR 42000: DROP command denied to user 'pfs_user_4'@'localhost' for table 'EVENTS_WAITS_CURRENT' +# +# WL#4814, NFS1: Can use grants to give normal user access +# to turn on and off instrumentation +# +# Grant access to change tables with the root account +GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4; +GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4; +GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4; +# User pfs_user_4 should now be allowed to tweak instrumentation +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; +# Clean up +REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; +DROP USER pfs_user_4; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result new file mode 100644 index 00000000000..06862009493 --- /dev/null +++ b/mysql-test/suite/perfschema/r/query_cache.result @@ -0,0 +1,66 @@ +drop table if exists t1; +create table t1 (a int not null); +insert into t1 values (1), (2), (3); +SET GLOBAL query_cache_size=1355776; +flush query cache; +reset query cache; +select * from t1; +a +1 +2 +3 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 0 +select * from t1; +a +1 +2 +3 +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +spins +NULL +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +name +wait/io/file/csv/data +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; +spins +NULL +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; +name +wait/io/file/csv/data +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +SET GLOBAL query_cache_size= default; +drop table t1; diff --git a/mysql-test/suite/perfschema/r/read_only.result b/mysql-test/suite/perfschema/r/read_only.result new file mode 100644 index 00000000000..6a30eb4ab8b --- /dev/null +++ b/mysql-test/suite/perfschema/r/read_only.result @@ -0,0 +1,49 @@ +use performance_schema; +set @start_read_only= @@global.read_only; +grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost; +flush privileges; +connect (con1, localhost, pfsuser, , test); +connection default; +set global read_only=0; +connection con1; +select @@global.read_only; +@@global.read_only +0 +show grants; +Grants for pfsuser@localhost +GRANT USAGE ON *.* TO 'pfsuser'@'localhost' +GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +connection default; +set global read_only=1; +connection con1; +select @@global.read_only; +@@global.read_only +1 +show grants; +Grants for pfsuser@localhost +GRANT USAGE ON *.* TO 'pfsuser'@'localhost' +GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +connection default; +grant super on *.* to pfsuser@localhost; +flush privileges; +connect (con1, localhost, pfsuser, , test); +select @@global.read_only; +@@global.read_only +1 +show grants; +Grants for pfsuser@localhost +GRANT SUPER ON *.* TO 'pfsuser'@'localhost' +GRANT SELECT, UPDATE ON `performance_schema`.* TO 'pfsuser'@'localhost' +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +connection default; +set global read_only= @start_read_only; +drop user pfsuser@localhost; +flush privileges; diff --git a/mysql-test/suite/perfschema/r/schema.result b/mysql-test/suite/perfschema/r/schema.result new file mode 100644 index 00000000000..d402df70ed5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/schema.result @@ -0,0 +1,211 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +use performance_schema; +show tables; +Tables_in_performance_schema +COND_INSTANCES +EVENTS_WAITS_CURRENT +EVENTS_WAITS_HISTORY +EVENTS_WAITS_HISTORY_LONG +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +EVENTS_WAITS_SUMMARY_BY_INSTANCE +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME +FILE_INSTANCES +FILE_SUMMARY_BY_EVENT_NAME +FILE_SUMMARY_BY_INSTANCE +MUTEX_INSTANCES +PERFORMANCE_TIMERS +PROCESSLIST +RWLOCK_INSTANCES +SETUP_CONSUMERS +SETUP_INSTRUMENTS +SETUP_OBJECTS +SETUP_TIMERS +show create table COND_INSTANCES; +Table Create Table +COND_INSTANCES CREATE TABLE `COND_INSTANCES` ( + `NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_CURRENT; +Table Create Table +EVENTS_WAITS_CURRENT CREATE TABLE `EVENTS_WAITS_CURRENT` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_ID` bigint(20) unsigned NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `SOURCE` varchar(64) DEFAULT NULL, + `TIMER_START` bigint(20) unsigned DEFAULT NULL, + `TIMER_END` bigint(20) unsigned DEFAULT NULL, + `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL, + `SPINS` int(10) unsigned DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(512) DEFAULT NULL, + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL, + `OPERATION` varchar(16) NOT NULL, + `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, + `FLAGS` int(10) unsigned DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_HISTORY; +Table Create Table +EVENTS_WAITS_HISTORY CREATE TABLE `EVENTS_WAITS_HISTORY` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_ID` bigint(20) unsigned NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `SOURCE` varchar(64) DEFAULT NULL, + `TIMER_START` bigint(20) unsigned DEFAULT NULL, + `TIMER_END` bigint(20) unsigned DEFAULT NULL, + `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL, + `SPINS` int(10) unsigned DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(512) DEFAULT NULL, + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL, + `OPERATION` varchar(16) NOT NULL, + `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, + `FLAGS` int(10) unsigned DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_HISTORY_LONG; +Table Create Table +EVENTS_WAITS_HISTORY_LONG CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_ID` bigint(20) unsigned NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `SOURCE` varchar(64) DEFAULT NULL, + `TIMER_START` bigint(20) unsigned DEFAULT NULL, + `TIMER_END` bigint(20) unsigned DEFAULT NULL, + `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL, + `SPINS` int(10) unsigned DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(512) DEFAULT NULL, + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL, + `OPERATION` varchar(16) NOT NULL, + `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL, + `FLAGS` int(10) unsigned DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +Table Create Table +EVENTS_WAITS_SUMMARY_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_EVENT_NAME` ( + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_STAR` bigint(20) unsigned NOT NULL, + `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE; +Table Create Table +EVENTS_WAITS_SUMMARY_BY_INSTANCE CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` ( + `EVENT_NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `COUNT_STAR` bigint(20) unsigned NOT NULL, + `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +Table Create Table +EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` ( + `THREAD_ID` int(11) NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_STAR` bigint(20) unsigned NOT NULL, + `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL, + `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table FILE_INSTANCES; +Table Create Table +FILE_INSTANCES CREATE TABLE `FILE_INSTANCES` ( + `FILE_NAME` varchar(512) NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `OPEN_COUNT` int(10) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table FILE_SUMMARY_BY_EVENT_NAME; +Table Create Table +FILE_SUMMARY_BY_EVENT_NAME CREATE TABLE `FILE_SUMMARY_BY_EVENT_NAME` ( + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_READ` bigint(20) unsigned NOT NULL, + `COUNT_WRITE` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table FILE_SUMMARY_BY_INSTANCE; +Table Create Table +FILE_SUMMARY_BY_INSTANCE CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` ( + `FILE_NAME` varchar(512) NOT NULL, + `EVENT_NAME` varchar(128) NOT NULL, + `COUNT_READ` bigint(20) unsigned NOT NULL, + `COUNT_WRITE` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL, + `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table MUTEX_INSTANCES; +Table Create Table +MUTEX_INSTANCES CREATE TABLE `MUTEX_INSTANCES` ( + `NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table PERFORMANCE_TIMERS; +Table Create Table +PERFORMANCE_TIMERS CREATE TABLE `PERFORMANCE_TIMERS` ( + `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL, + `TIMER_FREQUENCY` bigint(20) DEFAULT NULL, + `TIMER_RESOLUTION` bigint(20) DEFAULT NULL, + `TIMER_OVERHEAD` bigint(20) DEFAULT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table PROCESSLIST; +Table Create Table +PROCESSLIST CREATE TABLE `PROCESSLIST` ( + `THREAD_ID` int(11) NOT NULL, + `ID` int(11) NOT NULL, + `NAME` varchar(64) NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table RWLOCK_INSTANCES; +Table Create Table +RWLOCK_INSTANCES CREATE TABLE `RWLOCK_INSTANCES` ( + `NAME` varchar(128) NOT NULL, + `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL, + `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL, + `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_CONSUMERS; +Table Create Table +SETUP_CONSUMERS CREATE TABLE `SETUP_CONSUMERS` ( + `NAME` varchar(64) NOT NULL, + `ENABLED` enum('YES','NO') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_INSTRUMENTS; +Table Create Table +SETUP_INSTRUMENTS CREATE TABLE `SETUP_INSTRUMENTS` ( + `NAME` varchar(128) NOT NULL, + `ENABLED` enum('YES','NO') NOT NULL, + `TIMED` enum('YES','NO') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_OBJECTS; +Table Create Table +SETUP_OBJECTS CREATE TABLE `SETUP_OBJECTS` ( + `OBJECT_TYPE` varchar(64) DEFAULT NULL, + `OBJECT_SCHEMA` varchar(64) DEFAULT NULL, + `OBJECT_NAME` varchar(64) DEFAULT NULL, + `ENABLED` enum('YES','NO') NOT NULL, + `TIMED` enum('YES','NO') NOT NULL, + `AGGREGATED` enum('YES','NO') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 +show create table SETUP_TIMERS; +Table Create Table +SETUP_TIMERS CREATE TABLE `SETUP_TIMERS` ( + `NAME` varchar(64) NOT NULL, + `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL +) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8 diff --git a/mysql-test/suite/perfschema/r/selects.result b/mysql-test/suite/perfschema/r/selects.result new file mode 100644 index 00000000000..b5bef207303 --- /dev/null +++ b/mysql-test/suite/perfschema/r/selects.result @@ -0,0 +1,97 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); +SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +GROUP BY OPERATION +HAVING TOTAL IS NOT NULL +ORDER BY OPERATION +LIMIT 1; +OPERATION TOTAL +chsize [NUM_BYTES] +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN +(SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN +(SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS +WHERE NAME LIKE "wait/synch/%") +LIMIT 1; +EVENT_ID +[EVENT_ID] +SELECT DISTINCT EVENT_ID +FROM performance_schema.EVENTS_WAITS_CURRENT +JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID) +ORDER BY EVENT_ID +LIMIT 1; +EVENT_ID +[EVENT_ID] +SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY t1 +JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) +ORDER BY t1.EVENT_ID, t2.EVENT_ID +LIMIT 5; +THREAD_ID EVENT_ID EVENT_NAME TIMER_WAIT +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +[THREAD_ID] [EVENT_ID] [EVENT_NAME] [TIMER_WAIT] +SELECT THREAD_ID, EVENT_ID FROM ( +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +) t1 ORDER BY THREAD_ID, EVENT_ID +LIMIT 5; +THREAD_ID EVENT_ID +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +[THREAD_ID] [EVENT_ID] +CREATE EVENT t_ps_event +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND +DO SELECT DISTINCT EVENT_ID +FROM performance_schema.EVENTS_WAITS_CURRENT +JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) +ORDER BY EVENT_ID +LIMIT 1; +ALTER TABLE t1 ADD COLUMN c INT; +CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 +FOR EACH ROW BEGIN +SET NEW.c = (SELECT MAX(EVENT_ID) +FROM performance_schema.EVENTS_WAITS_CURRENT); +END; +| +INSERT INTO t1 (id) VALUES (11), (12), (13); +SELECT id, c FROM t1 WHERE id > 10 ORDER BY c; +id c +11 [EVENT_ID] +12 [EVENT_ID] +13 [EVENT_ID] +DROP TRIGGER t_ps_trigger; +CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) +BEGIN +SELECT id FROM performance_schema.PROCESSLIST +WHERE THREAD_ID = tid INTO pid; +END; +| +CALL t_ps_proc(0, @p_id); +CREATE FUNCTION t_ps_func(tid INT) RETURNS int +BEGIN +return (SELECT id FROM performance_schema.PROCESSLIST +WHERE THREAD_ID = tid); +END; +| +SELECT t_ps_func(0) = @p_id; +t_ps_func(0) = @p_id +1 +DROP PROCEDURE t_ps_proc; +DROP FUNCTION t_ps_func; +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result new file mode 100644 index 00000000000..ac340f8eb67 --- /dev/null +++ b/mysql-test/suite/perfschema/r/server_init.result @@ -0,0 +1,233 @@ +use performance_schema; +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_threads"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_malloc"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_open"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_isam"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_net"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_charset"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/mysys/THR_LOCK_time"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/mysys/THR_COND_threads"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_mysql_create_db"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_open"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_lock_db"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_thread_count"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_mapped_file"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_status"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_error_log"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_delayed_status"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_delayed_create"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_crypt"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_slave_list"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_active_mi"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_manager"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_global_read_lock"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_global_system_variables"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_user_conn"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_connection_count"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_server_started"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_rpl_status"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOG_INFO::lock"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_event_metadata"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_event_queue"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_user_locks"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/Cversion_lock"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_xid_cache"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_plugin"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/LOCK_gdl"; +count(name) +1 +select count(name) from MUTEX_INSTANCES +where name like "wait/synch/mutex/sql/tz_LOCK"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_grant"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave"; +count(name) +1 +select count(name) from RWLOCK_INSTANCES +where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_server_started"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_refresh"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_thread_count"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_manager"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_global_read_lock"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_thread_cache"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_flush_thread_cache"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_rpl_status"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; +count(name) +1 +select count(name) from COND_INSTANCES +where name like "wait/synch/cond/sql/COND_queue_state"; +count(name) +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result new file mode 100644 index 00000000000..d6089139d5a --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 0 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_cond_classes"; +Variable_name Value +performance_schema_max_cond_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/cond/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.COND_INSTANCES; +count(*) +0 +show status like "performance_schema_cond_instances_lost"; +Variable_name Value +Performance_schema_cond_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result new file mode 100644 index 00000000000..eaa04c7629d --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 0 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_cond_classes"; +Variable_name Value +performance_schema_max_cond_classes 80 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/cond/%"; +count(*) > 0 +1 +show status like "performance_schema_cond_classes_lost"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +show variables like "performance_schema_max_cond_instances"; +Variable_name Value +performance_schema_max_cond_instances 0 +select count(*) from performance_schema.COND_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_COND_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result new file mode 100644 index 00000000000..d68ec00a456 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 0 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_file_classes"; +Variable_name Value +performance_schema_max_file_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/io/file/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.FILE_INSTANCES; +count(*) +0 +show status like "performance_schema_file_instances_lost"; +Variable_name Value +Performance_schema_file_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result new file mode 100644 index 00000000000..258712ebf68 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 0 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_file_classes"; +Variable_name Value +performance_schema_max_file_classes 50 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/io/file/%"; +count(*) > 0 +1 +show status like "performance_schema_file_classes_lost"; +Variable_name Value +Performance_schema_file_classes_lost 0 +show variables like "performance_schema_max_file_instances"; +Variable_name Value +performance_schema_max_file_instances 0 +select count(*) from performance_schema.FILE_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_FILE_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result new file mode 100644 index 00000000000..d221cb2c22a --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 0 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_mutex_classes"; +Variable_name Value +performance_schema_max_mutex_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/mutex/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.MUTEX_INSTANCES; +count(*) +0 +show status like "performance_schema_mutex_instances_lost"; +Variable_name Value +Performance_schema_mutex_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result new file mode 100644 index 00000000000..adfd4c5ec17 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 0 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_mutex_classes"; +Variable_name Value +performance_schema_max_mutex_classes 200 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/mutex/%"; +count(*) > 0 +1 +show status like "performance_schema_mutex_classes_lost"; +Variable_name Value +Performance_schema_mutex_classes_lost 0 +show variables like "performance_schema_max_mutex_instances"; +Variable_name Value +performance_schema_max_mutex_instances 0 +select count(*) from performance_schema.MUTEX_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result new file mode 100644 index 00000000000..5248becf0e5 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 0 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_rwlock_classes"; +Variable_name Value +performance_schema_max_rwlock_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.RWLOCK_INSTANCES; +count(*) +0 +show status like "performance_schema_rwlock_instances_lost"; +Variable_name Value +Performance_schema_rwlock_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result new file mode 100644 index 00000000000..e7a94c4a60d --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -0,0 +1,77 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 0 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_rwlock_classes"; +Variable_name Value +performance_schema_max_rwlock_classes 20 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +where name like "wait/synch/rwlock/%"; +count(*) > 0 +1 +show status like "performance_schema_rwlock_classes_lost"; +Variable_name Value +Performance_schema_rwlock_classes_lost 0 +show variables like "performance_schema_max_rwlock_instances"; +Variable_name Value +performance_schema_max_rwlock_instances 0 +select count(*) from performance_schema.RWLOCK_INSTANCES; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result new file mode 100644 index 00000000000..92f1ec29b38 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -0,0 +1,74 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 0 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_thread_classes"; +Variable_name Value +performance_schema_max_thread_classes 0 +select count(*) from performance_schema.SETUP_INSTRUMENTS +where name like "thread/%"; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST'; +variable_value > 0 +1 +select count(*) from performance_schema.PROCESSLIST; +count(*) +0 +show status like "performance_schema_thread_instances_lost"; +Variable_name Value +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result new file mode 100644 index 00000000000..3ecf7fe98db --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -0,0 +1,73 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 0 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show variables like "performance_schema_max_thread_classes"; +Variable_name Value +performance_schema_max_thread_classes 50 +show status like "performance_schema_thread_classes_lost"; +Variable_name Value +Performance_schema_thread_classes_lost 0 +show variables like "performance_schema_max_thread_instances"; +Variable_name Value +performance_schema_max_thread_instances 0 +select count(*) from performance_schema.PROCESSLIST; +count(*) +0 +select variable_value > 0 from information_schema.global_status +where variable_name like 'PERFORMANCE_SCHEMA_THREAD_INSTANCES_LOST'; +variable_value > 0 +1 diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result new file mode 100644 index 00000000000..4ce5aa75ce7 --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -0,0 +1,73 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +0 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema OFF +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show status like "performance_schema%"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result new file mode 100644 index 00000000000..1d9dc731c7b --- /dev/null +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -0,0 +1,73 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.PERFORMANCE_TIMERS; +count(*) +5 +select count(*) from performance_schema.SETUP_CONSUMERS; +count(*) +8 +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS; +count(*) > 0 +1 +select count(*) from performance_schema.SETUP_TIMERS; +count(*) +1 +select * from performance_schema.COND_INSTANCES; +select * from performance_schema.EVENTS_WAITS_CURRENT; +select * from performance_schema.EVENTS_WAITS_HISTORY; +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +select * from performance_schema.FILE_INSTANCES; +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE; +select * from performance_schema.MUTEX_INSTANCES; +select * from performance_schema.PERFORMANCE_TIMERS; +select * from performance_schema.PROCESSLIST; +select * from performance_schema.RWLOCK_INSTANCES; +select * from performance_schema.SETUP_CONSUMERS; +select * from performance_schema.SETUP_INSTRUMENTS; +select * from performance_schema.SETUP_OBJECTS; +select * from performance_schema.SETUP_TIMERS; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 1000 +performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_instances 1000 +performance_schema_max_table_handles 100000 +performance_schema_max_table_instances 50000 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 1000 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +show status like "performance_schema%"; +Variable_name Value +Performance_schema_cond_classes_lost 0 +Performance_schema_cond_instances_lost 0 +Performance_schema_file_classes_lost 0 +Performance_schema_file_handles_lost 0 +Performance_schema_file_instances_lost 0 +Performance_schema_locker_lost 0 +Performance_schema_mutex_classes_lost 0 +Performance_schema_mutex_instances_lost 0 +Performance_schema_rwlock_classes_lost 0 +Performance_schema_rwlock_instances_lost 0 +Performance_schema_table_handles_lost 0 +Performance_schema_table_instances_lost 0 +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 diff --git a/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result new file mode 100644 index 00000000000..cdf0029eeb9 --- /dev/null +++ b/mysql-test/suite/perfschema/r/tampered_perfschema_table1.result @@ -0,0 +1,6 @@ +call mtr.add_suppression( +"Column count of mysql.SETUP_INSTRUMENTS is wrong. " +"Expected 4, found 3. The table is probably corrupted"); +select * from performance_schema.SETUP_INSTRUMENTS limit 1; +ERROR HY000: Native table 'performance_schema'.'SETUP_INSTRUMENTS' has the wrong structure +select * from performance_schema.SETUP_CONSUMERS limit 1; diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test new file mode 100644 index 00000000000..7c01bdd0a4b --- /dev/null +++ b/mysql-test/suite/perfschema/t/aggregate.test @@ -0,0 +1,187 @@ +# 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 +# Verify that statistics aggregated by different criteria are consistent. + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--echo "General cleanup" + +--disable_warnings +drop table if exists t1; +--enable_warnings + +update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO'; +update performance_schema.SETUP_CONSUMERS set enabled = 'NO'; + +# Cleanup statistics +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; + +# Start recording data +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS + set enabled = 'YES', timed = 'YES'; + + +create table t1 ( + id INT PRIMARY KEY, + b CHAR(100) DEFAULT 'initial value') + ENGINE=MyISAM; + +insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8); + +# Stop recording data, so the select below don't add noise. +update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO'; + +# Helper to debug +set @dump_all=FALSE; + +# Note that in general: +# - COUNT/SUM/MAX(FILE_SUMMARY_BY_EVENT_NAME) >= +# COUNT/SUM/MAX(FILE_SUMMARY_BY_INSTANCE). +# - MIN(FILE_SUMMARY_BY_EVENT_NAME) <= +# MIN(FILE_SUMMARY_BY_INSTANCE). +# There will be equality only when file instances are not removed, +# aka when a file is not deleted from the file system, +# because doing so removes a row in FILE_SUMMARY_BY_INSTANCE. + +# Likewise: +# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >= +# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_INSTANCE) +# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <= +# MIN(EVENTS_WAITS_SUMMARY_BY_INSTANCE) +# There will be equality only when an instrument instance +# is not removed, which is next to impossible to predictably guarantee +# in the server. +# For example, a MyISAM table removed from the table cache +# will cause a mysql_mutex_destroy on myisam/MYISAM_SHARE::intern_lock. +# Another example, a thread terminating will cause a mysql_mutex_destroy +# on sql/LOCK_delete +# Both cause a row to be deleted from EVENTS_WAITS_SUMMARY_BY_INSTANCE. + +# Likewise: +# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >= +# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME) +# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <= +# MIN(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME) +# There will be equality only when no thread is removed, +# that is if no thread disconnects, or no sub thread (for example insert +# delayed) ever completes. +# A thread completing will cause rows in +# EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME to be removed. + +--echo "Verifying file aggregate consistency" + +# Since the code generating the load in this test does: +# - create table +# - insert +# - does not cause temporary tables to be used +# we can test for equality here for file aggregates. + +# If any of these queries returns data, the test failed. + +SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_READ <> SUM(i.COUNT_READ)) +OR @dump_all; + +SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE)) +OR @dump_all; + +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ)) +OR @dump_all; + +SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE) +FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE)) +OR @dump_all; + +--echo "Verifying waits aggregate consistency (instance)" + +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT)) +OR @dump_all; + +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT)) +AND (MIN(i.MIN_TIMER_WAIT) != 0) +OR @dump_all; + +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT)) +OR @dump_all; + +--echo "Verifying waits aggregate consistency (thread)" + +SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT)) +OR @dump_all; + +SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT)) +AND (MIN(t.MIN_TIMER_WAIT) != 0) +OR @dump_all; + +SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT) +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e +JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t +USING (EVENT_NAME) +GROUP BY EVENT_NAME +HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT)) +OR @dump_all; + + +# Cleanup + +update performance_schema.SETUP_CONSUMERS set enabled = 'YES'; +update performance_schema.SETUP_INSTRUMENTS + set enabled = 'YES', timed = 'YES'; + +drop table test.t1; diff --git a/mysql-test/suite/perfschema/t/bad_option_1.test b/mysql-test/suite/perfschema/t/bad_option_1.test new file mode 100644 index 00000000000..9962f327093 --- /dev/null +++ b/mysql-test/suite/perfschema/t/bad_option_1.test @@ -0,0 +1,45 @@ +# 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 +# Check error handling for invalid server start options + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--error 7 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-enabled=maybe > $MYSQLTEST_VARDIR/tmp/bad_option_1.txt 2>&1 + +perl; + use strict; + use warnings; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_1.txt"; + open(FILE, "<", $fname) or die; + my @lines= <FILE>; + # those must be in the file for the test to pass + my @patterns= + ("unknown variable 'performance-schema-enabled=maybe'", + "Aborting"); + foreach my $one_line (@lines) + { + foreach my $one_pattern (@patterns) + { + # print pattern, not line, to get a stable output + print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/); + } + } + close FILE; +EOF + diff --git a/mysql-test/suite/perfschema/t/bad_option_2.test b/mysql-test/suite/perfschema/t/bad_option_2.test new file mode 100644 index 00000000000..a8d15764864 --- /dev/null +++ b/mysql-test/suite/perfschema/t/bad_option_2.test @@ -0,0 +1,44 @@ +# 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 +# Check error handling for ambiguous server start options + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--error 3 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-max_=12 > $MYSQLTEST_VARDIR/tmp/bad_option_2.txt 2>&1 + +perl; + use strict; + use warnings; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_2.txt"; + open(FILE, "<", $fname) or die; + my @lines= <FILE>; + # those must be in the file for the test to pass + my @patterns= + ("ambiguous option '--performance-schema-max_=12'"); + foreach my $one_line (@lines) + { + foreach my $one_pattern (@patterns) + { + # print pattern, not line, to get a stable output + print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/); + } + } + close FILE; +EOF + diff --git a/mysql-test/suite/perfschema/t/binlog_mix.test b/mysql-test/suite/perfschema/t/binlog_mix.test new file mode 100644 index 00000000000..4fe7d68b555 --- /dev/null +++ b/mysql-test/suite/perfschema/t/binlog_mix.test @@ -0,0 +1,28 @@ +# 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 + +--source include/have_log_bin.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# See Bug#46896 binlog: case sensitivity of table names +--source include/have_lowercase0.inc + +set binlog_format=mixed; + +--source ../include/binlog_common.inc + diff --git a/mysql-test/suite/perfschema/t/binlog_row.test b/mysql-test/suite/perfschema/t/binlog_row.test new file mode 100644 index 00000000000..c1c1e06d3f0 --- /dev/null +++ b/mysql-test/suite/perfschema/t/binlog_row.test @@ -0,0 +1,28 @@ +# 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 + +--source include/have_log_bin.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# See Bug#46896 binlog: case sensitivity of table names +--source include/have_lowercase0.inc + +set binlog_format=row; + +--source ../include/binlog_common.inc + diff --git a/mysql-test/suite/perfschema/t/binlog_stmt.test b/mysql-test/suite/perfschema/t/binlog_stmt.test new file mode 100644 index 00000000000..759c34634c8 --- /dev/null +++ b/mysql-test/suite/perfschema/t/binlog_stmt.test @@ -0,0 +1,25 @@ +# 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 + +--source include/have_log_bin.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +set binlog_format=statement; + +--source ../include/binlog_common.inc + diff --git a/mysql-test/suite/perfschema/t/cnf_option.cnf b/mysql-test/suite/perfschema/t/cnf_option.cnf new file mode 100644 index 00000000000..2892908fbb6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/cnf_option.cnf @@ -0,0 +1,25 @@ +# 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 +# Check server start options, read from a .cnf file + +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +loose-performance-schema-max-thread_instances=318 +loose-performance-schema-max-thread_classes=12 + diff --git a/mysql-test/suite/perfschema/t/cnf_option.test b/mysql-test/suite/perfschema/t/cnf_option.test new file mode 100644 index 00000000000..c968307ee00 --- /dev/null +++ b/mysql-test/suite/perfschema/t/cnf_option.test @@ -0,0 +1,24 @@ +# 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 +# Check server start options, read from a .cnf file + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +show variables like 'performance_schema_max_thread_classes'; +show variables like 'performance_schema_max_thread_instances'; + diff --git a/mysql-test/suite/perfschema/t/column_privilege.test b/mysql-test/suite/perfschema/t/column_privilege.test new file mode 100644 index 00000000000..b6bcbdb3396 --- /dev/null +++ b/mysql-test/suite/perfschema/t/column_privilege.test @@ -0,0 +1,82 @@ +# 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 +# Test how columns privileges can be used on performance schema tables, +# for very fine control. + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +show grants; + +grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION; + +# Test per column privileges on performance_schema + +grant SELECT(thread_id, event_id) on performance_schema.EVENTS_WAITS_CURRENT + to 'pfs_user_5'@localhost; + +grant UPDATE(enabled) on performance_schema.SETUP_INSTRUMENTS + to 'pfs_user_5'@localhost; + +flush privileges; + +connect (con1, localhost, pfs_user_5, , ); + +# Commented because the result is not consistent (uppercase/lowercase) +# show grants; + +# For statements that works, we do not look at the output +--disable_result_log + +select thread_id from performance_schema.EVENTS_WAITS_CURRENT; + +select thread_id, event_id from performance_schema.EVENTS_WAITS_CURRENT; + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; + +--enable_result_log + +# For statements that are denied, check the error number and error text. + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_COLUMNACCESS_DENIED_ERROR +select event_name from performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_COLUMNACCESS_DENIED_ERROR +select thread_id, event_id, event_name + from performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_COLUMNACCESS_DENIED_ERROR +update performance_schema.SETUP_INSTRUMENTS set name='illegal'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_COLUMNACCESS_DENIED_ERROR +update performance_schema.SETUP_INSTRUMENTS set timed='NO'; + +# Cleanup + +--connection default +--disconnect con1 +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost; +DROP USER 'pfs_user_5'@localhost; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; + diff --git a/mysql-test/suite/perfschema/t/ddl_cond_instances.test b/mysql-test/suite/perfschema/t/ddl_cond_instances.test new file mode 100644 index 00000000000..e78429cb181 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_cond_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.COND_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.COND_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_current.test b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test new file mode 100644 index 00000000000..34f735c1271 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_current.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_CURRENT add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_CURRENT; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_CURRENT ADD INDEX test_index(EVENT_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_CURRENT(EVENT_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test new file mode 100644 index 00000000000..76ebe3d85c4 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_HISTORY add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_HISTORY; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY ADD INDEX test_index(EVENT_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY(EVENT_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test new file mode 100644 index 00000000000..549c5d6880b --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_events_waits_history_long.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_HISTORY_LONG add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG ADD INDEX test_index(EVENT_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_HISTORY_LONG(EVENT_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test new file mode 100644 index 00000000000..fbf2d2925a7 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test new file mode 100644 index 00000000000..e6dad07fd63 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_instance.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE ADD INDEX test_index(EVENT_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE(EVENT_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test new file mode 100644 index 00000000000..5b65ec26064 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_ews_by_thread_by_event_name.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + add column foo integer; + +truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME ADD INDEX test_index(THREAD_ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index + ON performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME(THREAD_ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_file_instances.test b/mysql-test/suite/perfschema/t/ddl_file_instances.test new file mode 100644 index 00000000000..a9c9a2a95b6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_file_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.FILE_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.FILE_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.FILE_INSTANCES ADD INDEX test_index(FILE_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_INSTANCES(FILE_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test new file mode 100644 index 00000000000..2581f07c0d2 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_fs_by_event_name.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.FILE_SUMMARY_BY_EVENT_NAME add column foo integer; + +truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.FILE_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_EVENT_NAME(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test new file mode 100644 index 00000000000..e06ad2eb7cd --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_fs_by_instance.test @@ -0,0 +1,31 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.FILE_SUMMARY_BY_INSTANCE add column foo integer; + +truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.FILE_SUMMARY_BY_INSTANCE ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.FILE_SUMMARY_BY_INSTANCE(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_mutex_instances.test b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test new file mode 100644 index 00000000000..6489a689620 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_mutex_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.MUTEX_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.MUTEX_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.MUTEX_INSTANCES ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.MUTEX_INSTANCES(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_performance_timers.test b/mysql-test/suite/perfschema/t/ddl_performance_timers.test new file mode 100644 index 00000000000..b692291b8cf --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_performance_timers.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.PERFORMANCE_TIMERS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.PERFORMANCE_TIMERS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.PERFORMANCE_TIMERS ADD INDEX test_index(TIMER_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.PERFORMANCE_TIMERS(TIMER_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_processlist.test b/mysql-test/suite/perfschema/t/ddl_processlist.test new file mode 100644 index 00000000000..fb133b66e26 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_processlist.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.PROCESSLIST add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.PROCESSLIST; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID); + diff --git a/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test new file mode 100644 index 00000000000..c07cd1ede48 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_rwlock_instances.test @@ -0,0 +1,32 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.RWLOCK_INSTANCES add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.RWLOCK_INSTANCES; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.RWLOCK_INSTANCES ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.RWLOCK_INSTANCES(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_consumers.test b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test new file mode 100644 index 00000000000..c44db822145 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_consumers.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_CONSUMERS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.SETUP_CONSUMERS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_CONSUMERS ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_CONSUMERS(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_instruments.test b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test new file mode 100644 index 00000000000..c20c386447c --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_instruments.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_INSTRUMENTS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.SETUP_INSTRUMENTS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_INSTRUMENTS ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_INSTRUMENTS(NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_objects.test b/mysql-test/suite/perfschema/t/ddl_setup_objects.test new file mode 100644 index 00000000000..6ae6156ef00 --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_objects.test @@ -0,0 +1,32 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_objects' '\'SETUP_OBJECTS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_OBJECTS add column foo integer; + +truncate table performance_schema.SETUP_OBJECTS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME); + diff --git a/mysql-test/suite/perfschema/t/ddl_setup_timers.test b/mysql-test/suite/perfschema/t/ddl_setup_timers.test new file mode 100644 index 00000000000..b9a5c32ecbe --- /dev/null +++ b/mysql-test/suite/perfschema/t/ddl_setup_timers.test @@ -0,0 +1,33 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +-- error ER_DBACCESS_DENIED_ERROR +alter table performance_schema.SETUP_TIMERS add column foo integer; + +-- error ER_WRONG_PERFSCHEMA_USAGE +truncate table performance_schema.SETUP_TIMERS; + +-- error ER_DBACCESS_DENIED_ERROR +ALTER TABLE performance_schema.SETUP_TIMERS ADD INDEX test_index(NAME); + +-- error ER_DBACCESS_DENIED_ERROR +CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_TIMERS(NAME); + diff --git a/mysql-test/suite/perfschema/t/disabled.def b/mysql-test/suite/perfschema/t/disabled.def new file mode 100644 index 00000000000..56bcf811ff6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/disabled.def @@ -0,0 +1,27 @@ +# 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 + +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + diff --git a/mysql-test/suite/perfschema/t/dml_cond_instances.test b/mysql-test/suite/perfschema/t/dml_cond_instances.test new file mode 100644 index 00000000000..1d1614db73f --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_cond_instances.test @@ -0,0 +1,55 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # +select * from performance_schema.COND_INSTANCES limit 1; + +select * from performance_schema.COND_INSTANCES + where name='FOO'; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.COND_INSTANCES + set name='FOO', object_instance_begin=12; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.COND_INSTANCES + set name='FOO'; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.COND_INSTANCES + where name like "wait/%"; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.COND_INSTANCES; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.COND_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'cond_instances' '\'COND_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.COND_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_current.test b/mysql-test/suite/perfschema/t/dml_events_waits_current.test new file mode 100644 index 00000000000..3a93b98cb57 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_events_waits_current.test @@ -0,0 +1,62 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_CURRENT + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_CURRENT + where event_name='FOO'; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_CURRENT + set thread_id='1', event_id=1, + event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_CURRENT + set timer_start=12; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_CURRENT + set timer_start=12 where thread_id=0; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_CURRENT + where thread_id=1; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_CURRENT WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history.test b/mysql-test/suite/perfschema/t/dml_events_waits_history.test new file mode 100644 index 00000000000..174ef2147d1 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_events_waits_history.test @@ -0,0 +1,70 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name='FOO'; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name like 'Wait/Synch/%' order by timer_wait limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY + where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_HISTORY + set thread_id='1', event_id=1, + event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY + set timer_start=12; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY + set timer_start=12 where thread_id=0; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY + where thread_id=1; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test new file mode 100644 index 00000000000..73dc0aefd06 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_events_waits_history_long.test @@ -0,0 +1,70 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name='FOO'; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name like 'Wait/Synch/%' order by timer_wait limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 12 # 14 # +select * from performance_schema.EVENTS_WAITS_HISTORY_LONG + where event_name like 'Wait/Synch/%' order by timer_wait desc limit 1; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_HISTORY_LONG + set thread_id='1', event_id=1, + event_name='FOO', timer_start=1, timer_end=2, timer_wait=3; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY_LONG + set timer_start=12; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_HISTORY_LONG + set timer_start=12 where thread_id=0; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG + where thread_id=1; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_HISTORY_LONG; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_HISTORY_LONG WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test new file mode 100644 index 00000000000..c1fddbe9f87 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test @@ -0,0 +1,62 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + where event_name='FOO'; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3, + avg_timer_wait=4, max_timer_wait=5; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + set count_star=12; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + set count_star=12 where event_name like "FOO"; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME + where count_star=1; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_instance.test b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test new file mode 100644 index 00000000000..4c386313bc5 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test @@ -0,0 +1,79 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where event_name='FOO'; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + order by count_star limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + order by count_star desc limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where min_timer_wait > 0 order by count_star limit 1; + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where min_timer_wait > 0 order by count_star desc limit 1; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + set event_name='FOO', object_instance_begin=0, + count_star=1, sum_timer_wait=2, min_timer_wait=3, + avg_timer_wait=4, max_timer_wait=5; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + set count_star=12; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + set count_star=12 where event_name like "FOO"; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE + where count_star=1; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test new file mode 100644 index 00000000000..ce29e59d014 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test @@ -0,0 +1,63 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + where event_name like 'Wait/Synch/%' limit 1; + +select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + where event_name='FOO'; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + set event_name='FOO', thread_id=1, + count_star=1, sum_timer_wait=2, min_timer_wait=3, + avg_timer_wait=4, max_timer_wait=5; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + set count_star=12; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + set count_star=12 where event_name like "FOO"; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME + where count_star=1; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME READ; +UNLOCK TABLES; + +--replace_result '\'events_waits_summary_by_thread_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_file_instances.test b/mysql-test/suite/perfschema/t/dml_file_instances.test new file mode 100644 index 00000000000..71a053c21be --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_file_instances.test @@ -0,0 +1,55 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # +select * from performance_schema.FILE_INSTANCES limit 1; + +select * from performance_schema.FILE_INSTANCES + where file_name='FOO'; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.FILE_INSTANCES + set file_name='FOO', event_name='BAR', open_count=12; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_INSTANCES + set file_name='FOO'; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_INSTANCES + where event_name like "wait/%"; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_INSTANCES; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test new file mode 100644 index 00000000000..3753f581560 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test @@ -0,0 +1,62 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME + where event_name like 'Wait/io/%' limit 1; + +select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME + where event_name='FOO'; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.FILE_SUMMARY_BY_EVENT_NAME + set event_name='FOO', count_read=1, count_write=2, + sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME + set count_read=12; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_EVENT_NAME + set count_write=12 where event_name like "FOO"; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME + where count_read=1; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_EVENT_NAME; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME READ; +UNLOCK TABLES; + +--replace_result '\'file_summary_by_event_name' '\'FILE_SUMMARY_BY_EVENT_NAME' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_EVENT_NAME WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test new file mode 100644 index 00000000000..07372af5f36 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test @@ -0,0 +1,62 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE + where event_name like 'Wait/io/%' limit 1; + +select * from performance_schema.FILE_SUMMARY_BY_INSTANCE + where event_name='FOO'; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.FILE_SUMMARY_BY_INSTANCE + set event_name='FOO', count_read=1, count_write=2, + sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_INSTANCE + set count_read=12; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.FILE_SUMMARY_BY_INSTANCE + set count_write=12 where event_name like "FOO"; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE + where count_read=1; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.FILE_SUMMARY_BY_INSTANCE; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE READ; +UNLOCK TABLES; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.FILE_SUMMARY_BY_INSTANCE WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_mutex_instances.test b/mysql-test/suite/perfschema/t/dml_mutex_instances.test new file mode 100644 index 00000000000..e3062c7b34c --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_mutex_instances.test @@ -0,0 +1,55 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # +select * from performance_schema.MUTEX_INSTANCES limit 1; + +select * from performance_schema.MUTEX_INSTANCES + where name='FOO'; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.MUTEX_INSTANCES + set name='FOO', object_instance_begin=12; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.MUTEX_INSTANCES + set name='FOO'; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.MUTEX_INSTANCES + where name like "wait/%"; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.MUTEX_INSTANCES; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.MUTEX_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'mutex_instances' '\'MUTEX_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.MUTEX_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_performance_timers.test b/mysql-test/suite/perfschema/t/dml_performance_timers.test new file mode 100644 index 00000000000..9c2efb6f709 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_performance_timers.test @@ -0,0 +1,57 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 2 <frequency> 3 <resolution> 4 <overhead> +select * from performance_schema.PERFORMANCE_TIMERS; + +--replace_column 2 <frequency> 3 <resolution> 4 <overhead> +select * from performance_schema.PERFORMANCE_TIMERS + where timer_name='CYCLE'; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.PERFORMANCE_TIMERS + set timer_name='FOO', timer_frequency=1, + timer_resolution=2, timer_overhead=3; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.PERFORMANCE_TIMERS + set timer_frequency=12 where timer_name='CYCLE'; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PERFORMANCE_TIMERS; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PERFORMANCE_TIMERS + where timer_name='CYCLE'; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PERFORMANCE_TIMERS READ; +UNLOCK TABLES; + +--replace_result '\'performance_timers' '\'PERFORMANCE_TIMERS' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PERFORMANCE_TIMERS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_processlist.test b/mysql-test/suite/perfschema/t/dml_processlist.test new file mode 100644 index 00000000000..6062b8481f0 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_processlist.test @@ -0,0 +1,61 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # 3 # +select * from performance_schema.PROCESSLIST + where name like 'Thread/%' limit 1; + +select * from performance_schema.PROCESSLIST + where name='FOO'; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.PROCESSLIST + set name='FOO', thread_id=1, id=2; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.PROCESSLIST + set thread_id=12; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.PROCESSLIST + set thread_id=12 where name like "FOO"; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PROCESSLIST + where id=1; + +--replace_result '\'processlist' '\'PROCESSLIST' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.PROCESSLIST; + +--replace_result '\'processlist' '\'PROCESSLIST' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PROCESSLIST READ; +UNLOCK TABLES; + +--replace_result '\'processlist' '\'PROCESSLIST' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.PROCESSLIST WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test new file mode 100644 index 00000000000..251168237eb --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test @@ -0,0 +1,55 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--replace_column 1 # 2 # +select * from performance_schema.RWLOCK_INSTANCES limit 1; + +select * from performance_schema.RWLOCK_INSTANCES + where name='FOO'; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.RWLOCK_INSTANCES + set name='FOO', object_instance_begin=12; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +update performance_schema.RWLOCK_INSTANCES + set name='FOO'; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.RWLOCK_INSTANCES + where name like "wait/%"; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.RWLOCK_INSTANCES; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.RWLOCK_INSTANCES READ; +UNLOCK TABLES; + +--replace_result '\'rwlock_instances' '\'RWLOCK_INSTANCES' +-- error ER_TABLEACCESS_DENIED_ERROR +LOCK TABLES performance_schema.RWLOCK_INSTANCES WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_consumers.test b/mysql-test/suite/perfschema/t/dml_setup_consumers.test new file mode 100644 index 00000000000..85b65864f91 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_consumers.test @@ -0,0 +1,59 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +select * from performance_schema.SETUP_CONSUMERS; + +select * from performance_schema.SETUP_CONSUMERS + where name='events_waits_current'; + +select * from performance_schema.SETUP_CONSUMERS + where enabled='YES'; + +select * from performance_schema.SETUP_CONSUMERS + where enabled='NO'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.SETUP_CONSUMERS + set name='FOO', enabled='YES'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.SETUP_CONSUMERS + set name='FOO'; + +update performance_schema.SETUP_CONSUMERS + set enabled='YES'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_CONSUMERS; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_CONSUMERS + where name='events_waits_current'; + +LOCK TABLES performance_schema.SETUP_CONSUMERS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_CONSUMERS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test new file mode 100644 index 00000000000..f737160cebd --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test @@ -0,0 +1,100 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# The query result are not re producible, +# due to variations in platforms and plugins +# We still execute the select statement, for: +# - code coverage +# - make sure it does not crash +# - valgrind coverage + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log + +# DEBUG_SYNC::mutex is dependent on the build (DEBUG only) + +select * from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/Mutex/sql/%' + and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex') + order by name limit 10; + +select * from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/Rwlock/sql/%' + order by name limit 10; + +# COND_handler_count is dependent on the build (Windows only) +# DEBUG_SYNC::cond is dependent on the build (DEBUG only) + +select * from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/Cond/sql/%' + and name not in ( + 'wait/synch/cond/sql/COND_handler_count', + 'wait/synch/cond/sql/DEBUG_SYNC::cond') + order by name limit 10; + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS + where name='Wait'; +--enable_result_log + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS + where enabled='YES'; +--enable_result_log + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.SETUP_INSTRUMENTS + set name='FOO', enabled='YES', timed='YES'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.SETUP_INSTRUMENTS + set name='FOO'; + +update performance_schema.SETUP_INSTRUMENTS + set enabled='NO'; + +update performance_schema.SETUP_INSTRUMENTS + set timed='NO'; + +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log + +update performance_schema.SETUP_INSTRUMENTS + set enabled='YES', timed='YES'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_INSTRUMENTS; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_INSTRUMENTS + where name like 'Wait/Synch/%'; + +LOCK TABLES performance_schema.SETUP_INSTRUMENTS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_INSTRUMENTS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_objects.test b/mysql-test/suite/perfschema/t/dml_setup_objects.test new file mode 100644 index 00000000000..21fac64d924 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_objects.test @@ -0,0 +1,75 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +select * from performance_schema.SETUP_OBJECTS; + +select * from performance_schema.SETUP_OBJECTS + where object_type = 'TABLE'; + +select * from performance_schema.SETUP_OBJECTS + where enabled='YES'; + +# Not implemented yet +--replace_result '\'setup_objects' '\'SETUP_OBJECTS' +--error ER_ILLEGAL_HA +insert into performance_schema.SETUP_OBJECTS + set object_type='TABLE', object_schema='FOO', object_name='BAR', + enabled='YES', timed='YES', aggregated='YES'; + +# Not implemented yet +# --error ER_ILLEGAL_HA +update performance_schema.SETUP_OBJECTS + set object_type='TABLE'; + +# Not implemented yet +# --error ER_ILLEGAL_HA +update performance_schema.SETUP_OBJECTS + set object_schema='ILLEGAL'; + +# Not implemented yet +# --error ER_ILLEGAL_HA +update performance_schema.SETUP_OBJECTS + set object_name='ILLEGAL'; + +update performance_schema.SETUP_OBJECTS + set enabled='NO'; + +update performance_schema.SETUP_OBJECTS + set timed='NO'; + +update performance_schema.SETUP_OBJECTS + set aggregated='NO'; + +select * from performance_schema.SETUP_OBJECTS; + +update performance_schema.SETUP_OBJECTS + set enabled='YES', timed='YES', aggregated='YES'; + +delete from performance_schema.SETUP_OBJECTS + where object_type = 'TABLE'; + +delete from performance_schema.SETUP_OBJECTS; + +LOCK TABLES performance_schema.SETUP_OBJECTS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_OBJECTS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/dml_setup_timers.test b/mysql-test/suite/perfschema/t/dml_setup_timers.test new file mode 100644 index 00000000000..5b5850db575 --- /dev/null +++ b/mysql-test/suite/perfschema/t/dml_setup_timers.test @@ -0,0 +1,61 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +select * from performance_schema.SETUP_TIMERS; + +select * from performance_schema.SETUP_TIMERS + where name='Wait'; + +select * from performance_schema.SETUP_TIMERS + where timer_name='CYCLE'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.SETUP_TIMERS + set name='FOO', timer_name='CYCLE'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.SETUP_TIMERS + set name='FOO'; + +update performance_schema.SETUP_TIMERS + set timer_name='MILLISECOND'; + +select * from performance_schema.SETUP_TIMERS; + +update performance_schema.SETUP_TIMERS + set timer_name='CYCLE'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_TIMERS; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.SETUP_TIMERS + where name='Wait'; + +LOCK TABLES performance_schema.SETUP_TIMERS READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.SETUP_TIMERS WRITE; +UNLOCK TABLES; + diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test new file mode 100644 index 00000000000..4317f68d13b --- /dev/null +++ b/mysql-test/suite/perfschema/t/func_file_io.test @@ -0,0 +1,192 @@ +# Copyright (C) 2008-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 + +## +## WL#4814, 4.1.4 FILE IO +## +## Functional testing of File IO +## + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# +# TODO: Change to InnoDB when it gets instrumentation +# + +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; + +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +# +# FF1: Count for file should increase with instrumentation enabled and +# FF2: Count for file should not increase with instrumentation disabled +# + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD')); + +SELECT IF(@before_count > 0, 'Success', 'Failure') has_instrumentation; + +SELECT * FROM t1 WHERE id < 4; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1)); + +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled='NO'; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD') AND (2 = 2)); + +SELECT * FROM t1 WHERE id < 6; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/io/file/myisam/dfile') + AND (OBJECT_NAME LIKE '%t1.MYD') AND (3 = 3)); + +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_ff2_timed; + +# +# Check not timed measurements +# + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/io/file/%'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'NO'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id > 4; + +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +WHERE TIMER_WAIT != NULL + OR TIMER_START != NULL + OR TIMER_END != NULL; + +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE TIMER_WAIT != NULL + OR TIMER_START != NULL + OR TIMER_END != NULL; + +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE TIMER_WAIT != NULL + OR TIMER_START != NULL + OR TIMER_END != NULL; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET timed = 'YES'; + +SELECT * FROM t1 WHERE id < 4; + +DROP TABLE t1; + +# +# FF4: Use-case from Enterprise Monitor +# + +--disable_result_log +SELECT SUM(COUNT_READ) AS sum_count_read, + SUM(COUNT_WRITE) AS sum_count_write, + SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, + SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; +--enable_result_log + +# +# FF5: Troubleshooting tasks +# +# These queries will give different results based on timing, +# but at least they should not crash. +# + +# +# Total and average wait time for different events on system level +# +--disable_result_log +SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME +WHERE COUNT_STAR > 0 +ORDER BY SUM_TIMER_WAIT DESC +LIMIT 10; +--enable_result_log + +# +# Total and average wait time for different users +# + +--disable_result_log +SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT +# ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user +ORDER BY SUM_WAIT DESC +LIMIT 20; +--enable_result_log + +# +# Total and average wait times for different events for a session +# +--disable_result_log +SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +WHERE p.ID = 1 +GROUP BY h.EVENT_NAME +HAVING TOTAL_WAIT > 0; +--enable_result_log + +# +# Which user reads and writes data +# + +--disable_result_log +SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h +INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID) +LEFT JOIN information_schema.PROCESSLIST i USING (ID) +GROUP BY i.user, h.operation +HAVING BYTES > 0 +ORDER BY i.user, h.operation; +--enable_result_log diff --git a/mysql-test/suite/perfschema/t/func_mutex.test b/mysql-test/suite/perfschema/t/func_mutex.test new file mode 100644 index 00000000000..98cb905c67c --- /dev/null +++ b/mysql-test/suite/perfschema/t/func_mutex.test @@ -0,0 +1,131 @@ +# Copyright (C) 2008-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 + +## +## WL#4818, 4.1.3 MUTEXES, RW-LOCKS, ... +## +## Functional testing of mutexes and RW-locks +## + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# +# TODO: Change to InnoDB when it gets instrumentation +# + +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; + +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +# +# FM1: Count for mutex should increase with instrumentation enabled and +# FM2: Count for mutex should not increase with instrumentation disabled +# + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/mutex/sql/LOCK_open'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_open')); + +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; + +# +# Repeat for RW-lock +# + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO' +WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +SELECT * FROM t1 WHERE id = 1; + +SET @before_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT * FROM t1; + +SET @after_count = (SELECT SUM(TIMER_WAIT) + FROM performance_schema.EVENTS_WAITS_HISTORY_LONG + WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); + +SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed; + +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test new file mode 100644 index 00000000000..16971023cbb --- /dev/null +++ b/mysql-test/suite/perfschema/t/global_read_lock.test @@ -0,0 +1,90 @@ +# 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 +# +# Test the effect of a flush tables with read lock on SETUP_ tables. + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +use performance_schema; + +grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; +flush privileges; + +--echo connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, , test); + +lock tables performance_schema.SETUP_INSTRUMENTS read; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log +unlock tables; + +lock tables performance_schema.SETUP_INSTRUMENTS write; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; + +--echo connection default; +connection default; + +flush tables with read lock; + +--echo connection con1; +connection con1; + +lock tables performance_schema.SETUP_INSTRUMENTS read; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--enable_result_log +unlock tables; + +# This will block +--send +lock tables performance_schema.SETUP_INSTRUMENTS write; + +--echo connection default; +connection default; + +let $wait_condition= select 1 from performance_schema.EVENTS_WAITS_CURRENT where event_name like "wait/synch/cond/sql/COND_global_read_lock"; + +--source include/wait_condition.inc + +# Observe the blocked thread in the performance schema :) +select event_name, + left(source, locate(":", source)) as short_source, + timer_end, timer_wait, operation + from performance_schema.EVENTS_WAITS_CURRENT + where event_name like "wait/synch/cond/sql/COND_global_read_lock"; + +unlock tables; + +connection con1; +--reap + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +unlock tables; + +disconnect con1; + +--echo connection default; +connection default; + +drop user pfsuser@localhost; +flush privileges; + diff --git a/mysql-test/suite/perfschema/t/information_schema.test b/mysql-test/suite/perfschema/t/information_schema.test new file mode 100644 index 00000000000..3d2822a1db3 --- /dev/null +++ b/mysql-test/suite/perfschema/t/information_schema.test @@ -0,0 +1,67 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Several selects so the output is readable + +# Note that TABLE_NAME is in uppercase is some platforms, +# and in lowercase in others. +# Using upper(TABLE_NAME) to have consistent results. + +select TABLE_SCHEMA, upper(TABLE_NAME), TABLE_CATALOG + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_TYPE, ENGINE + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), VERSION, ROW_FORMAT + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + +# TABLESPACE_NAME does not exist in 5.4 +# select upper(TABLE_NAME), CREATE_OPTIONS, TABLESPACE_NAME +# from information_schema.tables +# where TABLE_SCHEMA='performance_schema'; + +select upper(TABLE_NAME), TABLE_COMMENT + from information_schema.tables + where TABLE_SCHEMA='performance_schema'; + diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test new file mode 100644 index 00000000000..d9b97d8441e --- /dev/null +++ b/mysql-test/suite/perfschema/t/misc.test @@ -0,0 +1,57 @@ +# 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 +# Miscelaneous + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# +# Bug#45496 Performance schema: assertion fails in +# ha_perfschema::rnd_init:223 +# + +--disable_result_log +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN + (SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN + (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS + WHERE NAME LIKE "wait/synch/%") +LIMIT 1; +--enable_result_log + +# +# Bug#45088 Should not be able to create tables of engine PERFORMANCE_SCHEMA +# + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1(a int) engine=performance_schema; + +# +# Bug#44897 Performance Schema: can create a ghost table in another database +# + +--error ER_WRONG_PERFSCHEMA_USAGE +create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT; + +# +# Bug#44898 PerformanceSchema: can create a table in db performance_schema, cannot insert +# + +--error ER_TABLEACCESS_DENIED_ERROR +create table performance_schema.t1(a int); + diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.opt b/mysql-test/suite/perfschema/t/myisam_file_io.opt new file mode 100644 index 00000000000..f2e233bd4ab --- /dev/null +++ b/mysql-test/suite/perfschema/t/myisam_file_io.opt @@ -0,0 +1 @@ +--performance_schema_events_waits_history_long_size=5000 diff --git a/mysql-test/suite/perfschema/t/myisam_file_io.test b/mysql-test/suite/perfschema/t/myisam_file_io.test new file mode 100644 index 00000000000..53d2ea6dbe6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/myisam_file_io.test @@ -0,0 +1,63 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Setup + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/io/file/myisam/%"; + +update performance_schema.SETUP_CONSUMERS + set enabled='YES'; + +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +# Code to test + +--disable_warnings +drop table if exists test.no_index_tab; +--enable_warnings + +create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; +insert into no_index_tab set a = 'foo', b = 1; + +# Verification +# Note that mi_create.c contains mysql_file_tell() calls in debug only, +# so the result are filtered to remove 'tell'. + +select event_name, + left(source, locate(":", source)) as short_source, + operation, number_of_bytes, + substring(object_name, locate("no_index_tab", object_name)) as short_name + from performance_schema.EVENTS_WAITS_HISTORY_LONG + where operation not like "tell" + order by thread_id, event_id; + +# In case of failures, this will tell if file io are lost. +show status like 'performance_schema_%'; + +# Cleanup + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; + +drop table test.no_index_tab; + diff --git a/mysql-test/suite/perfschema/t/no_threads-master.opt b/mysql-test/suite/perfschema/t/no_threads-master.opt new file mode 100644 index 00000000000..b15ab02821d --- /dev/null +++ b/mysql-test/suite/perfschema/t/no_threads-master.opt @@ -0,0 +1 @@ +--one-thread --thread-handling=no-threads --loose-performance-schema-max-thread_instances=10 diff --git a/mysql-test/suite/perfschema/t/no_threads.test b/mysql-test/suite/perfschema/t/no_threads.test new file mode 100644 index 00000000000..3d3f712e364 --- /dev/null +++ b/mysql-test/suite/perfschema/t/no_threads.test @@ -0,0 +1,69 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + + +# Setup : in this main thread + +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_CONSUMERS set enabled='YES'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; + +--disable_warnings +drop table if exists test.t1; +--enable_warnings + +truncate table performance_schema.EVENTS_WAITS_CURRENT; +truncate table performance_schema.EVENTS_WAITS_HISTORY; +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +show variables like "thread_handling"; + +# Code to test : in this main thread + +create table test.t1(a int) engine=MYISAM; + +show variables like "performance_schema"; +show variables like "performance_schema_max_thread%"; + +# Verification : in this main thread + +select count(*) from performance_schema.PROCESSLIST + where name like "thread/sql/main"; + +select count(*) from performance_schema.PROCESSLIST + where name like "thread/sql/OneConnection"; + +select event_name, operation, + left(source, locate(":", source)) as short_source + from performance_schema.EVENTS_WAITS_CURRENT; + +select event_name, operation, + left(source, locate(":", source)) as short_source + from performance_schema.EVENTS_WAITS_HISTORY; + +select event_name, operation, + left(source, locate(":", source)) as short_source + from performance_schema.EVENTS_WAITS_HISTORY_LONG; + +# Cleanup + +drop table test.t1; + diff --git a/mysql-test/suite/perfschema/t/one_thread_per_con-master.opt b/mysql-test/suite/perfschema/t/one_thread_per_con-master.opt new file mode 100644 index 00000000000..d6685208673 --- /dev/null +++ b/mysql-test/suite/perfschema/t/one_thread_per_con-master.opt @@ -0,0 +1 @@ +--thread_handling=one-thread-per-connection diff --git a/mysql-test/suite/perfschema/t/one_thread_per_con.test b/mysql-test/suite/perfschema/t/one_thread_per_con.test new file mode 100644 index 00000000000..7d0daffe228 --- /dev/null +++ b/mysql-test/suite/perfschema/t/one_thread_per_con.test @@ -0,0 +1,94 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Setup + +--source ../include/setup_helper.inc + +# We use a myisam table here because CREATE TABLE has a known, +# stable behavior (it will lock THR_LOCK_myisam once). +# The point is not to test myisam, but to test that each +# connection is properly instrumented, with one-thread-per-connection + +update performance_schema.SETUP_INSTRUMENTS set enabled='YES' + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; + +--disable_warnings +drop table if exists test.t1; +drop table if exists test.t2; +drop table if exists test.t3; +--enable_warnings + +truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG; + +show variables like "thread_handling"; + +# Code to test + +connection con1; + +-- echo "----------------- Connection 1" +create table test.t1(a int) engine=MYISAM; + +connection con2; + +-- echo "----------------- Connection 2" +create table test.t2(a int) engine=MYISAM; + +connection con3; + +-- echo "----------------- Connection 3" +create table test.t3(a int) engine=MYISAM; + +# Verification + +connection default; + +-- echo "----------------- Connection default" + +--disable_query_log +eval set @tid= $con1_THREAD_ID; +--enable_query_log + +execute stmt_dump_events using @tid; +execute stmt_dump_thread using @tid; + +--disable_query_log +eval set @tid= $con2_THREAD_ID; +--enable_query_log + +execute stmt_dump_events using @tid; +execute stmt_dump_thread using @tid; + +--disable_query_log +eval set @tid= $con3_THREAD_ID; +--enable_query_log + +execute stmt_dump_events using @tid; +execute stmt_dump_thread using @tid; + +# Cleanup + +drop table test.t1; +drop table test.t2; +drop table test.t3; + +--source ../include/cleanup_helper.inc + diff --git a/mysql-test/suite/perfschema/t/pool_of_threads-master.opt b/mysql-test/suite/perfschema/t/pool_of_threads-master.opt new file mode 100644 index 00000000000..75a5cd77203 --- /dev/null +++ b/mysql-test/suite/perfschema/t/pool_of_threads-master.opt @@ -0,0 +1 @@ +--loose-pool-of-threads diff --git a/mysql-test/suite/perfschema/t/privilege.test b/mysql-test/suite/perfschema/t/privilege.test new file mode 100644 index 00000000000..d2f3c2a9e6b --- /dev/null +++ b/mysql-test/suite/perfschema/t/privilege.test @@ -0,0 +1,362 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +show grants; + +grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION; + +# Test denied privileges on performance_schema.* + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.* to 'pfs_user_2'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.* to 'pfs_user_2'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE TEMPORARY TABLES on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant EXECUTE on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER ROUTINE on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant EVENT on performance_schema.* to 'pfs_user_2'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.* to 'pfs_user_2'@localhost; + +# Test allowed privileges on performance_schema.* + +grant SELECT on performance_schema.* to 'pfs_user_2'@localhost; +grant INSERT on performance_schema.* to 'pfs_user_2'@localhost; +grant UPDATE on performance_schema.* to 'pfs_user_2'@localhost; +grant DELETE on performance_schema.* to 'pfs_user_2'@localhost; +grant LOCK TABLES on performance_schema.* to 'pfs_user_2'@localhost; + +# Test denied privileges on specific performance_schema tables. +# SETUP_INSTRUMENT : example of PFS_updatable_acl +# EVENTS_WAITS_CURRENT : example of PFS_truncatable_acl +# FILE_INSTANCES : example of PFS_readonly_acl + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +grant INSERT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +grant DELETE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost; + +grant SELECT on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost + with GRANT OPTION; + +grant UPDATE on performance_schema.SETUP_INSTRUMENTS to 'pfs_user_3'@localhost + with GRANT OPTION; + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +grant INSERT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +grant UPDATE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +grant DELETE on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost; + +grant SELECT on performance_schema.EVENTS_WAITS_CURRENT to 'pfs_user_3'@localhost + with GRANT OPTION; + +--error ER_DBACCESS_DENIED_ERROR +grant ALL on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost + with GRANT OPTION; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant CREATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +# will be ER_DBACCESS_DENIED_ERROR once .FRM are removed +grant DROP on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant REFERENCES on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant INDEX on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant ALTER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant CREATE VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant SHOW VIEW on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--error ER_DBACCESS_DENIED_ERROR +grant TRIGGER on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +grant INSERT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +grant UPDATE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +--replace_result '\'file_instances' '\'FILE_INSTANCES' +--error ER_TABLEACCESS_DENIED_ERROR +grant DELETE on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost; + +grant SELECT on performance_schema.FILE_INSTANCES to 'pfs_user_3'@localhost + with GRANT OPTION; + +# See bug#45354 LOCK TABLES is not a TABLE privilege +grant LOCK TABLES on performance_schema.* to 'pfs_user_3'@localhost + with GRANT OPTION; + +flush privileges; + +--source ../include/privilege.inc + +connect (con1, localhost, pfs_user_1, , ); + +--source ../include/privilege.inc + +--disconnect con1 + +connect (con2, localhost, pfs_user_2, , ); + +--source ../include/privilege.inc + +--disconnect con2 + +connect (con3, localhost, pfs_user_3, , ); + +--source ../include/privilege.inc + +--disconnect con3 + +--connection default + +revoke all privileges, grant option from 'pfs_user_1'@localhost; +revoke all privileges, grant option from 'pfs_user_2'@localhost; +revoke all privileges, grant option from 'pfs_user_3'@localhost; +drop user 'pfs_user_1'@localhost; +drop user 'pfs_user_2'@localhost; +drop user 'pfs_user_3'@localhost; +flush privileges; + +--echo # Test cases from WL#4818 +--echo # Setup user + +CREATE user pfs_user_4; +--connect (pfs_user_4, localhost, pfs_user_4, , ) + +--echo # +--echo # WL#4818, NFS4: Normal user does not have access to view data +--echo # without grants +--echo # + +--connection pfs_user_4 +--echo # Select as pfs_user_4 should fail without grant + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_id FROM performance_schema.EVENTS_WAITS_HISTORY_LONG; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_id FROM performance_schema.EVENTS_WAITS_CURRENT; + +--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_name FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; + +--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE' +--error ER_TABLEACCESS_DENIED_ERROR +SELECT event_name FROM performance_schema.FILE_SUMMARY_BY_INSTANCE; + +--echo # +--echo # WL#4818, NFS3: Normal user does not have access to change what is +--echo # instrumented without grants +--echo # + +--connection pfs_user_4 +--echo # User pfs_user_4 should not be allowed to tweak instrumentation without +--echo # explicit grant + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; + +--replace_result '\'setup_consumers' '\'SETUP_CONSUMERS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; + +--replace_result '\'setup_timers' '\'SETUP_TIMERS' +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; + +--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG' +--error ER_TABLEACCESS_DENIED_ERROR +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; + +--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY' +--error ER_TABLEACCESS_DENIED_ERROR +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; + +--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT' +--error ER_TABLEACCESS_DENIED_ERROR +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +--echo # +--echo # WL#4814, NFS1: Can use grants to give normal user access +--echo # to turn on and off instrumentation +--echo # + +--connection default +--echo # Grant access to change tables with the root account + +GRANT UPDATE ON performance_schema.SETUP_CONSUMERS TO pfs_user_4; +GRANT UPDATE ON performance_schema.SETUP_TIMERS TO pfs_user_4; +GRANT UPDATE, SELECT ON performance_schema.SETUP_INSTRUMENTS TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_CURRENT TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY TO pfs_user_4; +GRANT DROP ON performance_schema.EVENTS_WAITS_HISTORY_LONG TO pfs_user_4; + +--connection pfs_user_4 +--echo # User pfs_user_4 should now be allowed to tweak instrumentation + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES' +WHERE name LIKE 'wait/synch/mutex/%' + OR name LIKE 'wait/synch/rwlock/%'; + +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; + +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'TICK'; + +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY_LONG; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY; +TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; + +--echo # Clean up + +--connection default +--disconnect pfs_user_4 +REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; +DROP USER pfs_user_4; +flush privileges; +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; +UPDATE performance_schema.SETUP_CONSUMERS SET enabled = 'YES'; +UPDATE performance_schema.SETUP_TIMERS SET timer_name = 'CYCLE'; + diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test new file mode 100644 index 00000000000..a50b3b99650 --- /dev/null +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -0,0 +1,68 @@ +# 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 + +# This test verifies that performance schema tables, because they contain +# data that is volatile, are never cached in the query cache. + +--source include/have_query_cache.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (a int not null); +insert into t1 values (1), (2), (3); + +SET GLOBAL query_cache_size=1355776; + +flush query cache; +reset query cache; + +select * from t1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +select * from t1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; + +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +select spins from performance_schema.EVENTS_WAITS_CURRENT order by event_name limit 1; + +select name from performance_schema.SETUP_INSTRUMENTS order by name limit 1; + +show status like "Qcache_queries_in_cache"; +show status like "Qcache_inserts"; +show status like "Qcache_hits"; + +SET GLOBAL query_cache_size= default; + +drop table t1; + diff --git a/mysql-test/suite/perfschema/t/read_only.test b/mysql-test/suite/perfschema/t/read_only.test new file mode 100644 index 00000000000..62631fa048f --- /dev/null +++ b/mysql-test/suite/perfschema/t/read_only.test @@ -0,0 +1,96 @@ +# 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 +# +# Check that +# - a regular user can not update SETUP_ tables under --read-only +# - a user with SUPER privileges cam + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +use performance_schema; + +set @start_read_only= @@global.read_only; + +grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost; +flush privileges; + +--echo connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, , test); + +--echo connection default; +connection default; + +set global read_only=0; + +--echo connection con1; +connection con1; + +select @@global.read_only; +show grants; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +--enable_result_log + +--echo connection default; +connection default; + +set global read_only=1; + +--echo connection con1; +connection con1; + +select @@global.read_only; +show grants; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +--error ER_OPTION_PREVENTS_STATEMENT +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +--error ER_OPTION_PREVENTS_STATEMENT +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +--enable_result_log + +--echo connection default; +connection default; + +grant super on *.* to pfsuser@localhost; +flush privileges; + +disconnect con1; +--echo connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, , test); + +select @@global.read_only; +show grants; +--disable_result_log +select * from performance_schema.SETUP_INSTRUMENTS; +update performance_schema.SETUP_INSTRUMENTS set enabled='NO'; +update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; +--enable_result_log + +disconnect con1; + +--echo connection default; +connection default; + +set global read_only= @start_read_only; + +drop user pfsuser@localhost; +flush privileges; + diff --git a/mysql-test/suite/perfschema/t/schema.test b/mysql-test/suite/perfschema/t/schema.test new file mode 100644 index 00000000000..d13c399a97b --- /dev/null +++ b/mysql-test/suite/perfschema/t/schema.test @@ -0,0 +1,46 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source include/have_lowercase0.inc + +show databases; + +use performance_schema; + +show tables; + +show create table COND_INSTANCES; +show create table EVENTS_WAITS_CURRENT; +show create table EVENTS_WAITS_HISTORY; +show create table EVENTS_WAITS_HISTORY_LONG; +show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME; +show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE; +show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +show create table FILE_INSTANCES; +show create table FILE_SUMMARY_BY_EVENT_NAME; +show create table FILE_SUMMARY_BY_INSTANCE; +show create table MUTEX_INSTANCES; +show create table PERFORMANCE_TIMERS; +show create table PROCESSLIST; +show create table RWLOCK_INSTANCES; +show create table SETUP_CONSUMERS; +show create table SETUP_INSTRUMENTS; +show create table SETUP_OBJECTS; +show create table SETUP_TIMERS; + diff --git a/mysql-test/suite/perfschema/t/selects.test b/mysql-test/suite/perfschema/t/selects.test new file mode 100644 index 00000000000..d5268e8465c --- /dev/null +++ b/mysql-test/suite/perfschema/t/selects.test @@ -0,0 +1,156 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# +# WL#4814, 4.1.2 STORAGE ENGINE, FSE8: Selects +# + +# Make some data that we can work on: + +UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES'; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') +ENGINE=MyISAM; +INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +# ORDER BY, GROUP BY and HAVING + +--replace_column 2 [NUM_BYTES] +SELECT OPERATION, SUM(NUMBER_OF_BYTES) AS TOTAL +FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +GROUP BY OPERATION +HAVING TOTAL IS NOT NULL +ORDER BY OPERATION +LIMIT 1; + +# Sub SELECT +--replace_column 1 [EVENT_ID] +SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN + (SELECT THREAD_ID FROM performance_schema.PROCESSLIST) +AND EVENT_NAME IN + (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS + WHERE NAME LIKE "wait/synch/%") +LIMIT 1; + +# JOIN + +--replace_column 1 [EVENT_ID] +SELECT DISTINCT EVENT_ID +FROM performance_schema.EVENTS_WAITS_CURRENT +JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY_LONG USING (EVENT_ID) +ORDER BY EVENT_ID +LIMIT 1; + +# Self JOIN + +--replace_column 1 [THREAD_ID] 2 [EVENT_ID] 3 [EVENT_NAME] 4 [TIMER_WAIT] +SELECT t1.THREAD_ID, t2.EVENT_ID, t3.EVENT_NAME, t4.TIMER_WAIT +FROM performance_schema.EVENTS_WAITS_HISTORY t1 +JOIN performance_schema.EVENTS_WAITS_HISTORY t2 USING (EVENT_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t3 ON (t2.THREAD_ID = t3.THREAD_ID) +JOIN performance_schema.EVENTS_WAITS_HISTORY t4 ON (t3.EVENT_NAME = t4.EVENT_NAME) +ORDER BY t1.EVENT_ID, t2.EVENT_ID +LIMIT 5; + +# UNION +--replace_column 1 [THREAD_ID] 2 [EVENT_ID] +SELECT THREAD_ID, EVENT_ID FROM ( +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY +UNION +SELECT THREAD_ID, EVENT_ID FROM performance_schema.EVENTS_WAITS_HISTORY_LONG +) t1 ORDER BY THREAD_ID, EVENT_ID +LIMIT 5; + +# EVENT + +CREATE EVENT t_ps_event +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND +DO SELECT DISTINCT EVENT_ID + FROM performance_schema.EVENTS_WAITS_CURRENT + JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) + ORDER BY EVENT_ID + LIMIT 1; + +--sleep 2 + +# TRIGGER + +ALTER TABLE t1 ADD COLUMN c INT; + +delimiter |; + +CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 + FOR EACH ROW BEGIN + SET NEW.c = (SELECT MAX(EVENT_ID) + FROM performance_schema.EVENTS_WAITS_CURRENT); + END; +| + +delimiter ;| + +INSERT INTO t1 (id) VALUES (11), (12), (13); + +--replace_column 2 [EVENT_ID] +SELECT id, c FROM t1 WHERE id > 10 ORDER BY c; + +DROP TRIGGER t_ps_trigger; + +# PROCEDURE + +delimiter |; + +CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) +BEGIN + SELECT id FROM performance_schema.PROCESSLIST + WHERE THREAD_ID = tid INTO pid; +END; + +| + +delimiter ;| + +CALL t_ps_proc(0, @p_id); + +# FUNCTION + +delimiter |; + +CREATE FUNCTION t_ps_func(tid INT) RETURNS int +BEGIN + return (SELECT id FROM performance_schema.PROCESSLIST + WHERE THREAD_ID = tid); +END; + +| + +delimiter ;| + +SELECT t_ps_func(0) = @p_id; + +DROP PROCEDURE t_ps_proc; +DROP FUNCTION t_ps_func; + +# Clean up +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test new file mode 100644 index 00000000000..cd9357cce67 --- /dev/null +++ b/mysql-test/suite/perfschema/t/server_init.test @@ -0,0 +1,263 @@ +# 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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# This test verifies that the mysys and server instruments are properly +# initialized and recorded by the performance schema during the bootstrap +# sequence in mysqld main(). +# Note that some globals mutexes/rwlocks/conds that depend on #ifdef options +# or runtime options are not tested here, to have a predictable result. + +use performance_schema; + +# Verify that these global mutexes have been properly initilized in mysys + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_threads"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_malloc"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_open"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_isam"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/mysys/THR_LOCK_myisam_log"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_net"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_charset"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/mysys/THR_LOCK_time"; + +# There are no global rwlock in mysys + +# Verify that these global conditions have been properly initilized in mysys + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/mysys/THR_COND_threads"; + +# Verify that these global mutexes have been properly initilized in sql + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_mysql_create_db"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_open"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_lock_db"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_thread_count"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_mapped_file"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_status"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_error_log"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; + +# Named LOCK_uuid_short in 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_uuid_short"; + +# Named LOCK_uuid_generator in 5.5, LOCK_uuid_short in 6.0 +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_delayed_status"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_delayed_create"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_crypt"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_slave_list"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_active_mi"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_manager"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_global_read_lock"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_global_system_variables"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_user_conn"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_connection_count"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_server_started"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_rpl_status"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOG_INFO::lock"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_event_metadata"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_event_queue"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_user_locks"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_mdl"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/Cversion_lock"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_audit_mask"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_xid_cache"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_plugin"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_gdl"; + +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/tz_LOCK"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/slave_start"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_active"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_get"; + +# Verify that these global rwlocks have been properly initilized in sql + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_grant"; + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_sys_init_connect"; + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_sys_init_slave"; + +select count(name) from RWLOCK_INSTANCES + where name like "wait/synch/rwlock/sql/LOCK_system_variables_hash"; + +# Verify that these global conditions have been properly initilized in sql + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_server_started"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_refresh"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_thread_count"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_manager"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_global_read_lock"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_thread_cache"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_flush_thread_cache"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_rpl_status"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; + +select count(name) from COND_INSTANCES + where name like "wait/synch/cond/sql/COND_queue_state"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/COND_mdl"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/BML_class::COND_BML"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/BML_class::COND_BML_registered"; + +# Does not exist in mysql 5.5, 6.0 only +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/BML_class::COND_BML_release"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt new file mode 100644 index 00000000000..714888a6de1 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_cond_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_class.test b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test new file mode 100644 index 00000000000..34ff61c358e --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_cond_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/cond/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_COND_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.COND_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_cond_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt new file mode 100644 index 00000000000..4b33152f89a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_cond_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test new file mode 100644 index 00000000000..fe2177adb82 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_cond_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_cond_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/cond/%"; + +# Expect no class lost +show status like "performance_schema_cond_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_cond_instances"; + +select count(*) from performance_schema.COND_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_COND_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt new file mode 100644 index 00000000000..f4b6d1ec893 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_file_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_class.test b/mysql-test/suite/perfschema/t/start_server_no_file_class.test new file mode 100644 index 00000000000..ca84fbbdcf2 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_file_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/io/file/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_FILE_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.FILE_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_file_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt new file mode 100644 index 00000000000..7f0d246f97a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_file_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_file_inst.test b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test new file mode 100644 index 00000000000..dbbba7bbe4a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_file_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_file_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/io/file/%"; + +# Expect no class lost +show status like "performance_schema_file_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_file_instances"; + +select count(*) from performance_schema.FILE_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_FILE_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt new file mode 100644 index 00000000000..173851434eb --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_mutex_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test new file mode 100644 index 00000000000..142e150ede6 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_mutex_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/mutex/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.MUTEX_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_mutex_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt new file mode 100644 index 00000000000..5bdd7d39b4a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_mutex_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test new file mode 100644 index 00000000000..5a03251d97a --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_mutex_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/mutex/%"; + +# Expect no class lost +show status like "performance_schema_mutex_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_mutex_instances"; + +select count(*) from performance_schema.MUTEX_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_MUTEX_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt new file mode 100644 index 00000000000..f0d15c86ddc --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_rwlock_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test new file mode 100644 index 00000000000..e4dfe121fcf --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_rwlock_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/rwlock/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.RWLOCK_INSTANCES; + +# Expect no instances lost +show status like "performance_schema_rwlock_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt new file mode 100644 index 00000000000..fc1f5f89902 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_rwlock_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test new file mode 100644 index 00000000000..1d79d2d3991 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst.test @@ -0,0 +1,41 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_rwlock_classes"; + +select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS + where name like "wait/synch/rwlock/%"; + +# Expect no class lost +show status like "performance_schema_rwlock_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_rwlock_instances"; + +select count(*) from performance_schema.RWLOCK_INSTANCES; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_RWLOCK_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt b/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt new file mode 100644 index 00000000000..91286cef859 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_thread_classes=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test new file mode 100644 index 00000000000..ba214ba9966 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test @@ -0,0 +1,38 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no classes +show variables like "performance_schema_max_thread_classes"; + +select count(*) from performance_schema.SETUP_INSTRUMENTS + where name like "thread/%"; + +# We lost all the classes +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST'; + +# Expect no instances +select count(*) from performance_schema.PROCESSLIST; + +# Expect no instances lost +show status like "performance_schema_thread_instances_lost"; + diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt b/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt new file mode 100644 index 00000000000..6e9d13c2b4c --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema --loose-performance_schema_max_thread_instances=0 diff --git a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test new file mode 100644 index 00000000000..7d8a44ebcd5 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test @@ -0,0 +1,42 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect classes +show variables like "performance_schema_max_thread_classes"; + +# Not observable yet +# select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS +# where name like "thread/%"; + +# Expect no class lost +show status like "performance_schema_thread_classes_lost"; + +# Expect no instances +show variables like "performance_schema_max_thread_instances"; + +select count(*) from performance_schema.PROCESSLIST; + +# Expect instances lost +select variable_value > 0 from information_schema.global_status + where variable_name like 'PERFORMANCE_SCHEMA_THREAD_INSTANCES_LOST'; + + diff --git a/mysql-test/suite/perfschema/t/start_server_off-master.opt b/mysql-test/suite/perfschema/t/start_server_off-master.opt new file mode 100644 index 00000000000..600566e870b --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_off-master.opt @@ -0,0 +1 @@ +--loose-disable-performance-schema diff --git a/mysql-test/suite/perfschema/t/start_server_off.test b/mysql-test/suite/perfschema/t/start_server_off.test new file mode 100644 index 00000000000..bd9db97840d --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_off.test @@ -0,0 +1,25 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expecting all off / zero +show status like "performance_schema%"; + diff --git a/mysql-test/suite/perfschema/t/start_server_on-master.opt b/mysql-test/suite/perfschema/t/start_server_on-master.opt new file mode 100644 index 00000000000..542720c44d7 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_on-master.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema diff --git a/mysql-test/suite/perfschema/t/start_server_on.test b/mysql-test/suite/perfschema/t/start_server_on.test new file mode 100644 index 00000000000..54714616a08 --- /dev/null +++ b/mysql-test/suite/perfschema/t/start_server_on.test @@ -0,0 +1,25 @@ +# Copyright (C) 2008-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 + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expecting nothing lost with default parameters + +show status like "performance_schema%"; diff --git a/mysql-test/suite/perfschema/t/tampered_perfschema_table1-master.opt b/mysql-test/suite/perfschema/t/tampered_perfschema_table1-master.opt new file mode 100644 index 00000000000..5f094e68be7 --- /dev/null +++ b/mysql-test/suite/perfschema/t/tampered_perfschema_table1-master.opt @@ -0,0 +1 @@ +--loose-debug=+d,tampered_perfschema_table1 diff --git a/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test new file mode 100644 index 00000000000..be079bacfbf --- /dev/null +++ b/mysql-test/suite/perfschema/t/tampered_perfschema_table1.test @@ -0,0 +1,44 @@ +# 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 + +# This test uses error injection, +# see PFS_engine_table_share::check_all_tables() + +# Verify that the server starts even when a performance schema table +# is corrupted, with an incompatible change. +# Verify that using that table nicely fails. +# Verify that other tables are not affected. + +--source include/have_debug.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# The message prints 'mysql.SETUP_INSTRUMENTS' +# instead of 'performance_schema.SETUP_INSTRUMENTS', +# due to Bug#46792 + +call mtr.add_suppression( +"Column count of mysql.SETUP_INSTRUMENTS is wrong. " +"Expected 4, found 3. The table is probably corrupted"); + +--error ER_WRONG_NATIVE_TABLE_STRUCTURE +select * from performance_schema.SETUP_INSTRUMENTS limit 1; + +--disable_result_log +select * from performance_schema.SETUP_CONSUMERS limit 1; +--enable_result_log + diff --git a/mysql-test/suite/perfschema_stress/README b/mysql-test/suite/perfschema_stress/README new file mode 100644 index 00000000000..53f6f1daf35 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/README @@ -0,0 +1,34 @@ +# 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 + +WL#4818 - Stress testing of PERFORMANCE_SCHEMA + +The performance schema storage engine is backed by data structures, we +want to be sure that these data structures are not fragile under +load. + +NFS1: 20 threads doing read of performance data (both mutex and +disk), 5 threads changing what is being instrumented, 25 threads doing +DML and DDL so that the statistics are updated. Connections should frequently +disconnect or be KILLed, and reconnect. + +The database should not crash under any circumstance. + +How to run: + +MTR_VERSION=1 ./mtr --stress \ + --stress-suite=perfschema_stress \ + --stress-threads=50 \ + --stress-test-duration=3600 diff --git a/mysql-test/suite/perfschema_stress/include/settings.inc b/mysql-test/suite/perfschema_stress/include/settings.inc new file mode 100644 index 00000000000..fb886a86df2 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/include/settings.inc @@ -0,0 +1,17 @@ +# 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 + +let $num_stress_rows= 5000; +let $default_engine_type= myisam; diff --git a/mysql-test/suite/perfschema_stress/r/modify.result b/mysql-test/suite/perfschema_stress/r/modify.result new file mode 100644 index 00000000000..e1a79c9be2a --- /dev/null +++ b/mysql-test/suite/perfschema_stress/r/modify.result @@ -0,0 +1,17 @@ +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'NO'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'NO'; +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'NANOSECOND' WHERE NAME = 'Wait'; +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'CYCLE' WHERE NAME = 'Wait'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'YES'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'YES' +WHERE NAME IN ('wait/io/file/sql/FRM', +'thread/sql/Connection', +'wait/synch/cond/sql/COND_mdl', +'wait/synch/rwlock/sql/LOCK_sys_init_connect', +'wait/synch/mutex/sql/LOCK_mdl'); +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'NO' +WHERE NAME = 'events_waits_history'; +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'YES' +WHERE NAME = 'events_waits_history'; diff --git a/mysql-test/suite/perfschema_stress/r/read.result b/mysql-test/suite/perfschema_stress/r/read.result new file mode 100644 index 00000000000..eee3067ddb8 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/r/read.result @@ -0,0 +1,29 @@ +SELECT * FROM performance_schema.SETUP_INSTRUMENTS +WHERE ENABLED='NO' AND TIMED='NO'; +NAME ENABLED TIMED +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE (TIMER_END - TIMER_START != TIMER_WAIT); +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE SPINS != NULL; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.PROCESSLIST p, +performance_schema.EVENTS_WAITS_CURRENT e +WHERE p.THREAD_ID = e.THREAD_ID +AND TIMER_START = 0 +ORDER BY e.EVENT_ID; +THREAD_ID ID NAME THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN (SELECT THREAD_ID +FROM performance_schema.PROCESSLIST +ORDER BY THREAD_ID) +AND TIMER_END = 0 +AND TIMER_WAIT != NULL +ORDER BY EVENT_ID; +THREAD_ID EVENT_ID EVENT_NAME SOURCE TIMER_START TIMER_END TIMER_WAIT SPINS OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE OBJECT_INSTANCE_BEGIN NESTING_EVENT_ID OPERATION NUMBER_OF_BYTES FLAGS +SELECT SUM(COUNT_READ) AS sum_count_read, +SUM(COUNT_WRITE) AS sum_count_write, +SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, +SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; diff --git a/mysql-test/suite/perfschema_stress/r/work.result b/mysql-test/suite/perfschema_stress/r/work.result new file mode 100644 index 00000000000..c782b45fdf9 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/r/work.result @@ -0,0 +1,16 @@ +SET @rowid = ROUND(RAND() * <num_stress_rows>); +START TRANSACTION; +UPDATE t1 SET b = 'changed' WHERE id=@rowid; +SELECT b FROM t1 WHERE id=@rowid; +b +changed +COMMIT; +START TRANSACTION; +DELETE FROM t1 WHERE id=@rowid; +INSERT INTO t1 (id, b) VALUES (@rowid, 'newly_inserted'); +SELECT b FROM t1 WHERE id=@rowid; +b +newly_inserted +COMMIT; +CREATE TABLE tw_<conn_nr> AS SELECT * FROM t1; +DROP TABLE tw_<conn_nr>; diff --git a/mysql-test/suite/perfschema_stress/stress_init.txt b/mysql-test/suite/perfschema_stress/stress_init.txt new file mode 100644 index 00000000000..146f275e098 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/stress_init.txt @@ -0,0 +1 @@ +setup diff --git a/mysql-test/suite/perfschema_stress/stress_tests.txt b/mysql-test/suite/perfschema_stress/stress_tests.txt new file mode 100644 index 00000000000..a17a30cb551 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/stress_tests.txt @@ -0,0 +1,10 @@ +read +read +read +read +modify +work +work +work +work +work diff --git a/mysql-test/suite/perfschema_stress/t/modify.test b/mysql-test/suite/perfschema_stress/t/modify.test new file mode 100644 index 00000000000..08b0699ace6 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/modify.test @@ -0,0 +1,55 @@ +# 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 + +--source include/not_embedded.inc +--source suite/perfschema_stress/include/settings.inc + +let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`; + +if (`SELECT ($have_table = 0)`) { + --source suite/perfschema_stress/t/setup.test +} + +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'NO'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'NO'; + +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'NANOSECOND' WHERE NAME = 'Wait'; + +# Let it run some time with the new timer name and instruments +--sleep 1 + +UPDATE performance_schema.SETUP_TIMERS +SET TIMER_NAME = 'CYCLE' WHERE NAME = 'Wait'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'YES' +WHERE NAME IN ('wait/io/file/sql/FRM', + 'thread/sql/Connection', + 'wait/synch/cond/sql/COND_mdl', + 'wait/synch/rwlock/sql/LOCK_sys_init_connect', + 'wait/synch/mutex/sql/LOCK_mdl'); + +# Two short lived changes to see that switching does not lead +# to havoc. + +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'NO' +WHERE NAME = 'events_waits_history'; + +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'YES' +WHERE NAME = 'events_waits_history'; diff --git a/mysql-test/suite/perfschema_stress/t/read.test b/mysql-test/suite/perfschema_stress/t/read.test new file mode 100644 index 00000000000..28ba4d8d887 --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/read.test @@ -0,0 +1,49 @@ +# 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 + +--source include/not_embedded.inc + +SELECT * FROM performance_schema.SETUP_INSTRUMENTS +WHERE ENABLED='NO' AND TIMED='NO'; + +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE (TIMER_END - TIMER_START != TIMER_WAIT); + +SELECT * FROM performance_schema.EVENTS_WAITS_HISTORY +WHERE SPINS != NULL; + +SELECT * FROM performance_schema.PROCESSLIST p, + performance_schema.EVENTS_WAITS_CURRENT e +WHERE p.THREAD_ID = e.THREAD_ID + AND TIMER_START = 0 +ORDER BY e.EVENT_ID; + +SELECT * FROM performance_schema.EVENTS_WAITS_CURRENT +WHERE THREAD_ID IN (SELECT THREAD_ID + FROM performance_schema.PROCESSLIST + ORDER BY THREAD_ID) + AND TIMER_END = 0 + AND TIMER_WAIT != NULL +ORDER BY EVENT_ID; + +--disable_result_log +SELECT SUM(COUNT_READ) AS sum_count_read, + SUM(COUNT_WRITE) AS sum_count_write, + SUM(SUM_NUMBER_OF_BYTES_READ) AS sum_num_bytes_read, + SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_num_bytes_write +FROM performance_schema.FILE_SUMMARY_BY_INSTANCE +WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL; +--enable_result_log + diff --git a/mysql-test/suite/perfschema_stress/t/setup.test b/mysql-test/suite/perfschema_stress/t/setup.test new file mode 100644 index 00000000000..9f643edfebe --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/setup.test @@ -0,0 +1,64 @@ +# 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 + +if (`SELECT VERSION() LIKE '%embedded%'`) +{ + --skip This test cannot run with the embedded server. +} + +--source suite/perfschema_stress/include/settings.inc + +--disable_query_log +--disable_result_log + +if (`SELECT LENGTH('$engine_type') = 0`) { + let $engine_type= $default_engine_type; +} +if (`SELECT '$engine_type' = 'Falcon'`) { + --source include/have_falcon.inc +} + +--replace_result $engine_type <engine_type> +eval CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') + ENGINE=$engine_type; + +# Need something to start with +INSERT INTO t1(id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); + +# Bulk load the correct number of rows +while (`SELECT MAX(id) < $num_stress_rows FROM t1`) +{ + SELECT MAX(id) FROM t1 INTO @max; +--replace_result $num_stress_rows <num_stress_rows> + eval INSERT INTO t1(id) SELECT id + @max FROM t1 + WHERE id + @max <= $num_stress_rows; +} + +# Turn on some instruments + +UPDATE performance_schema.SETUP_INSTRUMENTS SET TIMED = 'YES'; + +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'NO'; +UPDATE performance_schema.SETUP_INSTRUMENTS SET ENABLED = 'YES' +WHERE NAME IN ('wait/io/file/sql/FRM', + 'thread/sql/Connection', + 'wait/synch/cond/sql/COND_mdl', + 'wait/synch/rwlock/sql/LOCK_sys_init_connect', + 'wait/synch/mutex/sql/LOCK_mdl'); + +UPDATE performance_schema.SETUP_CONSUMERS SET ENABLED = 'YES'; + +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/perfschema_stress/t/work.test b/mysql-test/suite/perfschema_stress/t/work.test new file mode 100644 index 00000000000..8f1bc42c5bc --- /dev/null +++ b/mysql-test/suite/perfschema_stress/t/work.test @@ -0,0 +1,47 @@ +# 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 + +--source include/not_embedded.inc +--source suite/perfschema_stress/include/settings.inc + +let $have_table= `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'`; + +if (`SELECT ($have_table = 0)`) { + --source suite/perfschema_stress/t/setup.test +} + +--replace_result $num_stress_rows <num_stress_rows> +eval SET @rowid = ROUND(RAND() * $num_stress_rows); + +let $conn_id= `SELECT CONNECTION_ID()`; +let $conn_nr= conn_$conn_id; + +START TRANSACTION; +UPDATE t1 SET b = 'changed' WHERE id=@rowid; +SELECT b FROM t1 WHERE id=@rowid; +COMMIT; + +START TRANSACTION; +DELETE FROM t1 WHERE id=@rowid; +INSERT INTO t1 (id, b) VALUES (@rowid, 'newly_inserted'); +SELECT b FROM t1 WHERE id=@rowid; +COMMIT; + +--replace_result $conn_nr <conn_nr> +eval CREATE TABLE tw_$conn_nr AS SELECT * FROM t1; + +--replace_result $conn_nr <conn_nr> +eval DROP TABLE tw_$conn_nr; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result index a1294d515fa..4639c717cea 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result @@ -24,6 +24,7 @@ information_schema mtr mysql mysqltest +performance_schema test USE test; SHOW TABLES; diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result index 27960be8054..13ee20cb3a0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result @@ -11,6 +11,7 @@ Database information_schema mtr mysql +performance_schema test test_ignore USE test; @@ -38,6 +39,7 @@ Database information_schema mtr mysql +performance_schema test USE test; SHOW TABLES; |