~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#############################################################################
2
# Original Author: JBM                                                      #
3
# Original Date: Aug/13/2005 Created from Bug 12335                         #
4
#############################################################################
5
6
# Begin clean up test section
7
connection master;
8
--disable_warnings
9
DROP PROCEDURE IF EXISTS test.p1;
10
DROP PROCEDURE IF EXISTS test.p2;
11
DROP TABLE IF EXISTS test.t1;
12
--enable_warnings
13
# End of cleanup
14
15
# Begin test section 1
16
17
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
18
19
delimiter |;
20
CREATE PROCEDURE test.p1()
21
BEGIN
22
  INSERT INTO test.t1 VALUES (4);
23
  SELECT  get_lock("test", 100);
24
  UPDATE test.t1 set a=a+4 WHERE a=4;
25
END|
26
CREATE PROCEDURE test.p2()
27
BEGIN
28
  UPDATE test.t1 SET a=a+1;
29
END|
30
delimiter ;|
31
32
SELECT get_lock("test", 200);
33
34
connection master1;
35
send CALL test.p1();
36
37
connection master;
38
# To make sure tha the call on master1 arrived at the get_lock
39
sleep 1;
40
CALL test.p2();
41
SELECT release_lock("test");
42
SELECT * FROM test.t1; 
43
#show binlog events;
44
# Added sleep for use with NDB to ensure that
45
# the injector thread will populate log before
46
# we switch to the slave.
47
sleep 5;
48
sync_slave_with_master;
49
connection slave;
50
SELECT * FROM test.t1;
51
52
connection master;
53
DROP TABLE IF EXISTS test.t1;
54
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
55
CALL test.p2();
56
CALL test.p1();
57
SELECT * FROM test.t1;
58
59
sync_slave_with_master;
60
connection slave;
61
SELECT * FROM test.t1;
62
connection master;
63
#show binlog events from 720;
64
65
DROP PROCEDURE IF EXISTS test.p1;
66
DROP PROCEDURE IF EXISTS test.p2;
67
DROP TABLE IF EXISTS test.t1;
68
sync_slave_with_master;
69
70
# End of 5.0 test case