~vadim-tk/percona-server/percona-galera-5.1.57-0.8.1

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result

  • Committer: root
  • Date: 2011-07-28 00:14:23 UTC
  • Revision ID: root@r815.office.percona.com-20110728001423-6pw0v4b7r0dkbsr4
Ported to Galera 0.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
include/master-slave.inc
 
2
[connection master]
 
3
DROP DATABASE IF EXISTS db1;
 
4
DROP DATABASE IF EXISTS db2;
 
5
CREATE DATABASE db1;
 
6
CREATE DATABASE db2;
 
7
use db1;
 
8
CREATE TABLE db1.t1 (a INT) ENGINE=InnoDB;
 
9
CREATE TABLE db1.t2 (s CHAR(255)) ENGINE=MyISAM;
 
10
include/stop_slave.inc
 
11
[on master]
 
12
CREATE PROCEDURE db1.p1 ()
 
13
BEGIN
 
14
INSERT INTO t1 VALUES (1);
 
15
INSERT INTO t1 VALUES (2);
 
16
INSERT INTO t1 VALUES (3);
 
17
INSERT INTO t1 VALUES (4);
 
18
INSERT INTO t1 VALUES (5);
 
19
END//
 
20
CREATE PROCEDURE db1.p2 ()
 
21
BEGIN
 
22
INSERT INTO t1 VALUES (6);
 
23
INSERT INTO t1 VALUES (7);
 
24
INSERT INTO t1 VALUES (8);
 
25
INSERT INTO t1 VALUES (9);
 
26
INSERT INTO t1 VALUES (10);
 
27
INSERT INTO t2 VALUES ('executed db1.p2()');
 
28
END//
 
29
INSERT INTO db1.t2 VALUES ('before call db1.p1()');
 
30
use test;
 
31
BEGIN;
 
32
CALL db1.p1();
 
33
COMMIT;
 
34
INSERT INTO db1.t2 VALUES ('after call db1.p1()');
 
35
SELECT * FROM db1.t1;
 
36
a
 
37
1
 
38
2
 
39
3
 
40
4
 
41
5
 
42
SELECT * FROM db1.t2;
 
43
s
 
44
before call db1.p1()
 
45
after call db1.p1()
 
46
[on slave]
 
47
start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS;
 
48
include/wait_for_slave_sql_to_stop.inc
 
49
#
 
50
# If we got non-zero here, then we're suffering BUG#43263
 
51
#
 
52
SELECT 0 as 'Must be 0';
 
53
Must be 0
 
54
0
 
55
SELECT * from db1.t1;
 
56
a
 
57
1
 
58
2
 
59
3
 
60
4
 
61
5
 
62
SELECT * from db1.t2;
 
63
s
 
64
before call db1.p1()
 
65
[on master]
 
66
INSERT INTO db1.t2 VALUES ('before call db1.p2()');
 
67
BEGIN;
 
68
CALL db1.p2();
 
69
ROLLBACK;
 
70
INSERT INTO db1.t2 VALUES ('after call db1.p2()');
 
71
SELECT * FROM db1.t1;
 
72
a
 
73
1
 
74
2
 
75
3
 
76
4
 
77
5
 
78
SELECT * FROM db1.t2;
 
79
s
 
80
before call db1.p1()
 
81
after call db1.p1()
 
82
before call db1.p2()
 
83
executed db1.p2()
 
84
after call db1.p2()
 
85
[on slave]
 
86
start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_POS;
 
87
include/wait_for_slave_sql_to_stop.inc
 
88
#
 
89
# If we got non-zero here, then we're suffering BUG#43263
 
90
#
 
91
SELECT 0 as 'Must be 0';
 
92
Must be 0
 
93
0
 
94
SELECT * from db1.t1;
 
95
a
 
96
1
 
97
2
 
98
3
 
99
4
 
100
5
 
101
SELECT * from db1.t2;
 
102
s
 
103
before call db1.p1()
 
104
executed db1.p2()
 
105
START SLAVE;
 
106
include/wait_for_slave_sql_to_start.inc
 
107
#
 
108
# SAVEPOINT and ROLLBACK TO have the same problem in BUG#43263
 
109
# This was reported by BUG#50407
 
110
[on master]
 
111
SET SESSION AUTOCOMMIT=0
 
112
BEGIN;
 
113
INSERT INTO db1.t1 VALUES(20);
 
114
 
115
# Verify whether this statement is binlogged correctly
 
116
/*comment*/ SAVEPOINT has_comment;
 
117
USE db1;
 
118
INSERT INTO db1.t1 VALUES(30);
 
119
INSERT INTO db1.t2 VALUES("in savepoint has_comment");
 
120
USE db2;
 
121
SavePoint mixed_cases;
 
122
USE db1;
 
123
INSERT INTO db1.t2 VALUES("in savepoint mixed_cases");
 
124
INSERT INTO db1.t1 VALUES(40);
 
125
USE db2;
 
126
ROLLBACK TO mixed_cases;
 
127
Warnings:
 
128
Warning 1196    Some non-transactional changed tables couldn't be rolled back
 
129
ROLLBACK TO has_comment;
 
130
Warnings:
 
131
Warning 1196    Some non-transactional changed tables couldn't be rolled back
 
132
USE db1;
 
133
INSERT INTO db1.t2 VALUES("after rollback to");
 
134
INSERT INTO db1.t1 VALUES(50);
 
135
USE db2;
 
136
COMMIT;
 
137
show binlog events from <binlog_start>;
 
138
Log_name        Pos     Event_type      Server_id       End_log_pos     Info
 
139
master-bin.000001       #       Query   #       #       BEGIN
 
140
master-bin.000001       #       Query   #       #       use `test`; INSERT INTO db1.t1 VALUES(20)
 
141
master-bin.000001       #       Query   #       #       SAVEPOINT `has_comment`
 
142
master-bin.000001       #       Query   #       #       use `db1`; INSERT INTO db1.t1 VALUES(30)
 
143
master-bin.000001       #       Query   #       #       use `db1`; INSERT INTO db1.t2 VALUES("in savepoint has_comment")
 
144
master-bin.000001       #       Query   #       #       SAVEPOINT `mixed_cases`
 
145
master-bin.000001       #       Query   #       #       use `db1`; INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")
 
146
master-bin.000001       #       Query   #       #       use `db1`; INSERT INTO db1.t1 VALUES(40)
 
147
master-bin.000001       #       Query   #       #       ROLLBACK TO `mixed_cases`
 
148
master-bin.000001       #       Query   #       #       ROLLBACK TO `has_comment`
 
149
master-bin.000001       #       Query   #       #       use `db1`; INSERT INTO db1.t2 VALUES("after rollback to")
 
150
master-bin.000001       #       Query   #       #       use `db1`; INSERT INTO db1.t1 VALUES(50)
 
151
master-bin.000001       #       Xid     #       #       COMMIT /* XID */
 
152
[on slave]
 
153
#
 
154
# Verify INSERT statements in savepoints are executed, for MyISAM table
 
155
# is not effected by ROLLBACK TO
 
156
SELECT * FROM db1.t2 WHERE s LIKE '% savepoint %';
 
157
s
 
158
in savepoint has_comment
 
159
in savepoint mixed_cases
 
160
#
 
161
# Verify INSERT statements on the Innodb table are rolled back;
 
162
SELECT * FROM db1.t1 WHERE a IN (30, 40);
 
163
a
 
164
#
 
165
# Clean up
 
166
#
 
167
DROP DATABASE db1;
 
168
DROP DATABASE db2;
 
169
include/rpl_end.inc