Commit 8f52b41d 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.

mysql-test/suite/perfschema/include/upgrade_check.inc:
  New include file which contains redundant stuff taken from pfs_upgrade.test.
  Remove any file which might harm analysis of suspicious results.
mysql-test/suite/perfschema/r/query_cache.result:
  Updated results
mysql-test/suite/perfschema/r/selects.result:
  Updated results
mysql-test/suite/perfschema/t/bad_option_1.test:
  Add the missing remove_file at beginning and end of test.
mysql-test/suite/perfschema/t/bad_option_2.test:
  Add the missing remove_file at beginning and end of test.
mysql-test/suite/perfschema/t/global_read_lock.test:
  Add a wait routine which ensures that the disconnect is really completed when the test ends.
mysql-test/suite/perfschema/t/pfs_upgrade.test:
  - Move redundant actions to include/upgrade_check.inc
  - Add preemptive removal of files
mysql-test/suite/perfschema/t/privilege.test:
  Add a wait routine which ensures that the disconnect is really completed when the test ends.
mysql-test/suite/perfschema/t/query_cache.test:
  Add "flush status" so that counters are reset. (./mtr --repeat=2 perfschema.query_cache failed)
mysql-test/suite/perfschema/t/read_only.test:
  Add a wait routine which ensures that the disconnect is really completed when the test ends.
mysql-test/suite/perfschema/t/selects-master.opt:
  Needed for running with enabled event-scheduler
mysql-test/suite/perfschema/t/selects.test:
  - Correct the sub test for the EVENT scheduler
  - Replace "sleep" by wait_routine
  - Add premptive cleanups like "DROP ... IF EXISTS ..."
parent 74d67316
# 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 ...@@ -65,3 +65,4 @@ Variable_name Value
Qcache_hits 1 Qcache_hits 1
SET GLOBAL query_cache_size= default; SET GLOBAL query_cache_size= default;
drop table t1; drop table t1;
flush status;
...@@ -55,14 +55,21 @@ THREAD_ID EVENT_ID ...@@ -55,14 +55,21 @@ THREAD_ID EVENT_ID
[THREAD_ID] [EVENT_ID] [THREAD_ID] [EVENT_ID]
[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 CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND 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 FROM performance_schema.EVENTS_WAITS_CURRENT
JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID)
ORDER BY EVENT_ID ORDER BY EVENT_ID
LIMIT 1; LIMIT 1;
ALTER TABLE t1 ADD COLUMN c INT; ALTER TABLE t1 ADD COLUMN c INT;
DROP TRIGGER IF EXISTS t_ps_trigger;
CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1
FOR EACH ROW BEGIN FOR EACH ROW BEGIN
SET NEW.c = (SELECT MAX(EVENT_ID) SET NEW.c = (SELECT MAX(EVENT_ID)
...@@ -76,6 +83,7 @@ id c ...@@ -76,6 +83,7 @@ id c
12 [EVENT_ID] 12 [EVENT_ID]
13 [EVENT_ID] 13 [EVENT_ID]
DROP TRIGGER t_ps_trigger; DROP TRIGGER t_ps_trigger;
DROP PROCEDURE IF EXISTS t_ps_proc;
CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
BEGIN BEGIN
SELECT id FROM performance_schema.PROCESSLIST SELECT id FROM performance_schema.PROCESSLIST
...@@ -83,6 +91,7 @@ WHERE THREAD_ID = tid INTO pid; ...@@ -83,6 +91,7 @@ WHERE THREAD_ID = tid INTO pid;
END; END;
| |
CALL t_ps_proc(0, @p_id); CALL t_ps_proc(0, @p_id);
DROP FUNCTION IF EXISTS t_ps_proc;
CREATE FUNCTION t_ps_func(tid INT) RETURNS int CREATE FUNCTION t_ps_func(tid INT) RETURNS int
BEGIN BEGIN
return (SELECT id FROM performance_schema.PROCESSLIST return (SELECT id FROM performance_schema.PROCESSLIST
...@@ -92,6 +101,10 @@ END; ...@@ -92,6 +101,10 @@ END;
SELECT t_ps_func(0) = @p_id; SELECT t_ps_func(0) = @p_id;
t_ps_func(0) = @p_id t_ps_func(0) = @p_id
1 1
SELECT * FROM t_event;
EVENT_ID
[EVENT_ID]
DROP PROCEDURE t_ps_proc; DROP PROCEDURE t_ps_proc;
DROP FUNCTION t_ps_func; DROP FUNCTION t_ps_func;
DROP TABLE t1; 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 # 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 # it under the terms of the GNU General Public License as published by
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software Foundation,
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA # Tests for PERFORMANCE_SCHEMA
# Check error handling for invalid server start options # Check error handling for invalid server start options
...@@ -19,8 +19,11 @@ ...@@ -19,8 +19,11 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_perfschema.inc --source include/have_perfschema.inc
let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_1.txt;
--error 0,1
--remove_file $outfile
--error 7 --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; perl;
use strict; use strict;
...@@ -42,4 +45,5 @@ perl; ...@@ -42,4 +45,5 @@ perl;
} }
close FILE; close FILE;
EOF 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 # 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 # it under the terms of the GNU General Public License as published by
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software Foundation,
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA # Tests for PERFORMANCE_SCHEMA
# Check error handling for ambiguous server start options # Check error handling for ambiguous server start options
...@@ -19,8 +19,11 @@ ...@@ -19,8 +19,11 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_perfschema.inc --source include/have_perfschema.inc
let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_2.txt;
--error 0,1
--remove_file $outfile
--error 3 --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; perl;
use strict; use strict;
...@@ -41,4 +44,5 @@ perl; ...@@ -41,4 +44,5 @@ perl;
} }
close FILE; close FILE;
EOF EOF
--remove_file $outfile
...@@ -81,6 +81,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; ...@@ -81,6 +81,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
unlock tables; unlock tables;
disconnect con1; disconnect con1;
--source include/wait_until_disconnected.inc
--echo connection default; --echo connection default;
connection default; connection default;
......
...@@ -22,6 +22,15 @@ ...@@ -22,6 +22,15 @@
--source include/have_perfschema.inc --source include/have_perfschema.inc
--source include/have_lowercase0.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 --disable_warnings
drop table if exists test.user_table; drop table if exists test.user_table;
drop procedure if exists test.user_proc; drop procedure if exists test.user_proc;
...@@ -29,22 +38,20 @@ drop function if exists test.user_func; ...@@ -29,22 +38,20 @@ drop function if exists test.user_func;
drop event if exists test.user_event; drop event if exists test.user_event;
--enable_warnings --enable_warnings
--echo "Testing mysql_upgrade with TABLE performance_schema.user_table" --echo "Testing mysql_upgrade with TABLE performance_schema.user_table"
create table test.user_table(a int); 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 --copy_file $MYSQLD_DATADIR/test/user_table.frm $MYSQLD_DATADIR/performance_schema/user_table.frm
# Make sure the table is visible # Make sure the table is visible
use performance_schema; use performance_schema;
show tables like "user_table"; show tables like "user_table";
--error 1 --source suite/perfschema/include/upgrade_check.inc
--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
# Make sure the table is still visible # Make sure the table is still visible
show tables like "user_table"; show tables like "user_table";
...@@ -54,22 +61,20 @@ use test; ...@@ -54,22 +61,20 @@ use test;
--remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm --remove_file $MYSQLD_DATADIR/performance_schema/user_table.frm
drop table test.user_table; drop table test.user_table;
--echo "Testing mysql_upgrade with VIEW performance_schema.user_view" --echo "Testing mysql_upgrade with VIEW performance_schema.user_view"
create view test.user_view as select "Not supposed to be here"; 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 --copy_file $MYSQLD_DATADIR/test/user_view.frm $MYSQLD_DATADIR/performance_schema/user_view.frm
# Make sure the view is visible # Make sure the view is visible
use performance_schema; use performance_schema;
show tables like "user_view"; show tables like "user_view";
--error 1 --source suite/perfschema/include/upgrade_check.inc
--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
# Make sure the view is still visible # Make sure the view is still visible
show tables like "user_view"; show tables like "user_view";
...@@ -79,6 +84,7 @@ use test; ...@@ -79,6 +84,7 @@ use test;
--remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm --remove_file $MYSQLD_DATADIR/performance_schema/user_view.frm
drop view test.user_view; drop view test.user_view;
--echo "Testing mysql_upgrade with PROCEDURE performance_schema.user_proc" --echo "Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
create procedure test.user_proc() create procedure test.user_proc()
...@@ -86,17 +92,14 @@ 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'; update mysql.proc set db='performance_schema' where name='user_proc';
--error 1 --source suite/perfschema/include/upgrade_check.inc
--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
select name from mysql.proc where db='performance_schema'; select name from mysql.proc where db='performance_schema';
update mysql.proc set db='test' where name='user_proc'; update mysql.proc set db='test' where name='user_proc';
drop procedure test.user_proc; drop procedure test.user_proc;
--echo "Testing mysql_upgrade with FUNCTION performance_schema.user_func" --echo "Testing mysql_upgrade with FUNCTION performance_schema.user_func"
create function test.user_func() returns integer create function test.user_func() returns integer
...@@ -104,17 +107,14 @@ 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'; update mysql.proc set db='performance_schema' where name='user_func';
--error 1 --source suite/perfschema/include/upgrade_check.inc
--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
select name from mysql.proc where db='performance_schema'; select name from mysql.proc where db='performance_schema';
update mysql.proc set db='test' where name='user_func'; update mysql.proc set db='test' where name='user_func';
drop function test.user_func; drop function test.user_func;
--echo "Testing mysql_upgrade with EVENT performance_schema.user_event" --echo "Testing mysql_upgrade with EVENT performance_schema.user_event"
create event test.user_event on schedule every 1 day do 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 ...@@ -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'; update mysql.event set db='performance_schema' where name='user_event';
--error 1 --source suite/perfschema/include/upgrade_check.inc
--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
select name from mysql.event where db='performance_schema'; select name from mysql.event where db='performance_schema';
update mysql.event set db='test' where name='user_event'; update mysql.event set db='test' where name='user_event';
drop event test.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; ...@@ -350,9 +350,9 @@ TRUNCATE TABLE performance_schema.EVENTS_WAITS_HISTORY;
TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT; TRUNCATE TABLE performance_schema.EVENTS_WAITS_CURRENT;
--echo # Clean up --echo # Clean up
--connection default
--disconnect pfs_user_4 --disconnect pfs_user_4
--source include/wait_until_disconnected.inc
--connection default
REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4; REVOKE ALL PRIVILEGES, GRANT OPTION FROM pfs_user_4;
DROP USER pfs_user_4; DROP USER pfs_user_4;
flush privileges; 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 # 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 # it under the terms of the GNU General Public License as published by
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation, # along with this program; if not, write to the Free Software
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Tests for PERFORMANCE_SCHEMA # Tests for PERFORMANCE_SCHEMA
...@@ -33,7 +33,6 @@ SET GLOBAL query_cache_size=1355776; ...@@ -33,7 +33,6 @@ SET GLOBAL query_cache_size=1355776;
flush query cache; flush query cache;
reset query cache; reset query cache;
# Reset Qcache_* to a known state
flush status; flush status;
select * from t1; select * from t1;
...@@ -67,4 +66,5 @@ show status like "Qcache_hits"; ...@@ -67,4 +66,5 @@ show status like "Qcache_hits";
SET GLOBAL query_cache_size= default; SET GLOBAL query_cache_size= default;
drop table t1; drop table t1;
flush status;
...@@ -85,6 +85,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES'; ...@@ -85,6 +85,7 @@ update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
--enable_result_log --enable_result_log
disconnect con1; disconnect con1;
--source include/wait_until_disconnected.inc
--echo connection default; --echo connection default;
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 # 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 # it under the terms of the GNU General Public License as published by
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software Foundation,
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_perfschema.inc --source include/have_perfschema.inc
...@@ -85,20 +85,32 @@ LIMIT 5; ...@@ -85,20 +85,32 @@ LIMIT 5;
# EVENT # 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 CREATE EVENT t_ps_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND 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 FROM performance_schema.EVENTS_WAITS_CURRENT
JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID) JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID)
ORDER BY EVENT_ID ORDER BY EVENT_ID
LIMIT 1; LIMIT 1;
--sleep 2
# TRIGGER # TRIGGER
ALTER TABLE t1 ADD COLUMN c INT; ALTER TABLE t1 ADD COLUMN c INT;
--disable_warnings
DROP TRIGGER IF EXISTS t_ps_trigger;
--enable_warnings
delimiter |; delimiter |;
CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1 CREATE TRIGGER t_ps_trigger BEFORE INSERT ON t1
...@@ -119,6 +131,9 @@ DROP TRIGGER t_ps_trigger; ...@@ -119,6 +131,9 @@ DROP TRIGGER t_ps_trigger;
# PROCEDURE # PROCEDURE
--disable_warnings
DROP PROCEDURE IF EXISTS t_ps_proc;
--enable_warnings
delimiter |; delimiter |;
CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT) CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
...@@ -135,6 +150,9 @@ CALL t_ps_proc(0, @p_id); ...@@ -135,6 +150,9 @@ CALL t_ps_proc(0, @p_id);
# FUNCTION # FUNCTION
--disable_warnings
DROP FUNCTION IF EXISTS t_ps_proc;
--enable_warnings
delimiter |; delimiter |;
CREATE FUNCTION t_ps_func(tid INT) RETURNS int CREATE FUNCTION t_ps_func(tid INT) RETURNS int
...@@ -149,8 +167,17 @@ delimiter ;| ...@@ -149,8 +167,17 @@ delimiter ;|
SELECT t_ps_func(0) = @p_id; SELECT t_ps_func(0) = @p_id;
DROP PROCEDURE t_ps_proc; # We might reach this point too early which means the event scheduler has not
DROP FUNCTION t_ps_func; # 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 # Clean up
DROP PROCEDURE t_ps_proc;
DROP FUNCTION t_ps_func;
DROP TABLE t1; 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