mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / sp_sync.test
blobd8458f69eef75a25f9d98216482bd28f18d9e462
1 # This test should work in embedded server after mysqltest is fixed
2 -- source include/not_embedded.inc
4 # Save the initial number of concurrent sessions
5 --source include/count_sessions.inc
7 --echo Tests of synchronization of stored procedure execution.
9 --source include/have_debug_sync.inc
11 --echo #
12 --echo # Bug#48157: crash in Item_field::used_tables
13 --echo #
15 CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
16 CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
18 DELIMITER |;
20 CREATE PROCEDURE p1()
21 BEGIN
22    UPDATE t1 JOIN t2 USING( a, b ) SET t1.b = 1, t2.b = 1;
23 END|
25 DELIMITER ;|
27 connect (con1,localhost,root,,);
28 connect (con2,localhost,root,,);
30 connection con1;
31 LOCK TABLES t1 WRITE, t2 WRITE;
33 connection con2;
34 LET $ID= `select connection_id()`;
35 SET DEBUG_SYNC = 'multi_update_reopen_tables SIGNAL parked WAIT_FOR go';
36 --send CALL p1()
38 connection con1;
39 let $wait_condition= SELECT 1 FROM information_schema.processlist WHERE ID = $ID AND
40 state = "Locked";
41 --source include/wait_condition.inc
42 DROP TABLE t1, t2;
43 SET DEBUG_SYNC = 'now WAIT_FOR parked';
44 CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
45 CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
46 SET DEBUG_SYNC = 'now SIGNAL go';
48 connection con2;
49 --reap
51 disconnect con1;
52 disconnect con2;
53 connection default;
55 --echo # Without the DEBUG_SYNC supplied in the same patch as this test in the 
56 --echo # code, this test statement will hang.
57 DROP TABLE t1, t2;
58 DROP PROCEDURE p1;
60 --echo #
61 --echo # test for bug#11756013
62 --echo #
63 --disable_warnings
64 DROP SCHEMA IF EXISTS s1;
65 --enable_warnings
66 CREATE SCHEMA s1;
67 CREATE PROCEDURE s1.p1() BEGIN END;
69 connect (con3, localhost, root);
70 SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
71 --send CALL s1.p1
73 connection default;
74 SET DEBUG_SYNC='now WAIT_FOR check_db';
75 DROP SCHEMA s1;
76 SET DEBUG_SYNC='now SIGNAL dropped_schema';
78 connection con3;
79 --error ER_BAD_DB_ERROR
80 --reap
81 connection default;
82 disconnect con3;
84 SET DEBUG_SYNC = 'RESET';
86 # Wait till we reached the initial number of concurrent sessions
87 --source include/wait_until_count_sessions.inc