Commit 6a029cc5 authored by Matthias Leich's avatar Matthias Leich

Bug#53102 perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode

The reason for the bug above is unclear but
- Modify pfs_upgrade so that it's result is easier to analyze in case something fails
- Fix several minor weaknesses which could cause that a successing test (either an
  already existing or a to be developed one) fails because of imperfect cleanup,
  too slow disconnected sessions etc.
should either fix the bug or reduce it's probability or at least
make the analysis of failures easier.
parent 83aebca5
# 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
# Routine to be called by pfs_upgrade.test
# $out_file and $err_file must be set within pfs_upgrade.test.
#
--error 1
--exec $MYSQL_UPGRADE --skip-verbose > $out_file 2> $err_file
# Verify that mysql_upgrade complained about the performance_schema
--cat_file $err_file
--error 0,1
--remove_file $out_file
--error 0,1
--remove_file $err_file
......@@ -65,3 +65,4 @@ Variable_name Value
Qcache_hits 1
SET GLOBAL query_cache_size= default;
drop table t1;
flush status;
......@@ -55,14 +55,21 @@ THREAD_ID EVENT_ID
[THREAD_ID] [EVENT_ID]
[THREAD_ID] [EVENT_ID]
[THREAD_ID] [EVENT_ID]
DROP TABLE IF EXISTS t_event;
DROP EVENT IF EXISTS t_ps_event;
CREATE TABLE t_event AS
SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
WHERE 1 = 2;
CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
DO SELECT DISTINCT EVENT_ID
DO INSERT INTO t_event
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;
DROP TRIGGER IF EXISTS t_ps_trigger;
CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1
FOR EACH ROW BEGIN
SET NEW.c = (SELECT MAX(EVENT_ID)
......@@ -76,6 +83,7 @@ id c
12 [EVENT_ID]
13 [EVENT_ID]
DROP TRIGGER t_ps_trigger;
DROP PROCEDURE IF EXISTS t_ps_proc;
CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
BEGIN
SELECT id FROM performance_schema.PROCESSLIST
......@@ -83,6 +91,7 @@ WHERE THREAD_ID = tid INTO pid;
END;
|
CALL t_ps_proc(0, @p_id);
DROP FUNCTION IF EXISTS t_ps_proc;
CREATE FUNCTION t_ps_func(tid INT) RETURNS int
BEGIN
return (SELECT id FROM performance_schema.PROCESSLIST
......@@ -92,6 +101,10 @@ END;
SELECT t_ps_func(0) = @p_id;
t_ps_func(0) = @p_id
1
SELECT * FROM t_event;
EVENT_ID
[EVENT_ID]
DROP PROCEDURE t_ps_proc;
DROP FUNCTION t_ps_func;
DROP TABLE t1;
DROP TABLE t_event;
# Copyright (C) 2009 Sun Microsystems, Inc
# Copyright (c) 2009, 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
......@@ -10,8 +10,8 @@
# 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
# along with this program; if not, write to the Free Software Foundation,
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA
# Check error handling for invalid server start options
......@@ -19,8 +19,11 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_1.txt;
--error 0,1
--remove_file $outfile
--error 7
--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-enabled=maybe > $MYSQLTEST_VARDIR/tmp/bad_option_1.txt 2>&1
--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-enabled=maybe > $outfile 2>&1
perl;
use strict;
......@@ -42,4 +45,5 @@ perl;
}
close FILE;
EOF
--remove_file $outfile
# Copyright (C) 2009 Sun Microsystems, Inc
# Copyright (c) 2009, 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
......@@ -10,8 +10,8 @@
# 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
# along with this program; if not, write to the Free Software Foundation,
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA
# Check error handling for ambiguous server start options
......@@ -19,8 +19,11 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_2.txt;
--error 0,1
--remove_file $outfile
--error 3
--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-max_=12 > $MYSQLTEST_VARDIR/tmp/bad_option_2.txt 2>&1
--exec $MYSQLD_BOOTSTRAP_CMD --loose-console --performance-schema-max_=12 > $outfile 2>&1
perl;
use strict;
......@@ -41,4 +44,5 @@ perl;
}
close FILE;
EOF
--remove_file $outfile
......@@ -81,6 +81,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
unlock tables;
disconnect con1;
--source include/wait_until_disconnected.inc
--echo connection default;
connection default;
......
......@@ -22,6 +22,15 @@
--source include/have_perfschema.inc
--source include/have_lowercase0.inc
# 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;
......@@ -29,22 +38,20 @@ 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);
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--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";
--error 1
--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
# Verify that mysql_upgrade complained about the performance_schema
--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
--source suite/perfschema/include/upgrade_check.inc
# Make sure the table is still visible
show tables like "user_table";
......@@ -54,22 +61,20 @@ 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";
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--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";
--error 1
--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
# Verify that mysql_upgrade complained about the performance_schema
--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
--source suite/perfschema/include/upgrade_check.inc
# Make sure the view is still visible
show tables like "user_view";
......@@ -79,6 +84,7 @@ 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()
......@@ -86,17 +92,14 @@ create procedure test.user_proc()
update mysql.proc set db='performance_schema' where name='user_proc';
--error 1
--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
# Verify that mysql_upgrade complained about the performance_schema
--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
--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
......@@ -104,17 +107,14 @@ create function test.user_func() returns integer
update mysql.proc set db='performance_schema' where name='user_func';
--error 1
--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
# Verify that mysql_upgrade complained about the performance_schema
--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
--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
......@@ -122,17 +122,10 @@ create event test.user_event on schedule every 1 day do
update mysql.event set db='performance_schema' where name='user_event';
--error 1
--exec $MYSQL_UPGRADE --skip-verbose > $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out 2> $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
# Verify that mysql_upgrade complained about the performance_schema
--cat_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
--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;
--remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.out
--remove_file $MYSQLTEST_VARDIR/tmp/pfs_upgrade.err
......@@ -350,9 +350,9 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
--echo # Clean up
--connection default
--disconnect pfs_user_4
--source include/wait_until_disconnected.inc
--connection default
REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4;
DROP USER pfs_user_4;
flush privileges;
......
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
# 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
......@@ -10,8 +10,8 @@
# 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,
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# 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
......@@ -33,7 +33,6 @@ SET GLOBAL query_cache_size=1355776;
flush query cache;
reset query cache;
# Reset Qcache_* to a known state
flush status;
select * from t1;
......@@ -67,4 +66,5 @@ show status like "Qcache_hits";
SET GLOBAL query_cache_size= default;
drop table t1;
flush status;
......@@ -85,6 +85,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
--enable_result_log
disconnect con1;
--source include/wait_until_disconnected.inc
--echo connection default;
connection default;
......
# Copyright (C) 2008-2009 Sun Microsystems, Inc
# Copyright (c) 2008, 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
......@@ -10,8 +10,8 @@
# 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
# along with this program; if not, write to the Free Software Foundation,
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
--source include/not_embedded.inc
--source include/have_perfschema.inc
......@@ -85,20 +85,32 @@ LIMIT 5;
# EVENT
# Check that the event_scheduler is really running
--source include/running_event_scheduler.inc
--disable_warnings
DROP TABLE IF EXISTS t_event;
DROP EVENT IF EXISTS t_ps_event;
--enable_warnings
CREATE TABLE t_event AS
SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
WHERE 1 = 2;
CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
DO SELECT DISTINCT EVENT_ID
DO INSERT INTO t_event
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;
--disable_warnings
DROP TRIGGER IF EXISTS t_ps_trigger;
--enable_warnings
delimiter |;
CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1
......@@ -119,6 +131,9 @@ DROP TRIGGER t_ps_trigger;
# PROCEDURE
--disable_warnings
DROP PROCEDURE IF EXISTS t_ps_proc;
--enable_warnings
delimiter |;
CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
......@@ -135,6 +150,9 @@ CALL t_ps_proc(0, @p_id);
# FUNCTION
--disable_warnings
DROP FUNCTION IF EXISTS t_ps_proc;
--enable_warnings
delimiter |;
CREATE FUNCTION t_ps_func(tid INT) RETURNS int
......@@ -149,8 +167,17 @@ delimiter ;|
SELECT t_ps_func(0) = @p_id;
DROP PROCEDURE t_ps_proc;
DROP FUNCTION t_ps_func;
# We might reach this point too early which means the event scheduler has not
# execute our "t_ps_event". Therefore we poll till the record was inserted
# and run our test statement afterwards.
let $wait_timeout= 20;
let $wait_condition= SELECT COUNT(*) = 1 FROM t_event;
--source include/wait_condition.inc
--replace_column 1 [EVENT_ID]
SELECT * FROM t_event;
# Clean up
DROP PROCEDURE t_ps_proc;
DROP FUNCTION t_ps_func;
DROP TABLE t1;
DROP TABLE t_event;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment