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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
drop table if exists t1, t2;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
reset master;
begin;
insert into t1 values(1);
insert into t2 select * from t1;
commit;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(1)
master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 347 Xid 1 # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(2);
insert into t2 select * from t1;
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(2)
master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(3);
savepoint my_savepoint;
insert into t1 values(4);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
commit;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(3)
master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4)
master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 616 Xid 1 # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(5);
savepoint my_savepoint;
insert into t1 values(6);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
insert into t1 values(7);
commit;
select a from t1 order by a;
a
5
7
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(5)
master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6)
master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 616 Query 1 # use `test`; insert into t1 values(7)
master-bin.000001 703 Xid 1 # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
select get_lock("a",10);
get_lock("a",10)
1
begin;
insert into t1 values(8);
insert into t2 select * from t1;
select get_lock("a",10);
get_lock("a",10)
1
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(8)
master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
insert into t1 values(9);
insert into t2 select * from t1;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; insert into t1 values(9)
master-bin.000001 185 Xid 1 # COMMIT /* XID */
master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1
delete from t1;
delete from t2;
reset master;
insert into t1 values(10);
begin;
insert into t2 select * from t1;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
master-bin.000001 186 Xid 1 # COMMIT /* XID */
master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
master-bin.000001 186 Xid 1 # COMMIT /* XID */
master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 307 Query 1 # use `test`; BEGIN
master-bin.000001 375 Query 1 # use `test`; insert into t1 values(11)
master-bin.000001 463 Xid 1 # COMMIT /* XID */
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(12);
insert into t2 select * from t1;
commit;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(12)
master-bin.000001 254 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 348 Xid 1 # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(13);
insert into t2 select * from t1;
rollback;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(14);
savepoint my_savepoint;
insert into t1 values(15);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(14)
master-bin.000001 254 Xid 1 # COMMIT /* XID */
delete from t1;
delete from t2;
reset master;
begin;
insert into t1 values(16);
savepoint my_savepoint;
insert into t1 values(17);
insert into t2 select * from t1;
rollback to savepoint my_savepoint;
insert into t1 values(18);
commit;
select a from t1 order by a;
a
16
18
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
master-bin.000001 342 Xid 1 # COMMIT /* XID */
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
insert into t1 values (1);
begin;
select * from t1 for update;
a
1
select (@before:=unix_timestamp())*0;
(@before:=unix_timestamp())*0
0
begin;
select * from t1 for update;
insert into t2 values (20);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select (@after:=unix_timestamp())*0;
(@after:=unix_timestamp())*0
0
select (@after-@before) >= 2;
(@after-@before) >= 2
1
drop table t1,t2;
commit;
begin;
create temporary table ti (a int) engine=innodb;
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
insert into ti values(1);
set autocommit=0;
create temporary table t1 (a int) engine=myisam;
commit;
insert t1 values (1);
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
create table t0 (n int);
insert t0 select * from t1;
set autocommit=1;
insert into t0 select GET_LOCK("lock1",null);
set autocommit=0;
create table t2 (n int) engine=innodb;
insert into t2 values (3);
select get_lock("lock1",60);
get_lock("lock1",60)
1
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
master-bin.000001 342 Xid 1 # COMMIT /* XID */
master-bin.000001 369 Query 1 # use `test`; delete from t1
master-bin.000001 446 Xid 1 # COMMIT /* XID */
master-bin.000001 473 Query 1 # use `test`; delete from t2
master-bin.000001 550 Xid 1 # COMMIT /* XID */
master-bin.000001 577 Query 1 # use `test`; alter table t2 type=MyISAM
master-bin.000001 666 Query 1 # use `test`; insert into t1 values (1)
master-bin.000001 754 Xid 1 # COMMIT /* XID */
master-bin.000001 781 Query 1 # use `test`; insert into t2 values (20)
master-bin.000001 870 Query 1 # use `test`; drop table t1,t2
master-bin.000001 949 Query 1 # use `test`; create temporary table ti (a int) engine=innodb
master-bin.000001 1059 Query 1 # use `test`; insert into ti values(1)
master-bin.000001 1146 Xid 1 # COMMIT /* XID */
master-bin.000001 1173 Query 1 # use `test`; create temporary table t1 (a int) engine=myisam
master-bin.000001 1283 Query 1 # use `test`; insert t1 values (1)
master-bin.000001 1366 Query 1 # use `test`; create table t0 (n int)
master-bin.000001 1452 Query 1 # use `test`; insert t0 select * from t1
master-bin.000001 1541 Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null)
master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=innodb
master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
do release_lock("lock1");
drop table t0,t2;
reset master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
select get_lock("a",10);
get_lock("a",10)
1
begin;
insert into t1 values(8);
insert into t2 select * from t1;
select get_lock("a",10);
get_lock("a",10)
1
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null
1
select
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%";
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
1 1
drop table t1, t2;
|