2010-03-05 08:31:01 -07:00
|
|
|
# Copyright (C) 2010 Oracle and/or its affiliates. All rights reserved.
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
|
|
|
|
# database.
|
|
|
|
#
|
|
|
|
|
|
|
|
--source include/not_embedded.inc
|
|
|
|
--source include/have_perfschema.inc
|
2010-03-09 18:05:19 +03:00
|
|
|
--source include/have_lowercase0.inc
|
2010-03-05 08:31:01 -07:00
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
# 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
|
|
|
|
|
2010-03-05 08:31:01 -07:00
|
|
|
--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
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
|
2010-03-05 08:31:01 -07:00
|
|
|
--echo "Testing mysql_upgrade with TABLE performance_schema.user_table"
|
|
|
|
|
|
|
|
create table test.user_table(a int);
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
--error 0,1
|
|
|
|
--remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm
|
2010-03-05 08:31:01 -07:00
|
|
|
--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";
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
--source suite/perfschema/include/upgrade_check.inc
|
2010-03-05 08:31:01 -07:00
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
|
2010-03-05 08:31:01 -07:00
|
|
|
--echo "Testing mysql_upgrade with VIEW performance_schema.user_view"
|
|
|
|
|
|
|
|
create view test.user_view as select "Not supposed to be here";
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
--error 0,1
|
|
|
|
--remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm
|
2010-03-05 08:31:01 -07:00
|
|
|
--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";
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
--source suite/perfschema/include/upgrade_check.inc
|
2010-03-05 08:31:01 -07:00
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
|
2010-03-05 08:31:01 -07:00
|
|
|
--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';
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
--source suite/perfschema/include/upgrade_check.inc
|
2010-03-05 08:31:01 -07:00
|
|
|
|
|
|
|
select name from mysql.proc where db='performance_schema';
|
|
|
|
|
|
|
|
update mysql.proc set db='test' where name='user_proc';
|
|
|
|
drop procedure test.user_proc;
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
|
2010-03-05 08:31:01 -07:00
|
|
|
--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';
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
--source suite/perfschema/include/upgrade_check.inc
|
2010-03-05 08:31:01 -07:00
|
|
|
|
|
|
|
select name from mysql.proc where db='performance_schema';
|
|
|
|
|
|
|
|
update mysql.proc set db='test' where name='user_func';
|
|
|
|
drop function test.user_func;
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
|
2010-03-05 08:31:01 -07:00
|
|
|
--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';
|
|
|
|
|
2010-07-20 21:15:29 +02:00
|
|
|
--source suite/perfschema/include/upgrade_check.inc
|
2010-03-05 08:31:01 -07:00
|
|
|
|
|
|
|
select name from mysql.event where db='performance_schema';
|
|
|
|
|
|
|
|
update mysql.event set db='test' where name='user_event';
|
|
|
|
drop event test.user_event;
|
|
|
|
|