diff options
Diffstat (limited to 'mysql-test/suite/perfschema/include')
4 files changed, 159 insertions, 4 deletions
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..1c8651a070c --- /dev/null +++ b/mysql-test/suite/perfschema/include/binlog_common.inc @@ -0,0 +1,41 @@ +# Tests for PERFORMANCE_SCHEMA + +RESET MASTER; + +select count(*) > 0 from performance_schema.setup_instruments; + +# Note: +# Do not include records that could depend on +# compiling options (storage engines, SSL), +# to ensure the expected output in the binlog is predictable. +update performance_schema.setup_instruments set enabled='NO' + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); + +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/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); + +drop table test.t1; +drop table test.t2; + +update performance_schema.setup_instruments set enabled='YES' + where name like "wait/synch/rwlock/sql/%" + and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock"); + +--source include/show_binlog_events.inc + diff --git a/mysql-test/suite/perfschema/include/pfs_upgrade.inc b/mysql-test/suite/perfschema/include/pfs_upgrade.inc new file mode 100644 index 00000000000..0d4a864940c --- /dev/null +++ b/mysql-test/suite/perfschema/include/pfs_upgrade.inc @@ -0,0 +1,112 @@ +# Tests for PERFORMANCE_SCHEMA +# Make sure mysql_upgrade does not destroy data in a 'performance_schema' +# database. +# + +# Some initial settings + Preemptive cleanup +let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $err_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err; +let $out_file= $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out; +--error 0,1 +--remove_file $out_file +--error 0,1 +--remove_file $err_file + +--disable_warnings +drop table if exists test.user_table; +drop procedure if exists test.user_proc; +drop function if exists test.user_func; +drop event if exists test.user_event; +--enable_warnings + + +--echo "Testing mysql_upgrade with TABLE performance_schema.user_table" + +create table test.user_table(a int); + +--error 0,1 +--remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm +--copy_file $MYSQLD_DATADIR/test/user_table.frm $MYSQLD_DATADIR/performance_schema/user_table.frm + +# Make sure the table is visible +use performance_schema; +show tables like "user_table"; + +--source suite/perfschema/include/upgrade_check.inc + +# Make sure the table is still visible +show tables like "user_table"; + +use test; + +--remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm +drop table test.user_table; + + +--echo "Testing mysql_upgrade with VIEW performance_schema.user_view" + +create view test.user_view as select "Not supposed to be here"; + +--error 0,1 +--remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm +--copy_file $MYSQLD_DATADIR/test/user_view.frm $MYSQLD_DATADIR/performance_schema/user_view.frm + +# Make sure the view is visible +use performance_schema; +show tables like "user_view"; + +--source suite/perfschema/include/upgrade_check.inc + +# Make sure the view is still visible +show tables like "user_view"; + +use test; + +--remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm +drop view test.user_view; + + +--echo "Testing mysql_upgrade with PROCEDURE performance_schema.user_proc" + +create procedure test.user_proc() + select "Not supposed to be here"; + +update mysql.proc set db='performance_schema' where name='user_proc'; + +--source suite/perfschema/include/upgrade_check.inc + +select name from mysql.proc where db='performance_schema'; + +update mysql.proc set db='test' where name='user_proc'; +drop procedure test.user_proc; + + +--echo "Testing mysql_upgrade with FUNCTION performance_schema.user_func" + +create function test.user_func() returns integer + return 0; + +update mysql.proc set db='performance_schema' where name='user_func'; + +--source suite/perfschema/include/upgrade_check.inc + +select name from mysql.proc where db='performance_schema'; + +update mysql.proc set db='test' where name='user_func'; +drop function test.user_func; + + +--echo "Testing mysql_upgrade with EVENT performance_schema.user_event" + +create event test.user_event on schedule every 1 day do + select "not supposed to be here"; + +update mysql.event set db='performance_schema' where name='user_event'; + +--source suite/perfschema/include/upgrade_check.inc + +select name from mysql.event where db='performance_schema'; + +update mysql.event set db='test' where name='user_event'; +drop event test.user_event; + diff --git a/mysql-test/suite/perfschema/include/privilege.inc b/mysql-test/suite/perfschema/include/privilege.inc index 054b864befd..f01511b6fc8 100644 --- a/mysql-test/suite/perfschema/include/privilege.inc +++ b/mysql-test/suite/perfschema/include/privilege.inc @@ -85,16 +85,16 @@ create trigger performance_schema.bi_file_instances before insert on performance_schema.file_instances for each row begin end; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1(a int) engine=PERFORMANCE_SCHEMA; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1 like performance_schema.setup_instruments; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1 like performance_schema.events_waits_current; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1 like performance_schema.file_instances; --error ER_TABLEACCESS_DENIED_ERROR diff --git a/mysql-test/suite/perfschema/include/upgrade_check.inc b/mysql-test/suite/perfschema/include/upgrade_check.inc index 440eb8f7123..52d4cfd1e63 100644 --- a/mysql-test/suite/perfschema/include/upgrade_check.inc +++ b/mysql-test/suite/perfschema/include/upgrade_check.inc @@ -8,6 +8,8 @@ --source include/wait_until_count_sessions.inc # Verify that mysql_upgrade complained about the performance_schema + +--replace_regex /at line [0-9]+/at line ###/ --cat_file $err_file --error 0,1 --remove_file $out_file |