summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp_sync.test
blob: d8458f69eef75a25f9d98216482bd28f18d9e462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# This test should work in embedded server after mysqltest is fixed
-- source include/not_embedded.inc

# Save the initial number of concurrent sessions
--source include/count_sessions.inc

--echo Tests of synchronization of stored procedure execution.

--source include/have_debug_sync.inc

--echo #
--echo # Bug#48157: crash in Item_field::used_tables
--echo #

CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;

DELIMITER |;

CREATE PROCEDURE p1()
BEGIN
   UPDATE t1 JOIN t2 USING( a, b ) SET t1.b = 1, t2.b = 1;
END|

DELIMITER ;|

connect (con1,localhost,root,,);
connect (con2,localhost,root,,);

connection con1;
LOCK TABLES t1 WRITE, t2 WRITE;

connection con2;
LET $ID= `select connection_id()`;
SET DEBUG_SYNC = 'multi_update_reopen_tables SIGNAL parked WAIT_FOR go';
--send CALL p1()

connection con1;
let $wait_condition= SELECT 1 FROM information_schema.processlist WHERE ID = $ID AND
state = "Locked";
--source include/wait_condition.inc
DROP TABLE t1, t2;
SET DEBUG_SYNC = 'now WAIT_FOR parked';
CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
SET DEBUG_SYNC = 'now SIGNAL go';

connection con2;
--reap

disconnect con1;
disconnect con2;
connection default;

--echo # Without the DEBUG_SYNC supplied in the same patch as this test in the 
--echo # code, this test statement will hang.
DROP TABLE t1, t2;
DROP PROCEDURE p1;

--echo #
--echo # test for bug#11756013
--echo #
--disable_warnings
DROP SCHEMA IF EXISTS s1;
--enable_warnings
CREATE SCHEMA s1;
CREATE PROCEDURE s1.p1() BEGIN END;

connect (con3, localhost, root);
SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
--send CALL s1.p1

connection default;
SET DEBUG_SYNC='now WAIT_FOR check_db';
DROP SCHEMA s1;
SET DEBUG_SYNC='now SIGNAL dropped_schema';

connection con3;
--error ER_BAD_DB_ERROR
--reap
connection default;
disconnect con3;

SET DEBUG_SYNC = 'RESET';

# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc