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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(1)
master-bin.000001	178	Query	1	79	use `test`; insert into t2 select * from t1
master-bin.000001	244	Query	1	244	use `test`; COMMIT
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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(2)
master-bin.000001	178	Query	1	79	use `test`; insert into t2 select * from t1
master-bin.000001	244	Query	1	244	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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(3)
master-bin.000001	178	Query	1	79	use `test`; savepoint my_savepoint
master-bin.000001	235	Query	1	79	use `test`; insert into t1 values(4)
master-bin.000001	294	Query	1	79	use `test`; insert into t2 select * from t1
master-bin.000001	360	Query	1	79	use `test`; rollback to savepoint my_savepoint
master-bin.000001	429	Query	1	429	use `test`; COMMIT
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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(5)
master-bin.000001	178	Query	1	79	use `test`; savepoint my_savepoint
master-bin.000001	235	Query	1	79	use `test`; insert into t1 values(6)
master-bin.000001	294	Query	1	79	use `test`; insert into t2 select * from t1
master-bin.000001	360	Query	1	79	use `test`; rollback to savepoint my_savepoint
master-bin.000001	429	Query	1	79	use `test`; insert into t1 values(7)
master-bin.000001	488	Query	1	488	use `test`; COMMIT
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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(8)
master-bin.000001	178	Query	1	79	use `test`; insert into t2 select * from t1
master-bin.000001	244	Query	1	244	use `test`; ROLLBACK
master-bin.000001	287	Query	1	287	use `test`; DO RELEASE_LOCK("a")
delete from t1;
delete from t2;
reset master;
insert into t1 values(9);
insert into t2 select * from t1;
show binlog events from 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; insert into t1 values(9)
master-bin.000001	138	Query	1	138	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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; insert into t1 values(10)
master-bin.000001	139	Query	1	139	use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
show binlog events from 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; insert into t1 values(10)
master-bin.000001	139	Query	1	139	use `test`; insert into t2 select * from t1
master-bin.000001	205	Query	1	205	use `test`; BEGIN
master-bin.000001	245	Query	1	205	use `test`; insert into t1 values(11)
master-bin.000001	305	Query	1	305	use `test`; COMMIT
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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(12)
master-bin.000001	179	Query	1	79	use `test`; insert into t2 select * from t1
master-bin.000001	245	Query	1	245	use `test`; COMMIT
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 79;
Log_name	Pos	Event_type	Server_id	Orig_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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(14)
master-bin.000001	179	Query	1	179	use `test`; COMMIT
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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(16)
master-bin.000001	179	Query	1	79	use `test`; insert into t1 values(18)
master-bin.000001	239	Query	1	239	use `test`; COMMIT
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;
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 79;
Log_name	Pos	Event_type	Server_id	Orig_log_pos	Info
master-bin.000001	79	Query	1	79	use `test`; BEGIN
master-bin.000001	119	Query	1	79	use `test`; insert into t1 values(16)
master-bin.000001	179	Query	1	79	use `test`; insert into t1 values(18)
master-bin.000001	239	Query	1	239	use `test`; COMMIT
master-bin.000001	280	Query	1	280	use `test`; delete from t1
master-bin.000001	329	Query	1	329	use `test`; delete from t2
master-bin.000001	378	Query	1	378	use `test`; alter table t2 type=MyISAM
master-bin.000001	439	Query	1	439	use `test`; insert into t1 values (1)
master-bin.000001	499	Query	1	499	use `test`; insert into t2 values (20)
master-bin.000001	560	Query	1	560	use `test`; drop table t1,t2
master-bin.000001	611	Query	1	611	use `test`; BEGIN
master-bin.000001	651	Query	1	611	use `test`; create temporary table ti (a int) engine=innodb
master-bin.000001	733	Query	1	733	use `test`; ROLLBACK
master-bin.000001	776	Query	1	776	use `test`; insert into ti values(1)
master-bin.000001	835	Query	1	835	use `test`; BEGIN
master-bin.000001	875	Query	1	835	use `test`; create temporary table t1 (a int) engine=myisam
master-bin.000001	957	Query	1	957	use `test`; COMMIT
master-bin.000001	998	Query	1	998	use `test`; create table t0 (n int)
master-bin.000001	1056	Query	1	1056	use `test`; insert t0 select * from t1
master-bin.000001	1117	Query	1	1117	use `test`; DO RELEASE_LOCK("a")
master-bin.000001	1172	Query	1	1172	use `test`; insert into t0 select GET_LOCK("lock1",null)
master-bin.000001	1251	Query	1	1251	use `test`; create table t2 (n int) engine=innodb
master-bin.000001	1323	Query	1	1323	use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=33,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=8
master-bin.000001	1457	Query	1	1457	use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
master-bin.000001	1558	Query	1	1558	use `test`; DO RELEASE_LOCK("lock1")
do release_lock("lock1");
drop table t0,t2;
