List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:June 6 2009 5:52pm
Subject:bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)
WL#2687
View as plain text  
#At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-40278/mysql-5.1-bugteam/ based on revid:staale.smedseng@stripped

 2911 Alfranio Correia	2009-06-06
      WL#2687

    removed:
      mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt
      mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt
    added:
      mysql-test/suite/rpl/include/rpl_mixed_engines.inc
      mysql-test/suite/rpl/r/rpl_mixing_mixed_engines.result
      mysql-test/suite/rpl/r/rpl_mixing_row_engines.result
      mysql-test/suite/rpl/r/rpl_mixing_stmt_engines.result
      mysql-test/suite/rpl/t/rpl_mixing_mixed_engines.test
      mysql-test/suite/rpl/t/rpl_mixing_row_engines.test
      mysql-test/suite/rpl/t/rpl_mixing_stmt_engines.test
    modified:
      mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
      mysql-test/extra/rpl_tests/rpl_insert_delayed.test
      mysql-test/extra/rpl_tests/rpl_insert_ignore.test
      mysql-test/extra/rpl_tests/rpl_log.test
      mysql-test/r/commit_1innodb.result
      mysql-test/suite/binlog/r/binlog_database.result
      mysql-test/suite/binlog/r/binlog_multi_engine.result
      mysql-test/suite/binlog/r/binlog_row_binlog.result
      mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
      mysql-test/suite/binlog/r/binlog_row_insert_select.result
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_stm_binlog.result
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_stm_row.result
      mysql-test/suite/binlog/t/binlog_incident.test
      mysql-test/suite/ndb/r/ndb_binlog_format.result
      mysql-test/suite/rpl/r/rpl_blackhole.result
      mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
      mysql-test/suite/rpl/r/rpl_innodb.result
      mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
      mysql-test/suite/rpl/r/rpl_log_pos.result
      mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
      mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
      mysql-test/suite/rpl/r/rpl_row_conflicts.result
      mysql-test/suite/rpl/r/rpl_row_create_table.result
      mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
      mysql-test/suite/rpl/r/rpl_row_insert_delayed.result
      mysql-test/suite/rpl/r/rpl_row_log.result
      mysql-test/suite/rpl/r/rpl_row_log_innodb.result
      mysql-test/suite/rpl/r/rpl_sp.result
      mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
      mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
      mysql-test/suite/rpl/r/rpl_stm_log.result
      mysql-test/suite/rpl/t/rpl_blackhole.test
      mysql-test/suite/rpl/t/rpl_empty_master_crash.test
      mysql-test/suite/rpl/t/rpl_innodb.test
      mysql-test/suite/rpl/t/rpl_invoked_features.test
      mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
      mysql-test/suite/rpl/t/rpl_log_pos.test
      mysql-test/suite/rpl/t/rpl_read_only.test
      mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
      mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
      mysql-test/suite/rpl/t/rpl_row_until.test
      mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
      mysql-test/suite/rpl/t/rpl_trigger.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result
      sql/ha_ndbcluster_binlog.cc
      sql/handler.cc
      sql/handler.h
      sql/log.cc
      sql/log.h
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/rpl_injector.cc
      sql/set_var.cc
      sql/sp.cc
      sql/sp_head.cc
      sql/sql_acl.cc
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_delete.cc
      sql/sql_insert.cc
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_table.cc
      sql/sql_update.cc
      sql/sql_view.cc
=== modified file 'mysql-test/extra/rpl_tests/rpl_flsh_tbls.test'
--- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test	2008-12-12 11:34:18 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test	2009-06-06 17:51:51 +0000
@@ -20,19 +20,13 @@ rename table t1 to t5, t2 to t1;
 # first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
 flush no_write_to_binlog tables;
 # Check that it's not in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
+source include/show_binlog_events2.inc;
 # Check that the master is not confused.
 select * from t3;
 # This FLUSH should go into the binlog to not confuse the slave.
 flush tables;
 # Check that it's in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
+source include/show_binlog_events2.inc;
 
 sync_slave_with_master;
 # Check that the slave is not confused.

=== modified file 'mysql-test/extra/rpl_tests/rpl_insert_delayed.test'
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test	2007-07-27 14:29:48 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test	2009-06-06 17:51:51 +0000
@@ -38,6 +38,8 @@ connection master;
 truncate table t1;
 # first scenario: duplicate on first row
 insert delayed into t1 values(10, "my name");
+flush table t1;
+select * from t1;
 if ($binlog_format_statement)
 {
   # statement below will be converted to non-delayed INSERT and so
@@ -49,7 +51,7 @@ if (!$binlog_format_statement)
 {
   insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
 }
-flush table t1; # to wait for INSERT DELAYED to be done
+flush table t1;
 select * from t1;
 sync_slave_with_master;
 # when bug existed in statement-based binlogging, t1 on slave had

=== modified file 'mysql-test/extra/rpl_tests/rpl_insert_ignore.test'
--- a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test	2007-06-18 13:36:10 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test	2009-06-06 17:51:51 +0000
@@ -55,7 +55,9 @@ INSERT INTO t1 VALUES (2, 2);
 INSERT INTO t1 VALUES (3, 3);
 INSERT INTO t1 VALUES (4, 4);
 
+--disable_warnings
 INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+--enable_warnings
 
 SELECT * FROM t1 ORDER BY a;
 

=== modified file 'mysql-test/extra/rpl_tests/rpl_log.test'
--- a/mysql-test/extra/rpl_tests/rpl_log.test	2009-02-02 11:44:18 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_log.test	2009-06-06 17:51:51 +0000
@@ -104,7 +104,7 @@ show binlog events in 'slave-bin.000001'
 --replace_column 2 # 5 #
 --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
 show binlog events in 'slave-bin.000002' from 4;
-source include/show_slave_status.inc;
+source include/show_slave_status2.inc;
 
 # Need to recode the following
 

=== modified file 'mysql-test/r/commit_1innodb.result'
--- a/mysql-test/r/commit_1innodb.result	2009-02-10 14:44:58 +0000
+++ b/mysql-test/r/commit_1innodb.result	2009-06-06 17:51:51 +0000
@@ -608,6 +608,8 @@ select count(*) from t2;
 count(*)
 3
 update t1 set a=2 where a=f1()+10;
+Warnings:
+Note	1592	Statement is not safe to log in statement format.
 select count(*) from t2;
 count(*)
 5

=== modified file 'mysql-test/suite/binlog/r/binlog_database.result'
--- a/mysql-test/suite/binlog/r/binlog_database.result	2009-01-23 12:22:05 +0000
+++ b/mysql-test/suite/binlog/r/binlog_database.result	2009-06-06 17:51:51 +0000
@@ -100,15 +100,11 @@ drop table tt1, t1;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	drop database if exists mysqltest1
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 FLUSH STATUS;
 show databases;

=== modified file 'mysql-test/suite/binlog/r/binlog_multi_engine.result'
--- a/mysql-test/suite/binlog/r/binlog_multi_engine.result	2008-10-24 12:51:06 +0000
+++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result	2009-06-06 17:51:51 +0000
@@ -6,10 +6,14 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
 INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
 INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 *** Please look in binlog_multi_engine.test if you have a diff here ****
 START TRANSACTION;
 INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
 COMMIT;
 TRUNCATE t1m;
@@ -58,7 +62,6 @@ mysqld-bin.000001	#	Table_map	#	#	table_
 mysqld-bin.000001	#	Write_rows	#	#	table_id: #
 mysqld-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 mysqld-bin.000001	#	Query	#	#	COMMIT
-mysqld-bin.000001	#	Query	#	#	use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
 mysqld-bin.000001	#	Query	#	#	use `test`; TRUNCATE t1m
 mysqld-bin.000001	#	Query	#	#	use `test`; TRUNCATE t1b
 mysqld-bin.000001	#	Query	#	#	use `test`; TRUNCATE t1n
@@ -73,10 +76,8 @@ UPDATE t1n, t1b SET e = 2, b = 3 WHERE f
 ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-mysqld-bin.000001	#	Query	#	#	use `test`; BEGIN
 mysqld-bin.000001	#	Table_map	#	#	table_id: # (test.t1m)
 mysqld-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-mysqld-bin.000001	#	Query	#	#	use `test`; COMMIT
 mysqld-bin.000001	#	Query	#	#	use `test`; BEGIN
 mysqld-bin.000001	#	Table_map	#	#	table_id: # (test.t1b)
 mysqld-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F

=== modified file 'mysql-test/suite/binlog/r/binlog_row_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result	2009-03-25 19:41:16 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result	2009-06-06 17:51:51 +0000
@@ -1085,11 +1085,9 @@ show binlog events from 0;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	4	Format_desc	1	106	Server version, Binlog ver: 4
 master-bin.000001	106	Query	1	227	use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
-master-bin.000001	227	Query	1	295	use `test`; BEGIN
-master-bin.000001	295	Table_map	1	337	table_id: # (test.t1)
-master-bin.000001	337	Write_rows	1	383	table_id: # flags: STMT_END_F
-master-bin.000001	383	Query	1	452	use `test`; COMMIT
-master-bin.000001	452	Query	1	528	use `test`; drop table t1
+master-bin.000001	227	Table_map	1	269	table_id: # (test.t1)
+master-bin.000001	269	Write_rows	1	315	table_id: # flags: STMT_END_F
+master-bin.000001	315	Query	1	391	use `test`; drop table t1
 reset master;
 CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 USE bug39182;
@@ -1192,10 +1190,8 @@ use test;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (id tinyint auto_increment primary key)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; drop table t1
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
@@ -1206,18 +1202,12 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE IF NOT EXISTS `t3` (
   `a` int(11) DEFAULT NULL
 )
-master-bin.000001	#	Query	#	#	use `mysql`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.user)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `mysql`; COMMIT
-master-bin.000001	#	Query	#	#	use `mysql`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.user)
 master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `mysql`; COMMIT
-master-bin.000001	#	Query	#	#	use `mysql`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.user)
 master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `mysql`; COMMIT
 drop table t1,t2,t3,tt1;
 create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
 insert delayed into t1 values (207);
@@ -1227,10 +1217,8 @@ FLUSH TABLES;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (id tinyint auto_increment primary key)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; drop table t1
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
@@ -1241,32 +1229,20 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE IF NOT EXISTS `t3` (
   `a` int(11) DEFAULT NULL
 )
-master-bin.000001	#	Query	#	#	use `mysql`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.user)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `mysql`; COMMIT
-master-bin.000001	#	Query	#	#	use `mysql`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.user)
 master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `mysql`; COMMIT
-master-bin.000001	#	Query	#	#	use `mysql`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.user)
 master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `mysql`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; FLUSH TABLES
 insert delayed into t1 values (null),(null),(null),(null);
 insert delayed into t1 values (null),(null),(400),(null);

=== modified file 'mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result'
--- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result	2008-04-02 18:47:16 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result	2009-06-06 17:51:51 +0000
@@ -5,30 +5,13 @@ reset master;
 insert into t2 values (@v);
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 flush logs;
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=10000/*!*/;
-SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=0/*!*/;
-SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
-/*!\C latin1 *//*!*/;
-SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-SET @@session.lc_time_names=0/*!*/;
-SET @@session.collation_database=DEFAULT/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=10000/*!*/;
-COMMIT
-/*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;

=== modified file 'mysql-test/suite/binlog/r/binlog_row_insert_select.result'
--- a/mysql-test/suite/binlog/r/binlog_row_insert_select.result	2008-03-28 12:16:41 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_insert_select.result	2009-06-06 17:51:51 +0000
@@ -8,10 +8,8 @@ insert into t1 select * from t2;
 ERROR 23000: Duplicate entry '2' for key 'a'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 select * from t1;
 a
 1

=== modified file 'mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2009-02-10 14:44:58 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2009-06-06 17:51:51 +0000
@@ -8,11 +8,11 @@ insert into t2 select * from t1;
 commit;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 delete from t1;
 delete from t2;
@@ -25,12 +25,8 @@ Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 delete from t1;
 delete from t2;
 reset master;
@@ -45,14 +41,14 @@ Warning	1196	Some non-transactional chan
 commit;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; savepoint my_savepoint
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; rollback to savepoint my_savepoint
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 delete from t1;
@@ -74,14 +70,14 @@ a
 7
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; savepoint my_savepoint
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; rollback to savepoint my_savepoint
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
@@ -100,12 +96,8 @@ get_lock("a",10)
 1
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 delete from t1;
 delete from t2;
 reset master;
@@ -117,10 +109,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 delete from t1;
 delete from t2;
 reset master;
@@ -133,6 +123,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 insert into t1 values(11);
 commit;
 show binlog events from <binlog_start>;
@@ -141,9 +133,9 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
@@ -272,16 +264,14 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; drop table t1,t2
 master-bin.000001	#	Query	#	#	use `test`; create table t0 (n int)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; create table t2 (n int) engine=innodb
 do release_lock("lock1");
 drop table t0,t2;
@@ -364,46 +354,30 @@ a	b
 DROP TABLE t1,t2;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE if exists t2
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t2
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; TRUNCATE table t2
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t2
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 master-bin.000001	#	Query	#	#	use `test`; TRUNCATE table t2
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 reset master;
 create table t1 (a int) engine=innodb;
@@ -430,7 +404,7 @@ select
 @a not like "%#%error_code=%error_code=%";
 @a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
 @a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%"	@a not like "%#%error_code=%error_code=%"
-1	1
+0	1
 drop table t1, t2;
 create temporary table tt (a int unique);
 create table ti (a int) engine=innodb;
@@ -447,12 +421,6 @@ count(*)
 2
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ti)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ti)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 select count(*) from ti /* zero */;
 count(*)
 0
@@ -499,11 +467,9 @@ insert into t2 values (bug27417(2));
 ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 /* only (!) with fixes for #23333 will show there is the query */;
 select count(*) from t1 /* must be 3 */;
 count(*)
@@ -518,11 +484,9 @@ count(*)
 2
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 /* the query must be in regardless of #23333 */;
 select count(*) from t1 /* must be 5 */;
 count(*)
@@ -544,11 +508,8 @@ insert into t2 values (bug27417(1));
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 /* the output must denote there is the query */;
 select count(*) from t1 /* must be 1 */;
 count(*)
@@ -561,12 +522,8 @@ insert into t2 select bug27417(1) union 
 ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 /* the output must denote there is the query */;
 select count(*) from t1 /* must be 2 */;
 count(*)
@@ -578,13 +535,11 @@ update t3 set b=b+bug27417(1);
 ERROR 23000: Duplicate entry '4' for key 'b'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: #
 master-bin.000001	#	Update_rows	#	#	table_id: #
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 /* the output must denote there is the query */;
 select count(*) from t1 /* must be 2 */;
 count(*)
@@ -598,11 +553,8 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1)
 ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t4)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 /* the output must denote there is the query */;
 select count(*) from t1 /* must be 4 */;
 count(*)
@@ -631,12 +583,9 @@ delete from t2;
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 /* the output must denote there is the query */;
 select count(*) from t1 /* must be 1 */;
 count(*)
@@ -654,13 +603,8 @@ delete t2.* from t2,t5 where t2.a=t5.a +
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Delete_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 /* the output must denote there is the query */;
 select count(*) from t1 /* must be 1 */;
 count(*)
@@ -679,13 +623,8 @@ count(*)
 2
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t4)
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 /* the output must denote there is the query */;
 drop trigger trg_del_t2;
 drop table t1,t2,t3,t4,t5;
@@ -706,12 +645,6 @@ count(*)
 2
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ti)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ti)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 select count(*) from ti /* zero */;
 count(*)
 0
@@ -795,10 +728,6 @@ insert into t2 values (bug27417(1));
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Intvar	#	#	INSERT_ID=1
-master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (bug27417(1))
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 select count(*) from t1 /* must be 1 */;
 count(*)
 1
@@ -810,10 +739,6 @@ insert into t2 select bug27417(1) union 
 ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Intvar	#	#	INSERT_ID=2
-master-bin.000001	#	Query	#	#	use `test`; insert into t2 select bug27417(1) union select bug27417(2)
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 select count(*) from t1 /* must be 2 */;
 count(*)
 2
@@ -867,10 +792,6 @@ delete from t2;
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Intvar	#	#	INSERT_ID=9
-master-bin.000001	#	Query	#	#	use `test`; delete from t2
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 select count(*) from t1 /* must be 1 */;
 count(*)
 1
@@ -887,9 +808,6 @@ delete t2.* from t2,t5 where t2.a=t5.a +
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Query	#	#	use `test`; delete t2.* from t2,t5 where t2.a=t5.a + 1
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 select count(*) from t1 /* must be 1 */;
 count(*)
 1
@@ -907,14 +825,6 @@ count(*)
 2
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
-master-bin.000001	#	Intvar	#	#	INSERT_ID=10
-master-bin.000001	#	User var	#	#	@`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
-master-bin.000001	#	Intvar	#	#	INSERT_ID=10
-master-bin.000001	#	User var	#	#	@`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001	#	Execute_load_query	#	#	use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
-master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
 drop trigger trg_del_t2;
 drop table t1,t2,t3,t4,t5;
 drop function bug27417;

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2009-03-25 19:41:16 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2009-06-06 17:51:51 +0000
@@ -730,18 +730,12 @@ master-bin.000001	#	Query	#	#	use `mysql
 master-bin.000001	#	Query	#	#	use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
 master-bin.000001	#	Query	#	#	use `test`; drop table t1,t2,t3,tt1
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; FLUSH TABLES
 insert delayed into t1 values (null),(null),(null),(null);
 insert delayed into t1 values (null),(null),(400),(null);

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2009-02-10 14:44:58 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2009-06-06 17:51:51 +0000
@@ -5,6 +5,8 @@ reset master;
 begin;
 insert into t1 values(1);
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 commit;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -18,6 +20,8 @@ reset master;
 begin;
 insert into t1 values(2);
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 rollback;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -35,6 +39,8 @@ insert into t1 values(3);
 savepoint my_savepoint;
 insert into t1 values(4);
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 rollback to savepoint my_savepoint;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -56,6 +62,8 @@ insert into t1 values(5);
 savepoint my_savepoint;
 insert into t1 values(6);
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 rollback to savepoint my_savepoint;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -84,6 +92,8 @@ get_lock("a",10)
 begin;
 insert into t1 values(8);
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 select get_lock("a",10);
 get_lock("a",10)
 1
@@ -98,6 +108,8 @@ delete from t2;
 reset master;
 insert into t1 values(9);
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
@@ -110,6 +122,8 @@ reset master;
 insert into t1 values(10);
 begin;
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
@@ -369,6 +383,8 @@ get_lock("a",10)
 begin;
 insert into t1 values(8);
 insert into t2 select * from t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 select get_lock("a",10);
 get_lock("a",10)
 1
@@ -394,6 +410,8 @@ begin;
 insert into ti values (1);
 insert into ti values (2) ;
 insert into tt select * from ti;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 rollback;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -411,6 +429,8 @@ select count(*) from ti /* zero */;
 count(*)
 0
 insert into ti select * from tt;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 select * from ti /* that is what slave would miss - a bug */;
 a
 1
@@ -437,6 +457,8 @@ select count(*) from ti /* zero */;
 count(*)
 0
 insert into ti select * from tt;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 select * from tt /* that is what otherwise slave missed - the bug */;
 a
 1
@@ -636,6 +658,8 @@ begin;
 insert into ti values (1);
 insert into ti values (2) ;
 insert into tt select * from ti;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 rollback;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -653,6 +677,8 @@ select count(*) from ti /* zero */;
 count(*)
 0
 insert into ti select * from tt;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 select * from ti /* that is what slave would miss - bug#28960 */;
 a
 1
@@ -679,6 +705,8 @@ select count(*) from ti /* zero */;
 count(*)
 0
 insert into ti select * from tt;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 select * from tt /* that is what otherwise slave missed - the bug */;
 a
 1

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_row.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_row.result	2009-01-30 13:44:49 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_row.result	2009-06-06 17:51:51 +0000
@@ -65,10 +65,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES (3)
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES (4)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 DROP TABLE t1;
 DROP TABLE t2;
 SET GLOBAL BINLOG_FORMAT = @saved_global_binlog_format;

=== modified file 'mysql-test/suite/binlog/t/binlog_incident.test'
--- a/mysql-test/suite/binlog/t/binlog_incident.test	2009-05-11 11:32:38 +0000
+++ b/mysql-test/suite/binlog/t/binlog_incident.test	2009-06-06 17:51:51 +0000
@@ -24,4 +24,4 @@ exec $MYSQL_BINLOG --start-position=106 
 eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
 --enable_query_log
 
-remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
\ No newline at end of file
+remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;

=== modified file 'mysql-test/suite/ndb/r/ndb_binlog_format.result'
--- a/mysql-test/suite/ndb/r/ndb_binlog_format.result	2008-02-28 11:21:44 +0000
+++ b/mysql-test/suite/ndb/r/ndb_binlog_format.result	2009-06-06 17:51:51 +0000
@@ -7,9 +7,13 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
 INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2);
 INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 START TRANSACTION;
 INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c;
 COMMIT;
 show binlog events from <binlog_start>;

=== added file 'mysql-test/suite/rpl/include/rpl_mixed_engines.inc'
--- a/mysql-test/suite/rpl/include/rpl_mixed_engines.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/include/rpl_mixed_engines.inc	2009-06-06 17:51:51 +0000
@@ -0,0 +1,905 @@
+###################################################################################
+# This test checks if transactions that mixes transactional and non-transactional
+# tables are correctly handled. Thus to check the behavior provided by the current
+# code we devide the test as follows:
+#
+# 1 - CREATING TABLES through SELECT * FROM
+# 2 - MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
+# 3 - CONCURRENCY:
+#     2.1 - NON-TRANSACT TABLES -  SET AUTOCOMMIT = 0  | COMMIT
+#     2.2 - NON-TRANSACT TABLES -  SET AUTOCOMMIT = 1  | START - COMMIT
+# 4 - SAVE POINTS
+###################################################################################
+ 
+--echo ###################################################################################
+--echo #                                   CONFIGURATION
+--echo ###################################################################################
+connection master;
+
+CREATE TABLE t1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t5 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t6 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t7 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t8 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t9 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+
+INSERT INTO t1 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t2 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t3 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t4 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t5 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+
+DELIMITER |;
+
+CREATE FUNCTION f1 () RETURNS VARCHAR(64)
+BEGIN
+  RETURN "Testing...";
+END|
+
+CREATE FUNCTION f2 () RETURNS VARCHAR(64)
+BEGIN
+  RETURN f1();
+END|
+
+CREATE PROCEDURE pc6 (IN x INT, IN y VARCHAR(64))
+BEGIN
+  INSERT INTO t6 VALUES (y,x,x);
+END|
+
+CREATE TRIGGER tr6_i BEFORE INSERT ON t6 FOR EACH ROW
+BEGIN
+  INSERT INTO t7 VALUES (NEW.a, NEW.b, NEW.c);
+  INSERT INTO t8 VALUES (NEW.a, NEW.b, NEW.c);
+  INSERT INTO t9 VALUES (NEW.a, NEW.b, NEW.c);
+END|
+
+DELIMITER ;|
+
+INSERT INTO t6 VALUES("text 100", 100, "text 100"), ("text 200", 200, "text 200"), ("text 300", 300, "text 300");
+INSERT INTO t7 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t8 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t9 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+
+--echo ###################################################################################
+--echo #                                1 - CREATING TABLES
+--echo ###################################################################################
+connection master;
+
+CREATE TABLE t10 SELECT * FROM t2;
+DROP TABLE t10;
+CREATE TABLE t11 SELECT * FROM t2;
+DROP TABLE t11;
+
+
+--echo ###################################################################################
+--echo #                 2 - MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
+--echo ###################################################################################
+connection master;
+
+# Caching  (C): (stmt-cache (s), trx-cache (t), ignored (i))
+# Flushing (F): (upon committing/rollingback a statement (d), upon
+#               committing/rolling back a transaction (c/r), ignored (i))
+
+#
+#                          STMT             ROW              MIXED
+#
+
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - T             C - T
+--echo #1.a) B T T C         F - C           F - C             F - C
+--echo #
+BEGIN;
+INSERT INTO t2 VALUES ("new text 5", 5, "new text 5");
+INSERT INTO t3 VALUES ("new text 5", 5, "new text 5");
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - T             C - T
+--echo #1.b) B T T R         F - I           F - I             F - I
+--echo #
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t3 VALUES ("new text 6", 6, "new text 6");
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #2.a) B T N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+--echo #
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t1 VALUES ("new text 6", 6, "new text 6");
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #2.b) B T N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+--echo #
+BEGIN;
+INSERT INTO t2 VALUES ("new text 7", 7, "new text 7");
+INSERT INTO t1 VALUES ("new text 7", 7, "new text 7");
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - T             C - T
+--echo #3.a) T               F - C           F - C             F - C
+--echo #
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - T             C - T
+--echo #3.b) T with error    F - I           F - I             F - I
+--echo #
+--error ER_DUP_ENTRY
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - S           C - S             C - S
+--echo #4.a) N               F - D           F - D             F - D
+--echo #
+INSERT INTO t1 VALUES ("new text 9", 9, "new text 9");
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #5.a) M               F - C           F - D(N) C(T)     F - D(N) C(T)
+--echo #
+DELETE FROM t1;
+INSERT INTO t1 SELECT * FROM t2;
+DELETE FROM t2;
+INSERT INTO t2 SELECT * FROM t1; 
+INSERT INTO t6 VALUES ("new text 400", 400, '');
+INSERT INTO t6 VALUES("new text 500", 500, f1());
+CALL pc6(600, "Testing...");
+INSERT INTO t6 VALUES(700, 700, f2());
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 8", t9.a= "new text 8", t6.a= "new text 8", t7.a= "new text 8" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 9", t7.a= "new text 9", t8.a= "new text 9", t9.a = "new text 9" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 10", t8.a= "new text 10", t9.a= "new text 10", t7.a = "new text 10" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 11", t8.a= "new text 11", t9.a= "new text 11", t7.a = "new text 11" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #5.b) M with error    F - R           F - D(N) I(T)     F - D(N) I(T)
+--echo #
+--error ER_DUP_ENTRY
+INSERT INTO t2 SELECT * FROM t1;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+--echo #6.a) B N N T C       F - D(N) C(T)   F - D(N) C(T)     F - D(N) C(T)
+--echo #
+BEGIN;
+INSERT INTO t1 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t5 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t2 VALUES ("new text 10", 10, "new text 10");
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+--echo #6.b) B N N T R       F - D(N) R(T)   F - D(N) I(T)     F - D(N) I(T)
+--echo #
+BEGIN;
+INSERT INTO t1 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t5 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t2 VALUES ("new text 11", 11, "new text 11");
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - S(N)        C - S(N)          C - S(N)
+--echo #7.a) B N N C         F - D(N)        F - D(N)          F - D(N)
+--echo #
+BEGIN;
+INSERT INTO t1 VALUES ("new text 12", 12, "new text 12");
+INSERT INTO t5 VALUES ("new text 12", 12, "new text 12");
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - S(N)        C - S(N)          C - S(N)
+--echo #7.b) B N N R         F - D(N)        F - D(N)          F - D(N)
+--echo #
+BEGIN;
+INSERT INTO t1 VALUES ("new text 13", 13, "new text 13");
+INSERT INTO t5 VALUES ("new text 13", 13, "new text 13");
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #8.a) B M T C         F - C           F - D(N) C(T)     F - D(N) C(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t3 VALUES ("new text 14", 14, "new text 14");
+COMMIT;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t3 VALUES ("new text 15", 15, "new text 15");
+COMMIT;
+
+BEGIN;
+INSERT INTO t6 VALUES ("new text 1200", 1200, '');
+INSERT INTO t7 VALUES ("new text 20", 20, '');
+COMMIT;
+
+BEGIN;
+INSERT INTO t6 VALUES("new text 1300", 1300, f1());
+INSERT INTO t7 VALUES ("new text 21", 21, '');
+COMMIT;
+
+BEGIN;
+CALL pc6(1400, "Testing...");
+INSERT INTO t7 VALUES ("new text 22", 22, '');
+COMMIT;
+
+BEGIN;
+INSERT INTO t6 VALUES(1500, 1500, f2());
+INSERT INTO t7 VALUES ("new text 23", 23, '');
+COMMIT;
+
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 16", t9.a= "new text 16", t6.a= "new text 16", t7.a= "new text 16" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 24", 24, '');
+COMMIT;
+
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 17", t7.a= "new text 17", t8.a= "new text 17", t9.a = "new text 17" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 25", 25, '');
+COMMIT;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 18", t8.a= "new text 18", t9.a= "new text 18", t7.a = "new text 18" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 250", 250, '');
+COMMIT;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 19", t8.a= "new text 19", t9.a= "new text 19", t7.a = "new text 19" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 26", 26, '');
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #8.b) B M T R         F - R           F - D(N) I(T)     F - D(N) I(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t3 VALUES ("new text 17", 17, "new text 17");
+ROLLBACK;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t3 VALUES ("new text 18", 18, "new text 18");
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2000", 2000, '');
+INSERT INTO t7 VALUES ("new text 27", 27, '');
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t6 VALUES("new text 2100", 2100, f1());
+INSERT INTO t7 VALUES ("new text 28", 28, '');
+ROLLBACK;
+
+BEGIN;
+CALL pc6(2200, "Testing...");
+INSERT INTO t7 VALUES ("new text 29", 29, '');
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t6 VALUES(2300, 2300, f2());
+INSERT INTO t7 VALUES ("new text 30", 30, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 24", t9.a= "new text 24", t6.a= "new text 24", t7.a= "new text 24" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 31", 31, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 25", t7.a= "new text 25", t8.a= "new text 25", t9.a = "new text 25" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 32", 32, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 26", t8.a= "new text 26", t9.a= "new text 26", t7.a = "new text 26" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 33", 33, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 27", t8.a= "new text 27", t9.a= "new text 27", t7.a = "new text 27" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 34", 34, '');
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #9.a) B M N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t5 VALUES ("new text 20", 20, "new text 20");
+COMMIT;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t5 VALUES ("new text 21", 21, "new text 21");
+COMMIT;
+
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2800", 2800, '');
+INSERT INTO t9 VALUES ("new text 35", 35, '');
+COMMIT;
+
+BEGIN;
+INSERT INTO t6 VALUES("new text 2900", 2900, f1());
+INSERT INTO t9 VALUES ("new text 36", 36, '');
+COMMIT;
+
+BEGIN;
+CALL pc6(3000, "Testing...");
+INSERT INTO t9 VALUES ("new text 37", 37, '');
+COMMIT;
+
+BEGIN;
+INSERT INTO t6 VALUES(3100, 3100, f2());
+INSERT INTO t9 VALUES ("new text 38", 38, '');
+COMMIT;
+
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 32", t9.a= "new text 32", t6.a= "new text 32", t7.a= "new text 32" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 39", 39, '');
+COMMIT;
+
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 33", t7.a= "new text 33", t8.a= "new text 33", t9.a = "new text 33" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 40", 40, '');
+COMMIT;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 34", t8.a= "new text 34", t9.a= "new text 34", t7.a = "new text 34" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 41", 41, '');
+COMMIT;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 35", t8.a= "new text 35", t9.a= "new text 35", t7.a = "new text 35" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 42", 43, '');
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #9.b) B M N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t5 VALUES ("new text 23", 23, "new text 23");
+ROLLBACK;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t5 VALUES ("new text 24", 24, "new text 24");
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+
+BEGIN;
+INSERT INTO t6 VALUES ("new text 3600", 3600, '');
+INSERT INTO t9 VALUES ("new text 44", 44, '');
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t6 VALUES("new text 3700", 3700, f1());
+INSERT INTO t9 VALUES ("new text 45", 45, '');
+ROLLBACK;
+
+BEGIN;
+CALL pc6(3800, "Testing...");
+INSERT INTO t9 VALUES ("new text 46", 46, '');
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t6 VALUES(3900, 3900, f2());
+INSERT INTO t9 VALUES ("new text 47", 47, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 40", t9.a= "new text 40", t6.a= "new text 40", t7.a= "new text 40" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 48", 48, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 41", t7.a= "new text 41", t8.a= "new text 41", t9.a = "new text 41" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text", 49, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 42", t8.a= "new text 42", t9.a= "new text 42", t7.a = "new text 42" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 50", 50, '');
+ROLLBACK;
+
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 43", t8.a= "new text 43", t9.a= "new text 43", t7.a = "new text 43" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 51", 51, '');
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+--echo #10.a) B N M C        F - D(N) C(M)   F - D(N) C(T)     F - D(N) C(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 26", 26, "new text 26");
+INSERT INTO t1 SELECT * FROM t2;
+COMMIT;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 27", 27, "new text 27");
+INSERT INTO t2 SELECT * FROM t1;
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 52", 52, '');
+INSERT INTO t6 VALUES ("new text 4400", 4400, '');
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 53", 53, '');
+INSERT INTO t6 VALUES("new text 4500", 4500, f1());
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 54", 54, '');
+CALL pc6(4600, "Testing...");
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 55", 55, '');
+INSERT INTO t6 VALUES(4700, 4700, f2());
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 56", 56, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 48", t9.a= "new text 48", t6.a= "new text 48", t7.a= "new text 48" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 57", 57, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 49", t7.a= "new text 49", t8.a= "new text 49", t9.a = "new text 49" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 58", 58, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 50", t8.a= "new text 50", t9.a= "new text 50", t7.a = "new text 50" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 59", 59, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 51", t8.a= "new text 51", t9.a= "new text 51", t7.a = "new text 51" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+--echo #10.b) B N M R        F - D(N) R(M)   F - D(N) I(T)     F - D(N) I(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 29", 29, "new text 29");
+INSERT INTO t1 SELECT * FROM t2;
+ROLLBACK;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 30", 30, "new text 30");
+INSERT INTO t2 SELECT * FROM t1;
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 60", 60, '');
+INSERT INTO t6 VALUES ("new text 5200", 5200, '');
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 61", 61, '');
+INSERT INTO t6 VALUES("new text 5300", 5300, f1());
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 62", 62, '');
+CALL pc6(5400, "Testing...");
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 63", 63, '');
+INSERT INTO t6 VALUES(5500, 5500, f2());
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 64", 64, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 56", t9.a= "new text 56", t6.a= "new text 56", t7.a= "new text 56" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 65", 65, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 57", t7.a= "new text 57", t8.a= "new text 57", t9.a = "new text 57" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 66", 66, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 58", t8.a= "new text 58", t9.a= "new text 58", t7.a = "new text 58" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t9 VALUES ("new text 67", 67, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 59", t8.a= "new text 59", t9.a= "new text 59", t7.a = "new text 59" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #11.a) B T M C        F - C           F - D(N) C(T)     F - D(N) C(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 68", 68, "new text 68");
+INSERT INTO t1 SELECT * FROM t2;
+COMMIT;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 69", 69, "new text 69");
+INSERT INTO t2 SELECT * FROM t1;
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 70", 70, '');
+INSERT INTO t6 VALUES ("new text 5600", 5600, '');
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 89", 89, '');
+INSERT INTO t6 VALUES("new text 5700", 5700, f1());
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 71", 71, '');
+CALL pc6(5800, "Testing...");
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 72", 72, '');
+INSERT INTO t6 VALUES(5900, 5900, f2());
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 73", 73, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 75", 75, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 77", 77, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 79", 79, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+
+--source include/show_binlog_events.inc
+
+--echo
+--echo
+--echo
+--echo
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+--echo #                     C - T           C - S(N) T(T)     C - S(N) T(T)
+--echo #11.b) B T M R        F - R           F - D(N) I(T)     F - D(N) I(T)
+--echo #
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 80", 80, "new text 80");
+INSERT INTO t1 SELECT * FROM t2;
+ROLLBACK;
+
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 81", 81, "new text 81");
+INSERT INTO t2 SELECT * FROM t1;
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 82", 82, '');
+INSERT INTO t6 VALUES ("new text 6000", 6000, '');
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 83", 83, '');
+INSERT INTO t6 VALUES("new text 6100", 6100, f1());
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 84", 84, '');
+CALL pc6(6200, "Testing...");
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+INSERT INTO t6 VALUES(6300, 6300, f2());
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 86", 86, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 87", 87, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+BEGIN;
+INSERT INTO t7 VALUES ("new text 88", 88, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+
+--source include/show_binlog_events.inc
+
+connection master;
+sync_slave_with_master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
+
+
+--echo ###################################################################################
+--echo #                                 3 - CONCURRENCY 
+--echo ###################################################################################
+connect (conn1, 127.0.0.1,root,,);
+connect (conn2, 127.0.0.1,root,,);
+
+echo ***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 0  |  COMMIT;
+connection master;
+
+INSERT INTO t1 VALUES ("new text 109", 109, "");
+INSERT INTO t1 VALUES ("new text 1010", 1010, "");
+
+echo ***** conn1: begin;
+connection conn1;
+SET AUTOCOMMIT= 0;
+
+echo ***** conn2: begin and update t1;
+connection conn2;
+SET AUTOCOMMIT= 0;
+UPDATE t1 SET a = "new text 1011" WHERE b = 109;
+
+echo ***** conn1: delete from t1 and commit;
+connection conn1;
+DELETE FROM t1 WHERE b = 109;
+DELETE FROM t1 WHERE b = 1010;
+COMMIT;
+
+echo ***** conn2: commit;
+connection conn2;
+COMMIT;
+
+connection master;
+sync_slave_with_master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
+
+echo ***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 1 | START - COMMIT;
+connection master;
+INSERT INTO t1 VALUES ("new text 1012", 1012, "");
+INSERT INTO t1 VALUES ("new text 1013", 1013, "");
+
+echo ***** conn1: begin;
+connection conn1;
+SET AUTOCOMMIT= 1;
+BEGIN;
+
+echo ***** conn2: begin and update t1;
+connection conn2;
+SET AUTOCOMMIT= 1;
+BEGIN;
+UPDATE t1 SET a = "new text 1014" WHERE b = 1012;
+
+echo ***** conn1: delete from t1 and commit;
+connection conn1;
+DELETE FROM t1 WHERE b = 1012;
+DELETE FROM t1 WHERE b = 1013;
+COMMIT;
+
+echo ***** conn2: commit;
+connection conn2;
+COMMIT;
+
+connection master;
+sync_slave_with_master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
+
+
+--echo ###################################################################################
+--echo #                               4 - SAVE POINTS
+--echo ###################################################################################
+connection master;
+
+BEGIN;
+INSERT INTO t2 VALUES ("new text 400", 400, "new text 400");
+INSERT INTO t3 VALUES ("new text 401", 401, "new text 401");
+SAVEPOINT sv;
+INSERT INTO t1 VALUES ("new text 402", 402, "new text 402");
+INSERT INTO t3 VALUES ("new text 403", 403, "new text 403");
+ROLLBACK TO sv;
+COMMIT;
+
+sync_slave_with_master;
+
+connection master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
+
+
+--echo ###################################################################################
+--echo #                                        CLEAN
+--echo ###################################################################################
+
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP TABLE t7;
+DROP TABLE t8;
+DROP TABLE t9;
+DROP PROCEDURE pc6;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+
+sync_slave_with_master;
+
+disconnect conn1;
+disconnect conn2;

=== modified file 'mysql-test/suite/rpl/r/rpl_blackhole.result'
--- a/mysql-test/suite/rpl/r/rpl_blackhole.result	2009-01-30 13:44:49 +0000
+++ b/mysql-test/suite/rpl/r/rpl_blackhole.result	2009-06-06 17:51:51 +0000
@@ -40,14 +40,6 @@ SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
 >>> Something was written to binary log <<<
-[on master]
-INSERT INTO t2 SELECT * FROM t1;
-[on slave]
-# Expect 0
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-0
->>> Something was written to binary log <<<
 ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);
 [on master]
 INSERT INTO t1 VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4);

=== modified file 'mysql-test/suite/rpl/r/rpl_extraCol_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result	2008-11-04 07:43:21 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result	2009-06-06 17:51:51 +0000
@@ -434,7 +434,7 @@ Replicate_Ignore_Table	#
 Replicate_Wild_Do_Table	
 Replicate_Wild_Ignore_Table	
 Last_Errno	1364
-Last_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330
+Last_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 262
 Skip_Counter	0
 Exec_Master_Log_Pos	#
 Relay_Log_Space	#
@@ -452,7 +452,7 @@ Master_SSL_Verify_Server_Cert	No
 Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	1364
-Last_SQL_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330
+Last_SQL_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 262
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 *** Create t10 on slave  ***

=== modified file 'mysql-test/suite/rpl/r/rpl_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_innodb.result	2008-10-29 13:25:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_innodb.result	2009-06-06 17:51:51 +0000
@@ -76,7 +76,7 @@ SHOW CREATE TABLE mysqltest1.tmp2;
 ERROR 42S02: Table 'mysqltest1.tmp2' doesn't exist
 SELECT COUNT(*) FROM mysqltest1.t1;
 COUNT(*)
-2
+0
 FLUSH LOGS;
 -------- switch to master --------
 FLUSH LOGS;

=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata_fatal.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2009-06-06 17:51:51 +0000
@@ -13,7 +13,7 @@ Master_User	root
 Master_Port	MASTER_PORT
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	290
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -28,7 +28,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	290
+Exec_Master_Log_Pos	#
 Relay_Log_Space	#
 Until_Condition	None
 Until_Log_File	
@@ -53,7 +53,7 @@ Master_User	root
 Master_Port	MASTER_PORT
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	465
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -68,7 +68,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	1593
 Last_Error	Fatal error: Not enough memory
 Skip_Counter	0
-Exec_Master_Log_Pos	325
+Exec_Master_Log_Pos	#
 Relay_Log_Space	#
 Until_Condition	None
 Until_Log_File	

=== modified file 'mysql-test/suite/rpl/r/rpl_log_pos.result'
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result	2008-07-10 16:09:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result	2009-06-06 17:51:51 +0000
@@ -57,7 +57,7 @@ Master_User	root
 Master_Port	MASTER_PORT
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	75
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -72,7 +72,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	75
+Exec_Master_Log_Pos	#
 Relay_Log_Space	#
 Until_Condition	None
 Until_Log_File	

=== added file 'mysql-test/suite/rpl/r/rpl_mixing_mixed_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_mixing_mixed_engines.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixing_mixed_engines.result	2009-06-06 17:51:51 +0000
@@ -0,0 +1,1501 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+###################################################################################
+#                                   CONFIGURATION
+###################################################################################
+CREATE TABLE t1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t5 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t6 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t7 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t8 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t9 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+INSERT INTO t1 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t2 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t3 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t4 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t5 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+CREATE FUNCTION f1 () RETURNS VARCHAR(64)
+BEGIN
+RETURN "Testing...";
+END|
+CREATE FUNCTION f2 () RETURNS VARCHAR(64)
+BEGIN
+RETURN f1();
+END|
+CREATE PROCEDURE pc6 (IN x INT, IN y VARCHAR(64))
+BEGIN
+INSERT INTO t6 VALUES (y,x,x);
+END|
+CREATE TRIGGER tr6_i BEFORE INSERT ON t6 FOR EACH ROW
+BEGIN
+INSERT INTO t7 VALUES (NEW.a, NEW.b, NEW.c);
+INSERT INTO t8 VALUES (NEW.a, NEW.b, NEW.c);
+INSERT INTO t9 VALUES (NEW.a, NEW.b, NEW.c);
+END|
+INSERT INTO t6 VALUES("text 100", 100, "text 100"), ("text 200", 200, "text 200"), ("text 300", 300, "text 300");
+INSERT INTO t7 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t8 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t9 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+###################################################################################
+#                                1 - CREATING TABLES
+###################################################################################
+CREATE TABLE t10 SELECT * FROM t2;
+DROP TABLE t10;
+CREATE TABLE t11 SELECT * FROM t2;
+DROP TABLE t11;
+###################################################################################
+#                 2 - MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
+###################################################################################
+#                     C - T           C - T             C - T
+#1.a) B T T C         F - C           F - C             F - C
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 5", 5, "new text 5");
+INSERT INTO t3 VALUES ("new text 5", 5, "new text 5");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 5", 5, "new text 5")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 5", 5, "new text 5")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - T             C - T
+#1.b) B T T R         F - I           F - I             F - I
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t3 VALUES ("new text 6", 6, "new text 6");
+ROLLBACK;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#2.a) B T N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t1 VALUES ("new text 6", 6, "new text 6");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 6", 6, "new text 6")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#2.b) B T N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 7", 7, "new text 7");
+INSERT INTO t1 VALUES ("new text 7", 7, "new text 7");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - T             C - T
+#3.a) T               F - C           F - C             F - C
+#
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 8", 8, "new text 8")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - T             C - T
+#3.b) T with error    F - I           F - I             F - I
+#
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+ERROR 23000: Duplicate entry '8' for key 'PRIMARY'
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - S           C - S             C - S
+#4.a) N               F - D           F - D             F - D
+#
+INSERT INTO t1 VALUES ("new text 9", 9, "new text 9");
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 9", 9, "new text 9")
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#5.a) M               F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+INSERT INTO t1 SELECT * FROM t2;
+DELETE FROM t2;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t6 VALUES ("new text 400", 400, '');
+INSERT INTO t6 VALUES("new text 500", 500, f1());
+CALL pc6(600, "Testing...");
+INSERT INTO t6 VALUES(700, 700, f2());
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 8", t9.a= "new text 8", t6.a= "new text 8", t7.a= "new text 8" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 9", t7.a= "new text 9", t8.a= "new text 9", t9.a = "new text 9" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 10", t8.a= "new text 10", t9.a= "new text 10", t7.a = "new text 10" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 11", t8.a= "new text 11", t9.a= "new text 11", t7.a = "new text 11" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#5.b) M with error    F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+INSERT INTO t2 SELECT * FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+#6.a) B N N T C       F - D(N) C(T)   F - D(N) C(T)     F - D(N) C(T)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t5 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t2 VALUES ("new text 10", 10, "new text 10");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 10", 10, "new text 10")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 10", 10, "new text 10")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 10", 10, "new text 10")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+#6.b) B N N T R       F - D(N) R(T)   F - D(N) I(T)     F - D(N) I(T)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t5 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t2 VALUES ("new text 11", 11, "new text 11");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 11", 11, "new text 11")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 11", 11, "new text 11")
+
+
+
+
+#                     C - S(N)        C - S(N)          C - S(N)
+#7.a) B N N C         F - D(N)        F - D(N)          F - D(N)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 12", 12, "new text 12");
+INSERT INTO t5 VALUES ("new text 12", 12, "new text 12");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 12", 12, "new text 12")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 12", 12, "new text 12")
+
+
+
+
+#                     C - S(N)        C - S(N)          C - S(N)
+#7.b) B N N R         F - D(N)        F - D(N)          F - D(N)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 13", 13, "new text 13");
+INSERT INTO t5 VALUES ("new text 13", 13, "new text 13");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 13", 13, "new text 13")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 13", 13, "new text 13")
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#8.a) B M T C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t3 VALUES ("new text 14", 14, "new text 14");
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t3 VALUES ("new text 15", 15, "new text 15");
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 1200", 1200, '');
+INSERT INTO t7 VALUES ("new text 20", 20, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES("new text 1300", 1300, f1());
+INSERT INTO t7 VALUES ("new text 21", 21, '');
+COMMIT;
+BEGIN;
+CALL pc6(1400, "Testing...");
+INSERT INTO t7 VALUES ("new text 22", 22, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES(1500, 1500, f2());
+INSERT INTO t7 VALUES ("new text 23", 23, '');
+COMMIT;
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 16", t9.a= "new text 16", t6.a= "new text 16", t7.a= "new text 16" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 24", 24, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 17", t7.a= "new text 17", t8.a= "new text 17", t9.a = "new text 17" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 25", 25, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 18", t8.a= "new text 18", t9.a= "new text 18", t7.a = "new text 18" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 250", 250, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 19", t8.a= "new text 19", t9.a= "new text 19", t7.a = "new text 19" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 26", 26, '');
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 14", 14, "new text 14")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 15", 15, "new text 15")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 20", 20, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 21", 21, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 22", 22, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 23", 23, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 24", 24, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 25", 25, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 250", 250, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 26", 26, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#8.b) B M T R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t3 VALUES ("new text 17", 17, "new text 17");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t3 VALUES ("new text 18", 18, "new text 18");
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2000", 2000, '');
+INSERT INTO t7 VALUES ("new text 27", 27, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES("new text 2100", 2100, f1());
+INSERT INTO t7 VALUES ("new text 28", 28, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+CALL pc6(2200, "Testing...");
+INSERT INTO t7 VALUES ("new text 29", 29, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES(2300, 2300, f2());
+INSERT INTO t7 VALUES ("new text 30", 30, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 24", t9.a= "new text 24", t6.a= "new text 24", t7.a= "new text 24" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 31", 31, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 25", t7.a= "new text 25", t8.a= "new text 25", t9.a = "new text 25" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 32", 32, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 26", t8.a= "new text 26", t9.a= "new text 26", t7.a = "new text 26" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 33", 33, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 27", t8.a= "new text 27", t9.a= "new text 27", t7.a = "new text 27" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 34", 34, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#9.a) B M N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t5 VALUES ("new text 20", 20, "new text 20");
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t5 VALUES ("new text 21", 21, "new text 21");
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2800", 2800, '');
+INSERT INTO t9 VALUES ("new text 35", 35, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES("new text 2900", 2900, f1());
+INSERT INTO t9 VALUES ("new text 36", 36, '');
+COMMIT;
+BEGIN;
+CALL pc6(3000, "Testing...");
+INSERT INTO t9 VALUES ("new text 37", 37, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES(3100, 3100, f2());
+INSERT INTO t9 VALUES ("new text 38", 38, '');
+COMMIT;
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 32", t9.a= "new text 32", t6.a= "new text 32", t7.a= "new text 32" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 39", 39, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 33", t7.a= "new text 33", t8.a= "new text 33", t9.a = "new text 33" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 40", 40, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 34", t8.a= "new text 34", t9.a= "new text 34", t7.a = "new text 34" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 41", 41, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 35", t8.a= "new text 35", t9.a= "new text 35", t7.a = "new text 35" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 42", 43, '');
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 20", 20, "new text 20")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#9.b) B M N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t5 VALUES ("new text 23", 23, "new text 23");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t5 VALUES ("new text 24", 24, "new text 24");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 3600", 3600, '');
+INSERT INTO t9 VALUES ("new text 44", 44, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES("new text 3700", 3700, f1());
+INSERT INTO t9 VALUES ("new text 45", 45, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+CALL pc6(3800, "Testing...");
+INSERT INTO t9 VALUES ("new text 46", 46, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES(3900, 3900, f2());
+INSERT INTO t9 VALUES ("new text 47", 47, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 40", t9.a= "new text 40", t6.a= "new text 40", t7.a= "new text 40" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 48", 48, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 41", t7.a= "new text 41", t8.a= "new text 41", t9.a = "new text 41" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text", 49, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 42", t8.a= "new text 42", t9.a= "new text 42", t7.a = "new text 42" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 50", 50, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 43", t8.a= "new text 43", t9.a= "new text 43", t7.a = "new text 43" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 51", 51, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 23", 23, "new text 23")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+
+#                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+#10.a) B N M C        F - D(N) C(M)   F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 26", 26, "new text 26");
+INSERT INTO t1 SELECT * FROM t2;
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 27", 27, "new text 27");
+INSERT INTO t2 SELECT * FROM t1;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 52", 52, '');
+INSERT INTO t6 VALUES ("new text 4400", 4400, '');
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 53", 53, '');
+INSERT INTO t6 VALUES("new text 4500", 4500, f1());
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 54", 54, '');
+CALL pc6(4600, "Testing...");
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 55", 55, '');
+INSERT INTO t6 VALUES(4700, 4700, f2());
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 56", 56, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 48", t9.a= "new text 48", t6.a= "new text 48", t7.a= "new text 48" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 57", 57, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 49", t7.a= "new text 49", t8.a= "new text 49", t9.a = "new text 49" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 58", 58, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 50", t8.a= "new text 50", t9.a= "new text 50", t7.a = "new text 50" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 59", 59, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 51", t8.a= "new text 51", t9.a= "new text 51", t7.a = "new text 51" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 26", 26, "new text 26")
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 27", 27, "new text 27")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 52", 52, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 53", 53, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 54", 54, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 55", 55, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 56", 56, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 57", 57, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 58", 58, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 59", 59, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+#10.b) B N M R        F - D(N) R(M)   F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 29", 29, "new text 29");
+INSERT INTO t1 SELECT * FROM t2;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 30", 30, "new text 30");
+INSERT INTO t2 SELECT * FROM t1;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 60", 60, '');
+INSERT INTO t6 VALUES ("new text 5200", 5200, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 61", 61, '');
+INSERT INTO t6 VALUES("new text 5300", 5300, f1());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 62", 62, '');
+CALL pc6(5400, "Testing...");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 63", 63, '');
+INSERT INTO t6 VALUES(5500, 5500, f2());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 64", 64, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 56", t9.a= "new text 56", t6.a= "new text 56", t7.a= "new text 56" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 65", 65, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 57", t7.a= "new text 57", t8.a= "new text 57", t9.a = "new text 57" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 66", 66, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 58", t8.a= "new text 58", t9.a= "new text 58", t7.a = "new text 58" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 67", 67, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 59", t8.a= "new text 59", t9.a= "new text 59", t7.a = "new text 59" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 29", 29, "new text 29")
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 30", 30, "new text 30")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 60", 60, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 61", 61, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 62", 62, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 63", 63, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 64", 64, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 65", 65, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 66", 66, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 67", 67, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#11.a) B T M C        F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 68", 68, "new text 68");
+INSERT INTO t1 SELECT * FROM t2;
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 69", 69, "new text 69");
+INSERT INTO t2 SELECT * FROM t1;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 70", 70, '');
+INSERT INTO t6 VALUES ("new text 5600", 5600, '');
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 89", 89, '');
+INSERT INTO t6 VALUES("new text 5700", 5700, f1());
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 71", 71, '');
+CALL pc6(5800, "Testing...");
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 72", 72, '');
+INSERT INTO t6 VALUES(5900, 5900, f2());
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 73", 73, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 75", 75, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 77", 77, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 79", 79, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 68", 68, "new text 68")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 69", 69, "new text 69")
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 70", 70, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 89", 89, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 71", 71, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 72", 72, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 73", 73, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 75", 75, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 77", 77, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 79", 79, '')
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#11.b) B T M R        F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 80", 80, "new text 80");
+INSERT INTO t1 SELECT * FROM t2;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 81", 81, "new text 81");
+INSERT INTO t2 SELECT * FROM t1;
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 82", 82, '');
+INSERT INTO t6 VALUES ("new text 6000", 6000, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 83", 83, '');
+INSERT INTO t6 VALUES("new text 6100", 6100, f1());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 84", 84, '');
+CALL pc6(6200, "Testing...");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+INSERT INTO t6 VALUES(6300, 6300, f2());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 86", 86, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 87", 87, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 88", 88, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+###################################################################################
+#                                 3 - CONCURRENCY 
+###################################################################################
+***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 0  |  COMMIT
+INSERT INTO t1 VALUES ("new text 109", 109, "");
+INSERT INTO t1 VALUES ("new text 1010", 1010, "");
+***** conn1: begin
+SET AUTOCOMMIT= 0;
+***** conn2: begin and update t1
+SET AUTOCOMMIT= 0;
+UPDATE t1 SET a = "new text 1011" WHERE b = 109;
+***** conn1: delete from t1 and commit
+DELETE FROM t1 WHERE b = 109;
+DELETE FROM t1 WHERE b = 1010;
+COMMIT;
+***** conn2: commit
+COMMIT;
+***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 1 | START - COMMIT
+INSERT INTO t1 VALUES ("new text 1012", 1012, "");
+INSERT INTO t1 VALUES ("new text 1013", 1013, "");
+***** conn1: begin
+SET AUTOCOMMIT= 1;
+BEGIN;
+***** conn2: begin and update t1
+SET AUTOCOMMIT= 1;
+BEGIN;
+UPDATE t1 SET a = "new text 1014" WHERE b = 1012;
+***** conn1: delete from t1 and commit
+DELETE FROM t1 WHERE b = 1012;
+DELETE FROM t1 WHERE b = 1013;
+COMMIT;
+***** conn2: commit
+COMMIT;
+###################################################################################
+#                               4 - SAVE POINTS
+###################################################################################
+BEGIN;
+INSERT INTO t2 VALUES ("new text 400", 400, "new text 400");
+INSERT INTO t3 VALUES ("new text 401", 401, "new text 401");
+SAVEPOINT sv;
+INSERT INTO t1 VALUES ("new text 402", 402, "new text 402");
+INSERT INTO t3 VALUES ("new text 403", 403, "new text 403");
+ROLLBACK TO sv;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+COMMIT;
+###################################################################################
+#                                        CLEAN
+###################################################################################
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP TABLE t7;
+DROP TABLE t8;
+DROP TABLE t9;
+DROP PROCEDURE pc6;
+DROP FUNCTION f1;
+DROP FUNCTION f2;

=== added file 'mysql-test/suite/rpl/r/rpl_mixing_row_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_mixing_row_engines.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixing_row_engines.result	2009-06-06 17:51:51 +0000
@@ -0,0 +1,1575 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+###################################################################################
+#                                   CONFIGURATION
+###################################################################################
+CREATE TABLE t1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t5 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t6 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t7 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t8 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t9 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+INSERT INTO t1 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t2 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t3 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t4 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t5 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+CREATE FUNCTION f1 () RETURNS VARCHAR(64)
+BEGIN
+RETURN "Testing...";
+END|
+CREATE FUNCTION f2 () RETURNS VARCHAR(64)
+BEGIN
+RETURN f1();
+END|
+CREATE PROCEDURE pc6 (IN x INT, IN y VARCHAR(64))
+BEGIN
+INSERT INTO t6 VALUES (y,x,x);
+END|
+CREATE TRIGGER tr6_i BEFORE INSERT ON t6 FOR EACH ROW
+BEGIN
+INSERT INTO t7 VALUES (NEW.a, NEW.b, NEW.c);
+INSERT INTO t8 VALUES (NEW.a, NEW.b, NEW.c);
+INSERT INTO t9 VALUES (NEW.a, NEW.b, NEW.c);
+END|
+INSERT INTO t6 VALUES("text 100", 100, "text 100"), ("text 200", 200, "text 200"), ("text 300", 300, "text 300");
+INSERT INTO t7 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t8 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t9 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+###################################################################################
+#                                1 - CREATING TABLES
+###################################################################################
+CREATE TABLE t10 SELECT * FROM t2;
+DROP TABLE t10;
+CREATE TABLE t11 SELECT * FROM t2;
+DROP TABLE t11;
+###################################################################################
+#                 2 - MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
+###################################################################################
+#                     C - T           C - T             C - T
+#1.a) B T T C         F - C           F - C             F - C
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 5", 5, "new text 5");
+INSERT INTO t3 VALUES ("new text 5", 5, "new text 5");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - T             C - T
+#1.b) B T T R         F - I           F - I             F - I
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t3 VALUES ("new text 6", 6, "new text 6");
+ROLLBACK;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#2.a) B T N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t1 VALUES ("new text 6", 6, "new text 6");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#2.b) B T N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 7", 7, "new text 7");
+INSERT INTO t1 VALUES ("new text 7", 7, "new text 7");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - T             C - T
+#3.a) T               F - C           F - C             F - C
+#
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - T             C - T
+#3.b) T with error    F - I           F - I             F - I
+#
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+ERROR 23000: Duplicate entry '8' for key 'PRIMARY'
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - S           C - S             C - S
+#4.a) N               F - D           F - D             F - D
+#
+INSERT INTO t1 VALUES ("new text 9", 9, "new text 9");
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#5.a) M               F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+INSERT INTO t1 SELECT * FROM t2;
+DELETE FROM t2;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t6 VALUES ("new text 400", 400, '');
+INSERT INTO t6 VALUES("new text 500", 500, f1());
+CALL pc6(600, "Testing...");
+INSERT INTO t6 VALUES(700, 700, f2());
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 8", t9.a= "new text 8", t6.a= "new text 8", t7.a= "new text 8" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 9", t7.a= "new text 9", t8.a= "new text 9", t9.a = "new text 9" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 10", t8.a= "new text 10", t9.a= "new text 10", t7.a = "new text 10" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 11", t8.a= "new text 11", t9.a= "new text 11", t7.a = "new text 11" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#5.b) M with error    F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+INSERT INTO t2 SELECT * FROM t1;
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+#6.a) B N N T C       F - D(N) C(T)   F - D(N) C(T)     F - D(N) C(T)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t5 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t2 VALUES ("new text 10", 10, "new text 10");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+#6.b) B N N T R       F - D(N) R(T)   F - D(N) I(T)     F - D(N) I(T)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t5 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t2 VALUES ("new text 11", 11, "new text 11");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - S(N)        C - S(N)          C - S(N)
+#7.a) B N N C         F - D(N)        F - D(N)          F - D(N)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 12", 12, "new text 12");
+INSERT INTO t5 VALUES ("new text 12", 12, "new text 12");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - S(N)        C - S(N)          C - S(N)
+#7.b) B N N R         F - D(N)        F - D(N)          F - D(N)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 13", 13, "new text 13");
+INSERT INTO t5 VALUES ("new text 13", 13, "new text 13");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#8.a) B M T C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t3 VALUES ("new text 14", 14, "new text 14");
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t3 VALUES ("new text 15", 15, "new text 15");
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 1200", 1200, '');
+INSERT INTO t7 VALUES ("new text 20", 20, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES("new text 1300", 1300, f1());
+INSERT INTO t7 VALUES ("new text 21", 21, '');
+COMMIT;
+BEGIN;
+CALL pc6(1400, "Testing...");
+INSERT INTO t7 VALUES ("new text 22", 22, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES(1500, 1500, f2());
+INSERT INTO t7 VALUES ("new text 23", 23, '');
+COMMIT;
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 16", t9.a= "new text 16", t6.a= "new text 16", t7.a= "new text 16" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 24", 24, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 17", t7.a= "new text 17", t8.a= "new text 17", t9.a = "new text 17" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 25", 25, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 18", t8.a= "new text 18", t9.a= "new text 18", t7.a = "new text 18" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 250", 250, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 19", t8.a= "new text 19", t9.a= "new text 19", t7.a = "new text 19" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 26", 26, '');
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#8.b) B M T R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t3 VALUES ("new text 17", 17, "new text 17");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t3 VALUES ("new text 18", 18, "new text 18");
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2000", 2000, '');
+INSERT INTO t7 VALUES ("new text 27", 27, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES("new text 2100", 2100, f1());
+INSERT INTO t7 VALUES ("new text 28", 28, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+CALL pc6(2200, "Testing...");
+INSERT INTO t7 VALUES ("new text 29", 29, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES(2300, 2300, f2());
+INSERT INTO t7 VALUES ("new text 30", 30, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 24", t9.a= "new text 24", t6.a= "new text 24", t7.a= "new text 24" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 31", 31, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 25", t7.a= "new text 25", t8.a= "new text 25", t9.a = "new text 25" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 32", 32, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 26", t8.a= "new text 26", t9.a= "new text 26", t7.a = "new text 26" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 33", 33, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 27", t8.a= "new text 27", t9.a= "new text 27", t7.a = "new text 27" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t7 VALUES ("new text 34", 34, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#9.a) B M N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t5 VALUES ("new text 20", 20, "new text 20");
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t5 VALUES ("new text 21", 21, "new text 21");
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2800", 2800, '');
+INSERT INTO t9 VALUES ("new text 35", 35, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES("new text 2900", 2900, f1());
+INSERT INTO t9 VALUES ("new text 36", 36, '');
+COMMIT;
+BEGIN;
+CALL pc6(3000, "Testing...");
+INSERT INTO t9 VALUES ("new text 37", 37, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES(3100, 3100, f2());
+INSERT INTO t9 VALUES ("new text 38", 38, '');
+COMMIT;
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 32", t9.a= "new text 32", t6.a= "new text 32", t7.a= "new text 32" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 39", 39, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 33", t7.a= "new text 33", t8.a= "new text 33", t9.a = "new text 33" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 40", 40, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 34", t8.a= "new text 34", t9.a= "new text 34", t7.a = "new text 34" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 41", 41, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 35", t8.a= "new text 35", t9.a= "new text 35", t7.a = "new text 35" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 42", 43, '');
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#9.b) B M N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t5 VALUES ("new text 23", 23, "new text 23");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t5 VALUES ("new text 24", 24, "new text 24");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 3600", 3600, '');
+INSERT INTO t9 VALUES ("new text 44", 44, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES("new text 3700", 3700, f1());
+INSERT INTO t9 VALUES ("new text 45", 45, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+CALL pc6(3800, "Testing...");
+INSERT INTO t9 VALUES ("new text 46", 46, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES(3900, 3900, f2());
+INSERT INTO t9 VALUES ("new text 47", 47, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 40", t9.a= "new text 40", t6.a= "new text 40", t7.a= "new text 40" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 48", 48, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 41", t7.a= "new text 41", t8.a= "new text 41", t9.a = "new text 41" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text", 49, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 42", t8.a= "new text 42", t9.a= "new text 42", t7.a = "new text 42" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 50", 50, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 43", t8.a= "new text 43", t9.a= "new text 43", t7.a = "new text 43" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+INSERT INTO t9 VALUES ("new text 51", 51, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+
+#                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+#10.a) B N M C        F - D(N) C(M)   F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 26", 26, "new text 26");
+INSERT INTO t1 SELECT * FROM t2;
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 27", 27, "new text 27");
+INSERT INTO t2 SELECT * FROM t1;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 52", 52, '');
+INSERT INTO t6 VALUES ("new text 4400", 4400, '');
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 53", 53, '');
+INSERT INTO t6 VALUES("new text 4500", 4500, f1());
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 54", 54, '');
+CALL pc6(4600, "Testing...");
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 55", 55, '');
+INSERT INTO t6 VALUES(4700, 4700, f2());
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 56", 56, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 48", t9.a= "new text 48", t6.a= "new text 48", t7.a= "new text 48" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 57", 57, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 49", t7.a= "new text 49", t8.a= "new text 49", t9.a = "new text 49" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 58", 58, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 50", t8.a= "new text 50", t9.a= "new text 50", t7.a = "new text 50" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 59", 59, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 51", t8.a= "new text 51", t9.a= "new text 51", t7.a = "new text 51" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+#10.b) B N M R        F - D(N) R(M)   F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 29", 29, "new text 29");
+INSERT INTO t1 SELECT * FROM t2;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 30", 30, "new text 30");
+INSERT INTO t2 SELECT * FROM t1;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 60", 60, '');
+INSERT INTO t6 VALUES ("new text 5200", 5200, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 61", 61, '');
+INSERT INTO t6 VALUES("new text 5300", 5300, f1());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 62", 62, '');
+CALL pc6(5400, "Testing...");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 63", 63, '');
+INSERT INTO t6 VALUES(5500, 5500, f2());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 64", 64, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 56", t9.a= "new text 56", t6.a= "new text 56", t7.a= "new text 56" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 65", 65, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 57", t7.a= "new text 57", t8.a= "new text 57", t9.a = "new text 57" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 66", 66, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 58", t8.a= "new text 58", t9.a= "new text 58", t7.a = "new text 58" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 67", 67, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 59", t8.a= "new text 59", t9.a= "new text 59", t7.a = "new text 59" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t5)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#11.a) B T M C        F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 68", 68, "new text 68");
+INSERT INTO t1 SELECT * FROM t2;
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 69", 69, "new text 69");
+INSERT INTO t2 SELECT * FROM t1;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 70", 70, '');
+INSERT INTO t6 VALUES ("new text 5600", 5600, '');
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 89", 89, '');
+INSERT INTO t6 VALUES("new text 5700", 5700, f1());
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 71", 71, '');
+CALL pc6(5800, "Testing...");
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 72", 72, '');
+INSERT INTO t6 VALUES(5900, 5900, f2());
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 73", 73, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 75", 75, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 77", 77, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 79", 79, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t6)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#11.b) B T M R        F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 80", 80, "new text 80");
+INSERT INTO t1 SELECT * FROM t2;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 81", 81, "new text 81");
+INSERT INTO t2 SELECT * FROM t1;
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 82", 82, '');
+INSERT INTO t6 VALUES ("new text 6000", 6000, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 83", 83, '');
+INSERT INTO t6 VALUES("new text 6100", 6100, f1());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 84", 84, '');
+CALL pc6(6200, "Testing...");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+INSERT INTO t6 VALUES(6300, 6300, f2());
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 86", 86, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 87", 87, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 88", 88, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t8)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t9)
+master-bin.000001	#	Update_rows	#	#	table_id: #
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+###################################################################################
+#                                 3 - CONCURRENCY 
+###################################################################################
+***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 0  |  COMMIT
+INSERT INTO t1 VALUES ("new text 109", 109, "");
+INSERT INTO t1 VALUES ("new text 1010", 1010, "");
+***** conn1: begin
+SET AUTOCOMMIT= 0;
+***** conn2: begin and update t1
+SET AUTOCOMMIT= 0;
+UPDATE t1 SET a = "new text 1011" WHERE b = 109;
+***** conn1: delete from t1 and commit
+DELETE FROM t1 WHERE b = 109;
+DELETE FROM t1 WHERE b = 1010;
+COMMIT;
+***** conn2: commit
+COMMIT;
+***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 1 | START - COMMIT
+INSERT INTO t1 VALUES ("new text 1012", 1012, "");
+INSERT INTO t1 VALUES ("new text 1013", 1013, "");
+***** conn1: begin
+SET AUTOCOMMIT= 1;
+BEGIN;
+***** conn2: begin and update t1
+SET AUTOCOMMIT= 1;
+BEGIN;
+UPDATE t1 SET a = "new text 1014" WHERE b = 1012;
+***** conn1: delete from t1 and commit
+DELETE FROM t1 WHERE b = 1012;
+DELETE FROM t1 WHERE b = 1013;
+COMMIT;
+***** conn2: commit
+COMMIT;
+###################################################################################
+#                               4 - SAVE POINTS
+###################################################################################
+BEGIN;
+INSERT INTO t2 VALUES ("new text 400", 400, "new text 400");
+INSERT INTO t3 VALUES ("new text 401", 401, "new text 401");
+SAVEPOINT sv;
+INSERT INTO t1 VALUES ("new text 402", 402, "new text 402");
+INSERT INTO t3 VALUES ("new text 403", 403, "new text 403");
+ROLLBACK TO sv;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+COMMIT;
+###################################################################################
+#                                        CLEAN
+###################################################################################
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP TABLE t7;
+DROP TABLE t8;
+DROP TABLE t9;
+DROP PROCEDURE pc6;
+DROP FUNCTION f1;
+DROP FUNCTION f2;

=== added file 'mysql-test/suite/rpl/r/rpl_mixing_stmt_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_mixing_stmt_engines.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixing_stmt_engines.result	2009-06-06 17:51:51 +0000
@@ -0,0 +1,1421 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+###################################################################################
+#                                   CONFIGURATION
+###################################################################################
+CREATE TABLE t1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t5 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t6 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t7 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
+CREATE TABLE t8 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+CREATE TABLE t9 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
+INSERT INTO t1 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t2 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t3 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t4 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t5 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+CREATE FUNCTION f1 () RETURNS VARCHAR(64)
+BEGIN
+RETURN "Testing...";
+END|
+CREATE FUNCTION f2 () RETURNS VARCHAR(64)
+BEGIN
+RETURN f1();
+END|
+CREATE PROCEDURE pc6 (IN x INT, IN y VARCHAR(64))
+BEGIN
+INSERT INTO t6 VALUES (y,x,x);
+END|
+CREATE TRIGGER tr6_i BEFORE INSERT ON t6 FOR EACH ROW
+BEGIN
+INSERT INTO t7 VALUES (NEW.a, NEW.b, NEW.c);
+INSERT INTO t8 VALUES (NEW.a, NEW.b, NEW.c);
+INSERT INTO t9 VALUES (NEW.a, NEW.b, NEW.c);
+END|
+INSERT INTO t6 VALUES("text 100", 100, "text 100"), ("text 200", 200, "text 200"), ("text 300", 300, "text 300");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t8 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+INSERT INTO t9 VALUES("text 1", 1, "text 1"), ("text 2", 2, "text 2"), ("text 3", 3, "text 3");
+###################################################################################
+#                                1 - CREATING TABLES
+###################################################################################
+CREATE TABLE t10 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+DROP TABLE t10;
+CREATE TABLE t11 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+DROP TABLE t11;
+###################################################################################
+#                 2 - MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
+###################################################################################
+#                     C - T           C - T             C - T
+#1.a) B T T C         F - C           F - C             F - C
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 5", 5, "new text 5");
+INSERT INTO t3 VALUES ("new text 5", 5, "new text 5");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 5", 5, "new text 5")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 5", 5, "new text 5")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - T             C - T
+#1.b) B T T R         F - I           F - I             F - I
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t3 VALUES ("new text 6", 6, "new text 6");
+ROLLBACK;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#2.a) B T N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 6", 6, "new text 6");
+INSERT INTO t1 VALUES ("new text 6", 6, "new text 6");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 6", 6, "new text 6")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 6", 6, "new text 6")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#2.b) B T N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+BEGIN;
+INSERT INTO t2 VALUES ("new text 7", 7, "new text 7");
+INSERT INTO t1 VALUES ("new text 7", 7, "new text 7");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 7", 7, "new text 7")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 7", 7, "new text 7")
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+
+
+
+
+#                     C - T           C - T             C - T
+#3.a) T               F - C           F - C             F - C
+#
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 8", 8, "new text 8")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - T             C - T
+#3.b) T with error    F - I           F - I             F - I
+#
+INSERT INTO t2 VALUES ("new text 8", 8, "new text 8");
+ERROR 23000: Duplicate entry '8' for key 'PRIMARY'
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - S           C - S             C - S
+#4.a) N               F - D           F - D             F - D
+#
+INSERT INTO t1 VALUES ("new text 9", 9, "new text 9");
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 9", 9, "new text 9")
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#5.a) M               F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+DELETE FROM t2;
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t6 VALUES ("new text 400", 400, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t6 VALUES("new text 500", 500, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+CALL pc6(600, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t6 VALUES(700, 700, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 8", t9.a= "new text 8", t6.a= "new text 8", t7.a= "new text 8" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 9", t7.a= "new text 9", t8.a= "new text 9", t9.a = "new text 9" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 10", t8.a= "new text 10", t9.a= "new text 10", t7.a = "new text 10" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 11", t8.a= "new text 11", t9.a= "new text 11", t7.a = "new text 11" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 400", 400, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 500", 500, f1())
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',600), NAME_CONST('x',600))
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(700, 700, f2())
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 8", t9.a= "new text 8", t6.a= "new text 8", t7.a= "new text 8" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 9", t7.a= "new text 9", t8.a= "new text 9", t9.a = "new text 9" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 10", t8.a= "new text 10", t9.a= "new text 10", t7.a = "new text 10" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 11", t8.a= "new text 11", t9.a= "new text 11", t7.a = "new text 11" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#5.b) M with error    F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+INSERT INTO t2 SELECT * FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+
+
+
+
+#                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+#6.a) B N N T C       F - D(N) C(T)   F - D(N) C(T)     F - D(N) C(T)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t5 VALUES ("new text 10", 10, "new text 10");
+INSERT INTO t2 VALUES ("new text 10", 10, "new text 10");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 10", 10, "new text 10")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 10", 10, "new text 10")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 10", 10, "new text 10")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - S(N) T(T)   C - S(N) T(T)     C - S(N) T(T)
+#6.b) B N N T R       F - D(N) R(T)   F - D(N) I(T)     F - D(N) I(T)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t5 VALUES ("new text 11", 11, "new text 11");
+INSERT INTO t2 VALUES ("new text 11", 11, "new text 11");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 11", 11, "new text 11")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 11", 11, "new text 11")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 VALUES ("new text 11", 11, "new text 11")
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+
+
+
+
+#                     C - S(N)        C - S(N)          C - S(N)
+#7.a) B N N C         F - D(N)        F - D(N)          F - D(N)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 12", 12, "new text 12");
+INSERT INTO t5 VALUES ("new text 12", 12, "new text 12");
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 12", 12, "new text 12")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 12", 12, "new text 12")
+
+
+
+
+#                     C - S(N)        C - S(N)          C - S(N)
+#7.b) B N N R         F - D(N)        F - D(N)          F - D(N)
+#
+BEGIN;
+INSERT INTO t1 VALUES ("new text 13", 13, "new text 13");
+INSERT INTO t5 VALUES ("new text 13", 13, "new text 13");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES ("new text 13", 13, "new text 13")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 13", 13, "new text 13")
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#8.a) B M T C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t3 VALUES ("new text 14", 14, "new text 14");
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t3 VALUES ("new text 15", 15, "new text 15");
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 1200", 1200, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 20", 20, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES("new text 1300", 1300, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 21", 21, '');
+COMMIT;
+BEGIN;
+CALL pc6(1400, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 22", 22, '');
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES(1500, 1500, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 23", 23, '');
+COMMIT;
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 16", t9.a= "new text 16", t6.a= "new text 16", t7.a= "new text 16" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 24", 24, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 17", t7.a= "new text 17", t8.a= "new text 17", t9.a = "new text 17" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 25", 25, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 18", t8.a= "new text 18", t9.a= "new text 18", t7.a = "new text 18" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 250", 250, '');
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 19", t8.a= "new text 19", t9.a= "new text 19", t7.a = "new text 19" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 26", 26, '');
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 14", 14, "new text 14")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 15", 15, "new text 15")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 1200", 1200, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 20", 20, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 1300", 1300, f1())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 21", 21, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',1400), NAME_CONST('x',1400))
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 22", 22, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(1500, 1500, f2())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 23", 23, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 16", t9.a= "new text 16", t6.a= "new text 16", t7.a= "new text 16" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 24", 24, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 17", t7.a= "new text 17", t8.a= "new text 17", t9.a = "new text 17" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 25", 25, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 18", t8.a= "new text 18", t9.a= "new text 18", t7.a = "new text 18" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 250", 250, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 19", t8.a= "new text 19", t9.a= "new text 19", t7.a = "new text 19" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 26", 26, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#8.b) B M T R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t3 VALUES ("new text 17", 17, "new text 17");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t3 VALUES ("new text 18", 18, "new text 18");
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2000", 2000, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 27", 27, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES("new text 2100", 2100, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 28", 28, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+CALL pc6(2200, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 29", 29, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES(2300, 2300, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 30", 30, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 24", t9.a= "new text 24", t6.a= "new text 24", t7.a= "new text 24" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 31", 31, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 25", t7.a= "new text 25", t8.a= "new text 25", t9.a = "new text 25" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 32", 32, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 26", t8.a= "new text 26", t9.a= "new text 26", t7.a = "new text 26" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 33", 33, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 27", t8.a= "new text 27", t9.a= "new text 27", t7.a = "new text 27" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t7 VALUES ("new text 34", 34, '');
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 17", 17, "new text 17")
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 2000", 2000, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 27", 27, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 2100", 2100, f1())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 28", 28, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',2200), NAME_CONST('x',2200))
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 29", 29, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(2300, 2300, f2())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 30", 30, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 24", t9.a= "new text 24", t6.a= "new text 24", t7.a= "new text 24" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 31", 31, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 25", t7.a= "new text 25", t8.a= "new text 25", t9.a = "new text 25" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 32", 32, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 26", t8.a= "new text 26", t9.a= "new text 26", t7.a = "new text 26" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 33", 33, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 27", t8.a= "new text 27", t9.a= "new text 27", t7.a = "new text 27" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 34", 34, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#9.a) B M N C         F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t5 VALUES ("new text 20", 20, "new text 20");
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t5 VALUES ("new text 21", 21, "new text 21");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES ("new text 2800", 2800, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 35", 35, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES("new text 2900", 2900, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 36", 36, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+CALL pc6(3000, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 37", 37, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t6 VALUES(3100, 3100, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 38", 38, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 32", t9.a= "new text 32", t6.a= "new text 32", t7.a= "new text 32" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 39", 39, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 33", t7.a= "new text 33", t8.a= "new text 33", t9.a = "new text 33" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 40", 40, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 34", t8.a= "new text 34", t9.a= "new text 34", t7.a = "new text 34" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 41", 41, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 35", t8.a= "new text 35", t9.a= "new text 35", t7.a = "new text 35" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 42", 43, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 20", 20, "new text 20")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 21", 21, "new text 21")
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 2800", 2800, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 35", 35, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 2900", 2900, f1())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 36", 36, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',3000), NAME_CONST('x',3000))
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 37", 37, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(3100, 3100, f2())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 38", 38, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 32", t9.a= "new text 32", t6.a= "new text 32", t7.a= "new text 32" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 39", 39, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 33", t7.a= "new text 33", t8.a= "new text 33", t9.a = "new text 33" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 40", 40, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 34", t8.a= "new text 34", t9.a= "new text 34", t7.a = "new text 34" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 41", 41, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 35", t8.a= "new text 35", t9.a= "new text 35", t7.a = "new text 35" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 42", 43, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#9.b) B M N R         F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t5 VALUES ("new text 23", 23, "new text 23");
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t5 VALUES ("new text 24", 24, "new text 24");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+BEGIN;
+INSERT INTO t6 VALUES ("new text 3600", 3600, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 44", 44, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES("new text 3700", 3700, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 45", 45, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+CALL pc6(3800, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 46", 46, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t6 VALUES(3900, 3900, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 47", 47, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 40", t9.a= "new text 40", t6.a= "new text 40", t7.a= "new text 40" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 48", 48, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 41", t7.a= "new text 41", t8.a= "new text 41", t9.a = "new text 41" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text", 49, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 42", t8.a= "new text 42", t9.a= "new text 42", t7.a = "new text 42" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 50", 50, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 43", t8.a= "new text 43", t9.a= "new text 43", t7.a = "new text 43" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t9 VALUES ("new text 51", 51, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 23", 23, "new text 23")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 24", 24, "new text 24")
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 3600", 3600, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 44", 44, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 3700", 3700, f1())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 45", 45, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',3800), NAME_CONST('x',3800))
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 46", 46, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(3900, 3900, f2())
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 47", 47, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 40", t9.a= "new text 40", t6.a= "new text 40", t7.a= "new text 40" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 48", 48, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 41", t7.a= "new text 41", t8.a= "new text 41", t9.a = "new text 41" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text", 49, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 42", t8.a= "new text 42", t9.a= "new text 42", t7.a = "new text 42" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 50", 50, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 43", t8.a= "new text 43", t9.a= "new text 43", t7.a = "new text 43" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 51", 51, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+
+
+
+
+
+#                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+#10.a) B N M C        F - D(N) C(M)   F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 26", 26, "new text 26");
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 27", 27, "new text 27");
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 52", 52, '');
+INSERT INTO t6 VALUES ("new text 4400", 4400, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 53", 53, '');
+INSERT INTO t6 VALUES("new text 4500", 4500, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 54", 54, '');
+CALL pc6(4600, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 55", 55, '');
+INSERT INTO t6 VALUES(4700, 4700, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 56", 56, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 48", t9.a= "new text 48", t6.a= "new text 48", t7.a= "new text 48" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 57", 57, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 49", t7.a= "new text 49", t8.a= "new text 49", t9.a = "new text 49" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 58", 58, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 50", t8.a= "new text 50", t9.a= "new text 50", t7.a = "new text 50" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t9 VALUES ("new text 59", 59, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 51", t8.a= "new text 51", t9.a= "new text 51", t7.a = "new text 51" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 26", 26, "new text 26")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 27", 27, "new text 27")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 52", 52, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 4400", 4400, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 53", 53, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 4500", 4500, f1())
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 54", 54, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',4600), NAME_CONST('x',4600))
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 55", 55, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(4700, 4700, f2())
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 56", 56, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 48", t9.a= "new text 48", t6.a= "new text 48", t7.a= "new text 48" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 57", 57, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 49", t7.a= "new text 49", t8.a= "new text 49", t9.a = "new text 49" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 58", 58, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 50", t8.a= "new text 50", t9.a= "new text 50", t7.a = "new text 50" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 59", 59, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 51", t8.a= "new text 51", t9.a= "new text 51", t7.a = "new text 51" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - S(N) T(M)   C - S(N) T(T)     C - S(N) T(T)
+#10.b) B N M R        F - D(N) R(M)   F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 29", 29, "new text 29");
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t5 VALUES ("new text 30", 30, "new text 30");
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+BEGIN;
+INSERT INTO t9 VALUES ("new text 60", 60, '');
+INSERT INTO t6 VALUES ("new text 5200", 5200, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 61", 61, '');
+INSERT INTO t6 VALUES("new text 5300", 5300, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 62", 62, '');
+CALL pc6(5400, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 63", 63, '');
+INSERT INTO t6 VALUES(5500, 5500, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 64", 64, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 56", t9.a= "new text 56", t6.a= "new text 56", t7.a= "new text 56" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 65", 65, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 57", t7.a= "new text 57", t8.a= "new text 57", t9.a = "new text 57" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 66", 66, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 58", t8.a= "new text 58", t9.a= "new text 58", t7.a = "new text 58" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t9 VALUES ("new text 67", 67, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 59", t8.a= "new text 59", t9.a= "new text 59", t7.a = "new text 59" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 29", 29, "new text 29")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t5 VALUES ("new text 30", 30, "new text 30")
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 60", 60, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 5200", 5200, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 61", 61, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 5300", 5300, f1())
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 62", 62, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',5400), NAME_CONST('x',5400))
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 63", 63, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(5500, 5500, f2())
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 64", 64, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 56", t9.a= "new text 56", t6.a= "new text 56", t7.a= "new text 56" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 65", 65, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 57", t7.a= "new text 57", t8.a= "new text 57", t9.a = "new text 57" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 66", 66, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 58", t8.a= "new text 58", t9.a= "new text 58", t7.a = "new text 58" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t9 VALUES ("new text 67", 67, '')
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 59", t8.a= "new text 59", t9.a= "new text 59", t7.a = "new text 59" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#11.a) B T M C        F - C           F - D(N) C(T)     F - D(N) C(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 68", 68, "new text 68");
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 69", 69, "new text 69");
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 70", 70, '');
+INSERT INTO t6 VALUES ("new text 5600", 5600, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 89", 89, '');
+INSERT INTO t6 VALUES("new text 5700", 5700, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 71", 71, '');
+CALL pc6(5800, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 72", 72, '');
+INSERT INTO t6 VALUES(5900, 5900, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 73", 73, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 75", 75, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 77", 77, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+BEGIN;
+INSERT INTO t7 VALUES ("new text 79", 79, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+COMMIT;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 68", 68, "new text 68")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 69", 69, "new text 69")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 70", 70, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 5600", 5600, '')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 89", 89, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 5700", 5700, f1())
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 71", 71, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',5800), NAME_CONST('x',5800))
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 72", 72, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(5900, 5900, f2())
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 73", 73, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 75", 75, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 77", 77, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 79", 79, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+
+
+
+
+#                     C - T           C - S(N) T(T)     C - S(N) T(T)
+#11.b) B T M R        F - R           F - D(N) I(T)     F - D(N) I(T)
+#
+DELETE FROM t1;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 80", 80, "new text 80");
+INSERT INTO t1 SELECT * FROM t2;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+DELETE FROM t2;
+BEGIN;
+INSERT INTO t3 VALUES ("new text 81", 81, "new text 81");
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+BEGIN;
+INSERT INTO t7 VALUES ("new text 82", 82, '');
+INSERT INTO t6 VALUES ("new text 6000", 6000, '');
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 83", 83, '');
+INSERT INTO t6 VALUES("new text 6100", 6100, f1());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 84", 84, '');
+CALL pc6(6200, "Testing...");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+INSERT INTO t6 VALUES(6300, 6300, f2());
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 85", 85, '');
+UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 86", 86, '');
+UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 87", 87, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO t7 VALUES ("new text 88", 88, '');
+UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100;
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+ROLLBACK;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t3 VALUES ("new text 80", 80, "new text 80")
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT * FROM t2
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 82", 82, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ("new text 6000", 6000, '')
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 83", 83, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES("new text 6100", 6100, f1())
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 84", 84, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES ( NAME_CONST('y',_latin1'Testing...' COLLATE 'latin1_swedish_ci'), NAME_CONST('x',6200), NAME_CONST('x',6200))
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 85", 85, '')
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t6 VALUES(6300, 6300, f2())
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 85", 85, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t8, t9, t6, t7 SET t8.a= "new text 74", t9.a= "new text 74", t6.a= "new text 74", t7.a= "new text 74" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 86", 86, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t7, t8, t9 SET t6.a= "new text 76", t7.a= "new text 76", t8.a= "new text 76", t9.a = "new text 76" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 87", 87, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 78", t8.a= "new text 78", t9.a= "new text 78", t7.a = "new text 78" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t7 VALUES ("new text 88", 88, '')
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t6, t8, t9, t7 SET t6.a= "new text 80", t8.a= "new text 80", t9.a= "new text 80", t7.a = "new text 80" where t8.b = t9.b and t9.b = t6.b and t6.b = t7.b and t7.b = 100
+master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
+###################################################################################
+#                                 3 - CONCURRENCY 
+###################################################################################
+***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 0  |  COMMIT
+INSERT INTO t1 VALUES ("new text 109", 109, "");
+INSERT INTO t1 VALUES ("new text 1010", 1010, "");
+***** conn1: begin
+SET AUTOCOMMIT= 0;
+***** conn2: begin and update t1
+SET AUTOCOMMIT= 0;
+UPDATE t1 SET a = "new text 1011" WHERE b = 109;
+***** conn1: delete from t1 and commit
+DELETE FROM t1 WHERE b = 109;
+DELETE FROM t1 WHERE b = 1010;
+COMMIT;
+***** conn2: commit
+COMMIT;
+***** NON-TRANSACT TABLES -  SET AUTOCOMMIT = 1 | START - COMMIT
+INSERT INTO t1 VALUES ("new text 1012", 1012, "");
+INSERT INTO t1 VALUES ("new text 1013", 1013, "");
+***** conn1: begin
+SET AUTOCOMMIT= 1;
+BEGIN;
+***** conn2: begin and update t1
+SET AUTOCOMMIT= 1;
+BEGIN;
+UPDATE t1 SET a = "new text 1014" WHERE b = 1012;
+***** conn1: delete from t1 and commit
+DELETE FROM t1 WHERE b = 1012;
+DELETE FROM t1 WHERE b = 1013;
+COMMIT;
+***** conn2: commit
+COMMIT;
+###################################################################################
+#                               4 - SAVE POINTS
+###################################################################################
+BEGIN;
+INSERT INTO t2 VALUES ("new text 400", 400, "new text 400");
+INSERT INTO t3 VALUES ("new text 401", 401, "new text 401");
+SAVEPOINT sv;
+INSERT INTO t1 VALUES ("new text 402", 402, "new text 402");
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
+INSERT INTO t3 VALUES ("new text 403", 403, "new text 403");
+ROLLBACK TO sv;
+Warnings:
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
+COMMIT;
+###################################################################################
+#                                        CLEAN
+###################################################################################
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+DROP TABLE t7;
+DROP TABLE t8;
+DROP TABLE t9;
+DROP PROCEDURE pc6;
+DROP FUNCTION f1;
+DROP FUNCTION f2;

=== modified file 'mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result'
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2008-07-16 09:17:10 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2009-06-06 17:51:51 +0000
@@ -19,10 +19,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
 master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
 master-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
-master-bin.000001	#	Query	1	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	use `test`; COMMIT
 **** On Slave ****
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -31,7 +29,7 @@ Master_User	root
 Master_Port	MASTER_PORT
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	594
+Read_Master_Log_Pos	457
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
@@ -46,7 +44,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	594
+Exec_Master_Log_Pos	457
 Relay_Log_Space	#
 Until_Condition	None
 Until_Log_File	
@@ -68,9 +66,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
 slave-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
 slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
-slave-bin.000001	#	Query	1	#	use `test`; BEGIN
 slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
 slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	1	#	use `test`; COMMIT
 DROP TABLE IF EXISTS t1;
 SET @@global.binlog_format= @old_binlog_format;

=== removed file 'mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---innodb

=== removed file 'mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---innodb

=== modified file 'mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result	2008-04-03 09:50:43 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result	2009-06-06 17:51:51 +0000
@@ -28,10 +28,8 @@ INSERT INTO t2 VALUES (3,3), (4,4);
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b INT)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 **** On Slave ****
 SHOW DATABASES;
 Database
@@ -60,10 +58,8 @@ SHOW BINLOG EVENTS;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	4	Format_desc	1	106	Server ver: SERVER_VERSION, Binlog ver: 4
 master-bin.000001	106	Query	1	192	use `test`; CREATE TABLE t1 (a INT)
-master-bin.000001	192	Query	1	260	use `test`; BEGIN
-master-bin.000001	260	Table_map	1	301	table_id: # (test.t1)
-master-bin.000001	301	Write_rows	1	340	table_id: # flags: STMT_END_F
-master-bin.000001	340	Query	1	409	use `test`; COMMIT
+master-bin.000001	192	Table_map	1	233	table_id: # (test.t1)
+master-bin.000001	233	Write_rows	1	272	table_id: # flags: STMT_END_F
 DROP TABLE t1;
 ================ Test for BUG#17620 ================
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_conflicts.result'
--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2009-01-09 14:12:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2009-06-06 17:51:51 +0000
@@ -24,7 +24,7 @@ a
 1
 [on slave]
 ---- Wait until slave stops with an error ----
-Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error)
+Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 278 (expected "duplicate key" error)
 SELECT * FROM t1;
 a
 1
@@ -50,7 +50,7 @@ SELECT * FROM t1;
 a
 [on slave]
 ---- Wait until slave stops with an error ----
-Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error)
+Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 503 (expected "can't find record" error)
 SELECT * FROM t1;
 a
 ---- Resolve the conflict on the slave and restart SQL thread ----

=== modified file 'mysql-test/suite/rpl/r/rpl_row_create_table.result'
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result	2009-01-23 12:22:05 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result	2009-06-06 17:51:51 +0000
@@ -150,10 +150,8 @@ a	b
 SHOW BINLOG EVENTS FROM 106;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 #	106	Query	#	206	use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
-#	206	Query	#	274	use `test`; BEGIN
-#	274	Table_map	#	316	table_id: # (test.t7)
-#	316	Write_rows	#	372	table_id: # flags: STMT_END_F
-#	372	Query	#	443	use `test`; ROLLBACK
+#	206	Table_map	#	248	table_id: # (test.t7)
+#	248	Write_rows	#	304	table_id: # flags: STMT_END_F
 SELECT * FROM t7 ORDER BY a,b;
 a	b
 1	2
@@ -173,10 +171,8 @@ Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 SHOW BINLOG EVENTS FROM 106;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-#	106	Query	#	174	use `test`; BEGIN
-#	174	Table_map	#	216	table_id: # (test.t7)
-#	216	Write_rows	#	272	table_id: # flags: STMT_END_F
-#	272	Query	#	343	use `test`; ROLLBACK
+#	106	Table_map	#	148	table_id: # (test.t7)
+#	148	Write_rows	#	204	table_id: # flags: STMT_END_F
 SELECT * FROM t7 ORDER BY a,b;
 a	b
 1	2
@@ -299,35 +295,31 @@ a
 SHOW BINLOG EVENTS FROM 106;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 #	106	Query	#	192	use `test`; CREATE TABLE t1 (a INT)
-#	192	Query	#	260	use `test`; BEGIN
-#	260	Table_map	#	301	table_id: # (test.t1)
-#	301	Write_rows	#	345	table_id: # flags: STMT_END_F
-#	345	Query	#	414	use `test`; COMMIT
-#	414	Query	#	482	use `test`; BEGIN
-#	482	Query	#	607	use `test`; CREATE TABLE `t2` (
+#	192	Table_map	#	233	table_id: # (test.t1)
+#	233	Write_rows	#	277	table_id: # flags: STMT_END_F
+#	277	Query	#	345	use `test`; BEGIN
+#	345	Query	#	470	use `test`; CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=InnoDB
-#	607	Table_map	#	648	table_id: # (test.t2)
-#	648	Write_rows	#	692	table_id: # flags: STMT_END_F
-#	692	Xid	#	719	COMMIT /* XID */
-#	719	Query	#	787	use `test`; BEGIN
-#	787	Query	#	912	use `test`; CREATE TABLE `t3` (
+#	470	Table_map	#	511	table_id: # (test.t2)
+#	511	Write_rows	#	555	table_id: # flags: STMT_END_F
+#	555	Xid	#	582	COMMIT /* XID */
+#	582	Query	#	650	use `test`; BEGIN
+#	650	Query	#	775	use `test`; CREATE TABLE `t3` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=InnoDB
-#	912	Table_map	#	953	table_id: # (test.t3)
-#	953	Write_rows	#	997	table_id: # flags: STMT_END_F
-#	997	Xid	#	1024	COMMIT /* XID */
-#	1024	Query	#	1092	use `test`; BEGIN
-#	1092	Query	#	1217	use `test`; CREATE TABLE `t4` (
+#	775	Table_map	#	816	table_id: # (test.t3)
+#	816	Write_rows	#	860	table_id: # flags: STMT_END_F
+#	860	Xid	#	887	COMMIT /* XID */
+#	887	Query	#	955	use `test`; BEGIN
+#	955	Query	#	1080	use `test`; CREATE TABLE `t4` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=InnoDB
-#	1217	Table_map	#	1258	table_id: # (test.t4)
-#	1258	Write_rows	#	1302	table_id: # flags: STMT_END_F
-#	1302	Xid	#	1329	COMMIT /* XID */
-#	1329	Query	#	1397	use `test`; BEGIN
-#	1397	Table_map	#	1438	table_id: # (test.t1)
-#	1438	Write_rows	#	1482	table_id: # flags: STMT_END_F
-#	1482	Query	#	1553	use `test`; ROLLBACK
+#	1080	Table_map	#	1121	table_id: # (test.t4)
+#	1121	Write_rows	#	1165	table_id: # flags: STMT_END_F
+#	1165	Xid	#	1192	COMMIT /* XID */
+#	1192	Table_map	#	1233	table_id: # (test.t1)
+#	1233	Write_rows	#	1277	table_id: # flags: STMT_END_F
 SHOW TABLES;
 Tables_in_test
 t1
@@ -393,17 +385,15 @@ a
 SHOW BINLOG EVENTS FROM 106;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 #	106	Query	#	192	use `test`; CREATE TABLE t1 (a INT)
-#	192	Query	#	260	use `test`; BEGIN
-#	260	Table_map	#	301	table_id: # (test.t1)
-#	301	Write_rows	#	345	table_id: # flags: STMT_END_F
-#	345	Query	#	414	use `test`; COMMIT
-#	414	Query	#	514	use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
-#	514	Query	#	582	use `test`; BEGIN
-#	582	Table_map	#	623	table_id: # (test.t2)
-#	623	Write_rows	#	667	table_id: # flags: STMT_END_F
-#	667	Table_map	#	708	table_id: # (test.t2)
-#	708	Write_rows	#	747	table_id: # flags: STMT_END_F
-#	747	Xid	#	774	COMMIT /* XID */
+#	192	Table_map	#	233	table_id: # (test.t1)
+#	233	Write_rows	#	277	table_id: # flags: STMT_END_F
+#	277	Query	#	377	use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
+#	377	Query	#	445	use `test`; BEGIN
+#	445	Table_map	#	486	table_id: # (test.t2)
+#	486	Write_rows	#	530	table_id: # flags: STMT_END_F
+#	530	Table_map	#	571	table_id: # (test.t2)
+#	571	Write_rows	#	610	table_id: # flags: STMT_END_F
+#	610	Xid	#	637	COMMIT /* XID */
 SELECT * FROM t2 ORDER BY a;
 a
 1
@@ -431,12 +421,6 @@ SELECT * FROM t2 ORDER BY a;
 a
 SHOW BINLOG EVENTS FROM 106;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-#	106	Query	#	174	use `test`; BEGIN
-#	174	Table_map	#	215	table_id: # (test.t2)
-#	215	Write_rows	#	259	table_id: # flags: STMT_END_F
-#	259	Table_map	#	300	table_id: # (test.t2)
-#	300	Write_rows	#	339	table_id: # flags: STMT_END_F
-#	339	Query	#	410	use `test`; ROLLBACK
 SELECT * FROM t2 ORDER BY a;
 a
 DROP TABLE t1,t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result'
--- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result	2008-12-12 11:34:18 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result	2009-06-06 17:51:51 +0000
@@ -12,14 +12,30 @@ create table t4 (a int);
 insert into t4 select * from t3;
 rename table t1 to t5, t2 to t1;
 flush no_write_to_binlog tables;
-SHOW BINLOG EVENTS FROM 897 ;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
+master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	use `test`; create table t2 (a int)
+master-bin.000001	#	Query	1	#	use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001	#	Query	1	#	use `test`; create table t4 (a int)
+master-bin.000001	#	Table_map	1	#	table_id: # (test.t4)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
 select * from t3;
 a
 flush tables;
-SHOW BINLOG EVENTS FROM 897 ;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
+master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	1	#	use `test`; create table t2 (a int)
+master-bin.000001	#	Query	1	#	use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001	#	Query	1	#	use `test`; create table t4 (a int)
+master-bin.000001	#	Table_map	1	#	table_id: # (test.t4)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
 master-bin.000001	#	Query	1	#	use `test`; flush tables
 select * from t3;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_insert_delayed.result'
--- a/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result	2007-07-27 14:29:48 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result	2009-06-06 17:51:51 +0000
@@ -22,6 +22,10 @@ COUNT(*)
 5000
 truncate table t1;
 insert delayed into t1 values(10, "my name");
+flush table t1;
+select * from t1;
+id	name
+10	my name
 insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
 flush table t1;
 select * from t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_log.result'
--- a/mysql-test/suite/rpl/r/rpl_row_log.result	2009-02-02 11:44:18 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result	2009-06-06 17:51:51 +0000
@@ -20,26 +20,22 @@ show binlog events;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
 master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; drop table t1
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	use `test`; COMMIT
 show binlog events from 106 limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
 show binlog events from 106 limit 2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
 show binlog events from 106 limit 2,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 flush logs;
 create table t3 (a int)ENGINE=MyISAM;
 select * from t1 order by 1 asc;
@@ -192,26 +188,20 @@ insert into t2 values (1);
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Query	#	#	use `test`; drop table t1
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
 show binlog events in 'master-bin.000002';
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000002	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
 master-bin.000002	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=MyISAM
 master-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=MyISAM
-master-bin.000002	#	Query	1	#	use `test`; BEGIN
 master-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
 master-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000002	#	Query	1	#	use `test`; COMMIT
 show binary logs;
 Log_name	File_size
 master-bin.000001	#
@@ -224,26 +214,20 @@ show binlog events in 'slave-bin.000001'
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
 slave-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-slave-bin.000001	#	Query	1	#	use `test`; BEGIN
 slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
 slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	1	#	use `test`; COMMIT
 slave-bin.000001	#	Query	1	#	use `test`; drop table t1
 slave-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-slave-bin.000001	#	Query	1	#	use `test`; BEGIN
 slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
 slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	1	#	use `test`; COMMIT
 slave-bin.000001	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=MyISAM
 slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
 show binlog events in 'slave-bin.000002' from 4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000002	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
 slave-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=MyISAM
-slave-bin.000002	#	Query	1	#	use `test`; BEGIN
 slave-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
 slave-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000002	#	Query	1	#	use `test`; COMMIT
 SHOW SLAVE STATUS;
 Slave_IO_State	#
 Master_Host	127.0.0.1
@@ -251,7 +235,7 @@ Master_User	root
 Master_Port	MASTER_PORT
 Connect_Retry	1
 Master_Log_File	master-bin.000002
-Read_Master_Log_Pos	516
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000002
@@ -266,7 +250,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	516
+Exec_Master_Log_Pos	#
 Relay_Log_Space	#
 Until_Condition	None
 Until_Log_File	
@@ -301,14 +285,10 @@ insert into t1 values (NULL, last_insert
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1(a int auto_increment primary key, b int)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 select * from t1;
 a	b
 1	1

=== modified file 'mysql-test/suite/rpl/r/rpl_row_log_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2009-02-02 11:44:18 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2009-06-06 17:51:51 +0000
@@ -251,7 +251,7 @@ Master_User	root
 Master_Port	MASTER_PORT
 Connect_Retry	1
 Master_Log_File	master-bin.000002
-Read_Master_Log_Pos	474
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000002
@@ -266,7 +266,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	474
+Exec_Master_Log_Pos	#
 Relay_Log_Space	#
 Until_Condition	None
 Until_Log_File	
@@ -301,14 +301,10 @@ insert into t1 values (NULL, last_insert
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1(a int auto_increment primary key, b int)
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
-master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; COMMIT
 select * from t1;
 a	b
 1	1

=== modified file 'mysql-test/suite/rpl/r/rpl_sp.result'
--- a/mysql-test/suite/rpl/r/rpl_sp.result	2009-04-09 11:30:44 +0000
+++ b/mysql-test/suite/rpl/r/rpl_sp.result	2009-06-06 17:51:51 +0000
@@ -118,6 +118,7 @@ ERROR 23000: Duplicate entry '20' for ke
 show warnings;
 Level	Code	Message
 Error	1062	Duplicate entry '20' for key 'a'
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
 select * from t2;
 a
 20
@@ -270,6 +271,7 @@ end|
 do fn1(100);
 Warnings:
 Error	1062	Duplicate entry '100' for key 'a'
+Warning	1196	Some non-transactional changed tables couldn't be rolled back
 select fn1(20);
 ERROR 23000: Duplicate entry '20' for key 'a'
 select * from t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result	2008-12-12 11:34:18 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result	2009-06-06 17:51:51 +0000
@@ -12,14 +12,26 @@ create table t4 (a int);
 insert into t4 select * from t3;
 rename table t1 to t5, t2 to t1;
 flush no_write_to_binlog tables;
-SHOW BINLOG EVENTS FROM 656 ;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
+master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (10)
+master-bin.000001	#	Query	1	#	use `test`; create table t2 (a int)
+master-bin.000001	#	Query	1	#	use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001	#	Query	1	#	use `test`; create table t4 (a int)
+master-bin.000001	#	Query	1	#	use `test`; insert into t4 select * from t3
 master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
 select * from t3;
 a
 flush tables;
-SHOW BINLOG EVENTS FROM 656 ;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
+master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (10)
+master-bin.000001	#	Query	1	#	use `test`; create table t2 (a int)
+master-bin.000001	#	Query	1	#	use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001	#	Query	1	#	use `test`; create table t4 (a int)
+master-bin.000001	#	Query	1	#	use `test`; insert into t4 select * from t3
 master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
 master-bin.000001	#	Query	1	#	use `test`; flush tables
 select * from t3;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result	2007-07-27 11:28:36 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result	2009-06-06 17:51:51 +0000
@@ -22,6 +22,10 @@ COUNT(*)
 5000
 truncate table t1;
 insert delayed into t1 values(10, "my name");
+flush table t1;
+select * from t1;
+id	name
+10	my name
 insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
 ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
 flush table t1;
@@ -88,6 +92,10 @@ COUNT(*)
 5000
 truncate table t1;
 insert delayed into t1 values(10, "my name");
+flush table t1;
+select * from t1;
+id	name
+10	my name
 insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
 flush table t1;
 select * from t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_log.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result	2009-03-16 08:21:29 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result	2009-06-06 17:51:51 +0000
@@ -233,7 +233,7 @@ Master_User	root
 Master_Port	MASTER_PORT
 Connect_Retry	1
 Master_Log_File	master-bin.000002
-Read_Master_Log_Pos	392
+Read_Master_Log_Pos	#
 Relay_Log_File	#
 Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000002
@@ -248,7 +248,7 @@ Replicate_Wild_Ignore_Table	
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	392
+Exec_Master_Log_Pos	#
 Relay_Log_Space	#
 Until_Condition	None
 Until_Log_File	

=== modified file 'mysql-test/suite/rpl/t/rpl_blackhole.test'
--- a/mysql-test/suite/rpl/t/rpl_blackhole.test	2009-01-30 13:44:49 +0000
+++ b/mysql-test/suite/rpl/t/rpl_blackhole.test	2009-06-06 17:51:51 +0000
@@ -45,9 +45,20 @@ source extra/rpl_tests/rpl_blackhole.tes
 let $statement = INSERT INTO t1 SELECT * FROM t2;
 source extra/rpl_tests/rpl_blackhole.test;
 
+# 
+# The MASTER has MyISAM as the engine for both tables. The SLAVE has Blackhole
+# on t1 (transactional engine) and MyISAM on t2 (non-transactional engine). 
+#
+# In MIXED MODE, the command below is logged as statement on the MASTER. On the
+# other hand, on the SLAVE, it is tagged as unsafe and then executed in ROW
+# MODE. In a nutshell, statements that mixes transactional and non-transactional
+# engines are tagged as unsafe. This behavior generates a problem as no rows are
+# returned and makes the # SLAVE diverge from the MASTER.
+#
 # Test INSERT-SELECT from Blackhole, no primary key
-let $statement = INSERT INTO t2 SELECT * FROM t1;
-source extra/rpl_tests/rpl_blackhole.test;
+#let $statement = INSERT INTO t2 SELECT * FROM t1;
+#source extra/rpl_tests/rpl_blackhole.test;
+#
 
 connection master;
 ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);

=== modified file 'mysql-test/suite/rpl/t/rpl_empty_master_crash.test'
--- a/mysql-test/suite/rpl/t/rpl_empty_master_crash.test	2007-06-27 12:29:10 +0000
+++ b/mysql-test/suite/rpl/t/rpl_empty_master_crash.test	2009-06-06 17:51:51 +0000
@@ -1,6 +1,6 @@
 source include/master-slave.inc;
 
-source include/show_slave_status.inc;
+source include/show_slave_status2.inc;
 
 #
 # Load table should not succeed on the master as this is not a slave

=== modified file 'mysql-test/suite/rpl/t/rpl_innodb.test'
--- a/mysql-test/suite/rpl/t/rpl_innodb.test	2008-10-29 13:25:03 +0000
+++ b/mysql-test/suite/rpl/t/rpl_innodb.test	2009-06-06 17:51:51 +0000
@@ -111,7 +111,6 @@ connection slave;
 SHOW CREATE TABLE mysqltest1.tmp;
 --error ER_NO_SUCH_TABLE
 SHOW CREATE TABLE mysqltest1.tmp2;
-# t1 has two rows here: the transaction not rolled back since t1 uses MyISAM
 SELECT COUNT(*) FROM mysqltest1.t1;
 FLUSH LOGS;
 

=== modified file 'mysql-test/suite/rpl/t/rpl_invoked_features.test'
--- a/mysql-test/suite/rpl/t/rpl_invoked_features.test	2008-02-28 21:50:15 +0000
+++ b/mysql-test/suite/rpl/t/rpl_invoked_features.test	2009-06-06 17:51:51 +0000
@@ -166,25 +166,19 @@ INSERT INTO t1 VALUES (103,103,'');
 
 # Do some actions for transactional tables
 --echo
+--disable_warnings
 CREATE TABLE t13 SELECT * FROM v11;
 INSERT INTO t11 VALUES (3,3,'');
 UPDATE t11 SET c='2' WHERE a = 1;
---disable_warnings
 INSERT INTO t11 VALUES(4,4,f1(4));
---enable_warnings
 INSERT INTO t11 VALUES (100,100,'');
---disable_warnings
 CALL p11(5, UUID());
---enable_warnings
 INSERT INTO t11 VALUES (101,101,'');
---disable_warnings
 INSERT INTO t11 VALUES(6,6,f1(6));
---enable_warnings
 INSERT INTO t11 VALUES (102,102,'');
---disable_warnings
 INSERT INTO t11 VALUES(7,7,f2(7));
---enable_warnings
 INSERT INTO t11 VALUES (103,103,'');
+--enable_warnings
 
 # Scheduler is on
 --echo
@@ -268,7 +262,9 @@ SELECT a,b FROM v11 ORDER BY a;
 UPDATE t1 SET c='';
 UPDATE t2 SET c='';
 UPDATE t3 SET c='';
+--disable_warnings
 UPDATE t11 SET c='';
+--enable_warnings
 UPDATE t12 SET c='';
 UPDATE t13 SET c='';
 

=== modified file 'mysql-test/suite/rpl/t/rpl_loaddata_fatal.test'
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test	2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test	2009-06-06 17:51:51 +0000
@@ -8,7 +8,7 @@ connection master;
 CREATE TABLE t1 (a INT, b INT);
 INSERT INTO t1 VALUES (1,10);
 sync_slave_with_master;
-source include/show_slave_status.inc;
+source include/show_slave_status2.inc;
 
 # Now we feed it a load data infile, which should make it stop with a
 # fatal error.
@@ -17,7 +17,7 @@ LOAD DATA INFILE '../../std_data/rpl_loa
 
 connection slave;
 wait_for_slave_to_stop;
-source include/show_slave_status.inc;
+source include/show_slave_status2.inc;
 
 connection slave;
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

=== modified file 'mysql-test/suite/rpl/t/rpl_log_pos.test'
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test	2008-07-10 16:09:39 +0000
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test	2009-06-06 17:51:51 +0000
@@ -22,7 +22,7 @@ source include/wait_for_slave_sql_to_sta
 source include/wait_for_slave_io_to_stop.inc;
 source include/stop_slave.inc;
 
-source include/show_slave_status.inc;
+source include/show_slave_status2.inc;
 connection master;
 source include/show_master_status.inc;
 create table if not exists t1 (n int);

=== added file 'mysql-test/suite/rpl/t/rpl_mixing_mixed_engines.test'
--- a/mysql-test/suite/rpl/t/rpl_mixing_mixed_engines.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mixing_mixed_engines.test	2009-06-06 17:51:51 +0000
@@ -0,0 +1,5 @@
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source suite/rpl/include/rpl_mixed_engines.inc

=== added file 'mysql-test/suite/rpl/t/rpl_mixing_row_engines.test'
--- a/mysql-test/suite/rpl/t/rpl_mixing_row_engines.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mixing_row_engines.test	2009-06-06 17:51:51 +0000
@@ -0,0 +1,5 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source suite/rpl/include/rpl_mixed_engines.inc

=== added file 'mysql-test/suite/rpl/t/rpl_mixing_stmt_engines.test'
--- a/mysql-test/suite/rpl/t/rpl_mixing_stmt_engines.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mixing_stmt_engines.test	2009-06-06 17:51:51 +0000
@@ -0,0 +1,5 @@
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source suite/rpl/include/rpl_mixed_engines.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_read_only.test'
--- a/mysql-test/suite/rpl/t/rpl_read_only.test	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_read_only.test	2009-06-06 17:51:51 +0000
@@ -40,12 +40,16 @@ set global read_only=0;
 connection master1;
 BEGIN;
 insert into t1 values(1002);
+--disable_warnings
 insert into t2 values(2002);
+--enable_warnings
 
 connection master2;
 BEGIN;
 insert into t1 values(1003);
+--disable_warnings
 insert into t2 values(2003);
+--enable_warnings
 
 connection master;
 set global read_only=1;

=== modified file 'mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test'
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test	2007-12-12 10:14:59 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test	2009-06-06 17:51:51 +0000
@@ -1,4 +1,5 @@
 --source include/have_binlog_format_row.inc
+--source include/have_innodb.inc
 
 let $SERVER_VERSION=`select version()`;
 

=== modified file 'mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test'
--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test	2008-03-28 12:16:41 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test	2009-06-06 17:51:51 +0000
@@ -1,8 +1,6 @@
 # depends on the binlog output
 -- source include/have_binlog_format_row.inc
 
-let $rename_event_pos= 897;
-
 # Bug#18326: Do not lock table for writing during prepare of statement
 # The use of the ps protocol causes extra table maps in the binlog, so
 # we disable the ps-protocol for this statement.

=== modified file 'mysql-test/suite/rpl/t/rpl_row_until.test'
--- a/mysql-test/suite/rpl/t/rpl_row_until.test	2009-02-19 20:29:12 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test	2009-06-06 17:51:51 +0000
@@ -14,18 +14,21 @@ INSERT INTO t1 VALUES (1),(2),(3),(4);
 DROP TABLE t1;
 # Save master log postion for query DROP TABLE t1
 save_master_pos;
-let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
+let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 5);
+#show binlog events;
 
 CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
 # Save master log postion for query CREATE TABLE t2
 save_master_pos;
-let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
+let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 6);
+#show binlog events;
 
 INSERT INTO t2 VALUES (1),(2);
 save_master_pos;
 # Save master log postion for query INSERT INTO t2 VALUES (1),(2);
-let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12);
+let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 8);
 sync_slave_with_master;
+#show binlog events;
 
 # Save relay log postion for query INSERT INTO t2 VALUES (1),(2);
 let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
@@ -34,8 +37,9 @@ connection master;
 INSERT INTO t2 VALUES (3),(4);
 DROP TABLE t2;
 # Save master log postion for query INSERT INTO t2 VALUES (1),(2);
-let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17);
+let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 11);
 sync_slave_with_master;
+#show binlog events;
 
 --source include/stop_slave.inc
 # Reset slave.
@@ -45,6 +49,7 @@ eval CHANGE MASTER TO MASTER_USER='root'
 --enable_query_log
 
 # Try to replicate all queries until drop of t1
+
 connection slave;
 echo START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
 --disable_query_log

=== modified file 'mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test	2009-06-06 17:51:51 +0000
@@ -1,7 +1,6 @@
 # depends on the binlog output
 --source include/have_binlog_format_mixed_or_statement.inc
 
-let $rename_event_pos= 656;
 -- source extra/rpl_tests/rpl_flsh_tbls.test
 
 # End of 4.1 tests

=== modified file 'mysql-test/suite/rpl/t/rpl_trigger.test'
--- a/mysql-test/suite/rpl/t/rpl_trigger.test	2009-02-19 23:24:25 +0000
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test	2009-06-06 17:51:51 +0000
@@ -506,7 +506,9 @@ create trigger tr
   for each row insert into log values ( new.f );
 
 set autocommit = 0;
+--disable_warnings
 insert into t1 values ( 1 );
+--enable_warnings
 rollback;
 sync_slave_with_master;
 

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result	2008-07-06 10:53:25 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result	2009-06-06 17:51:51 +0000
@@ -90,6 +90,8 @@ COMMIT;
 BEGIN;
 INSERT INTO tinnodb VALUES (29);
 INSERT INTO tmyisam VALUES (30);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 ---- rolled back with BEGIN ----
 BEGIN;
@@ -101,6 +103,8 @@ Warning	1196	Some non-transactional chan
 BEGIN;
 INSERT INTO tinnodb VALUES (33);
 INSERT INTO tmyisam VALUES (34);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -111,6 +115,8 @@ INSERT INTO tinnodb VALUES (36);
 COMMIT;
 INSERT INTO tinnodb VALUES (37);
 INSERT INTO tmyisam VALUES (38);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 ---- rolled back with AUTOCOMMIT = 0 ----
 INSERT INTO tmyisam VALUES (39);
@@ -120,6 +126,8 @@ Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 INSERT INTO tinnodb VALUES (41);
 INSERT INTO tmyisam VALUES (42);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -133,6 +141,8 @@ COMMIT;
 BEGIN;
 INSERT INTO tndb VALUES (45);
 INSERT INTO tmyisam VALUES (46);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 ---- rolled back with BEGIN ----
 BEGIN;
@@ -144,6 +154,8 @@ Warning	1196	Some non-transactional chan
 BEGIN;
 INSERT INTO tndb VALUES (49);
 INSERT INTO tmyisam VALUES (50);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -154,6 +166,8 @@ INSERT INTO tndb VALUES (52);
 COMMIT;
 INSERT INTO tndb VALUES (53);
 INSERT INTO tmyisam VALUES (54);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 ---- rolled back with AUTOCOMMIT = 0 ----
 INSERT INTO tmyisam VALUES (55);
@@ -163,6 +177,8 @@ Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 INSERT INTO tndb VALUES (57);
 INSERT INTO tmyisam VALUES (58);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -217,22 +233,30 @@ COMMIT;
 BEGIN;
 INSERT INTO tinnodb VALUES (81);
 INSERT INTO tmyisam VALUES (82);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tndb VALUES (83);
 COMMIT;
 BEGIN;
 INSERT INTO tinnodb VALUES (84);
 INSERT INTO tndb VALUES (85);
 INSERT INTO tmyisam VALUES (86);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 BEGIN;
 INSERT INTO tndb VALUES (87);
 INSERT INTO tmyisam VALUES (88);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tinnodb VALUES (89);
 COMMIT;
 BEGIN;
 INSERT INTO tndb VALUES (90);
 INSERT INTO tinnodb VALUES (91);
 INSERT INTO tmyisam VALUES (92);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 ---- rolled back with BEGIN ----
 BEGIN;
@@ -252,6 +276,8 @@ Warning	1196	Some non-transactional chan
 BEGIN;
 INSERT INTO tinnodb VALUES (99);
 INSERT INTO tmyisam VALUES (100);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tndb VALUES (101);
 ROLLBACK;
 Warnings:
@@ -260,12 +286,16 @@ BEGIN;
 INSERT INTO tinnodb VALUES (102);
 INSERT INTO tndb VALUES (103);
 INSERT INTO tmyisam VALUES (104);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 BEGIN;
 INSERT INTO tndb VALUES (105);
 INSERT INTO tmyisam VALUES (106);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tinnodb VALUES (107);
 ROLLBACK;
 Warnings:
@@ -274,6 +304,8 @@ BEGIN;
 INSERT INTO tndb VALUES (108);
 INSERT INTO tinnodb VALUES (109);
 INSERT INTO tmyisam VALUES (110);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -289,19 +321,27 @@ INSERT INTO tinnodb VALUES (116);
 COMMIT;
 INSERT INTO tinnodb VALUES (117);
 INSERT INTO tmyisam VALUES (118);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tndb VALUES (119);
 COMMIT;
 INSERT INTO tinnodb VALUES (120);
 INSERT INTO tndb VALUES (121);
 INSERT INTO tmyisam VALUES (122);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 INSERT INTO tndb VALUES (123);
 INSERT INTO tmyisam VALUES (124);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tinnodb VALUES (125);
 COMMIT;
 INSERT INTO tndb VALUES (126);
 INSERT INTO tinnodb VALUES (127);
 INSERT INTO tmyisam VALUES (128);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 COMMIT;
 ---- rolled back with AUTOCOMMIT = 0 ----
 INSERT INTO tmyisam VALUES (129);
@@ -318,6 +358,8 @@ Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 INSERT INTO tinnodb VALUES (135);
 INSERT INTO tmyisam VALUES (136);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tndb VALUES (137);
 ROLLBACK;
 Warnings:
@@ -325,11 +367,15 @@ Warning	1196	Some non-transactional chan
 INSERT INTO tinnodb VALUES (138);
 INSERT INTO tndb VALUES (139);
 INSERT INTO tmyisam VALUES (140);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 INSERT INTO tndb VALUES (141);
 INSERT INTO tmyisam VALUES (142);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 INSERT INTO tinnodb VALUES (143);
 ROLLBACK;
 Warnings:
@@ -337,6 +383,8 @@ Warning	1196	Some non-transactional chan
 INSERT INTO tndb VALUES (144);
 INSERT INTO tinnodb VALUES (145);
 INSERT INTO tmyisam VALUES (146);
+Warnings:
+Note	1592	Statement may not be safe to log in statement format.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2008-04-09 16:42:05 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2009-06-06 17:51:51 +0000
@@ -257,6 +257,7 @@ static void run_query(THD *thd, char *bu
   thd->query= buf;
   thd->variables.pseudo_thread_id= thread_id;
   thd->transaction.stmt.modified_non_trans_table= FALSE;
+  thd->transaction.stmt.modified_trans_table= FALSE;
   if (disable_binlog)
     thd->options&= ~OPTION_BIN_LOG;
     
@@ -1857,7 +1858,8 @@ static void ndb_binlog_query(THD *thd, C
   thd->db= schema->db;
   thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query,
                     schema->query_length, FALSE,
-                    schema->name[0] == 0 || thd->db[0] == 0);
+                    schema->name[0] == 0 || thd->db[0] == 0, 
+                    FALSE, THD::KILLED_NO_VALUE);
   thd->server_id= thd_server_id_save;
   thd->db= thd_db_save;
 }

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2009-03-27 09:34:24 +0000
+++ b/sql/handler.cc	2009-06-06 17:51:51 +0000
@@ -4477,7 +4477,14 @@ static int write_locked_table_maps(THD *
         if (table->current_lock == F_WRLCK &&
             check_table_binlog_row_based(thd, table))
         {
-          int const has_trans= table->file->has_transactions();
+          /*
+            We need to have a transactional behavior for SQLCOM_CREATE_TABLE
+            (i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a
+            compatible behavior with the STMT based replication even when
+            the table is not transactional.
+          */
+          bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
+                                table->file->has_transactions();
           int const error= thd->binlog_write_table_map(table, has_trans);
           /*
             If an error occurs, it is the responsibility of the caller to
@@ -4525,8 +4532,16 @@ static int binlog_log_row(TABLE* table,
                                     FALSE))))
     {
       bitmap_set_all(&cols);
+      /*
+         We need to have a transactional behavior for SQLCOM_CREATE_TABLE
+         (i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a
+         compatible behavior with the STMT based replication even when
+         the table is not transactional.
+      */
+      bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
+                            table->file->has_transactions();
       if (likely(!(error= write_locked_table_maps(thd))))
-        error= (*log_func)(thd, table, table->file->has_transactions(),
+        error= (*log_func)(thd, table, has_trans,
                            &cols, table->s->fields,
                            before_record, after_record);
 

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2009-05-04 10:00:15 +0000
+++ b/sql/handler.h	2009-06-06 17:51:51 +0000
@@ -761,8 +761,23 @@ struct THD_TRANS
     saved value.
   */
   bool modified_non_trans_table;
-
-  void reset() { no_2pc= FALSE; modified_non_trans_table= FALSE; }
+  /*
+    The purpose of this flag is to keep track of transactional tables that were
+    modified in scope of: 
+    - transaction, when the variable is a member of THD::transaction.all
+    - top-level statement or sub-statement, when the variable is a  member of
+    THD::transaction.stmt 
+  
+    The flag has the same life cyle as the modified_non_trans_table.
+  */
+  bool modified_trans_table;
+
+  void reset() 
+  {
+    no_2pc= FALSE;
+    modified_non_trans_table= FALSE;
+    modified_trans_table= FALSE;
+  }
 };
 
 

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2009-04-09 15:25:25 +0000
+++ b/sql/log.cc	2009-06-06 17:51:51 +0000
@@ -148,54 +148,53 @@ private:
 };
 
 /*
-  Helper class to store binary log transaction data.
+  Helper classes to store non-transactional and transactional data
+  before copying things to the binary log.
 */
-class binlog_trx_data {
+class binlog_cache_mngr
+{
 public:
-  binlog_trx_data()
-    : at_least_one_stmt(0), m_pending(0), before_stmt_pos(MY_OFF_T_UNDEF)
+  binlog_cache_mngr()
+    : m_pending(0)
   {
-    trans_log.end_of_file= max_binlog_cache_size;
+    cache_log.end_of_file= max_binlog_cache_size;
   }
 
-  ~binlog_trx_data()
+  ~binlog_cache_mngr()
   {
     DBUG_ASSERT(pending() == NULL);
-    close_cached_file(&trans_log);
+    close_cached_file(&cache_log);
   }
 
-  my_off_t position() const {
-    return my_b_tell(&trans_log);
+  bool empty() const
+  {
+    return pending() == NULL && my_b_tell(&cache_log) == 0;
   }
 
-  bool empty() const
+  Rows_log_event *pending() const
+  {
+    return m_pending;
+  }
+
+  void set_pending(Rows_log_event *const pending)
   {
-    return pending() == NULL && my_b_tell(&trans_log) == 0;
+    m_pending= pending;
   }
 
   /*
-    Truncate the transaction cache to a certain position. This
-    includes deleting the pending event.
+    Truncate the cache to a certain position. This includes deleting the
+    pending event.
    */
   void truncate(my_off_t pos)
   {
     DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos));
-    DBUG_PRINT("info", ("before_stmt_pos=%lu", (ulong) pos));
-    delete pending();
-    set_pending(0);
-    reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0);
-    if (pos < before_stmt_pos)
-      before_stmt_pos= MY_OFF_T_UNDEF;
-
-    /*
-      The only valid positions that can be truncated to are at the
-      beginning of a statement. We are relying on this fact to be able
-      to set the at_least_one_stmt flag correctly. In other word, if
-      we are truncating to the beginning of the transaction cache,
-      there will be no statements in the cache, otherwhise, we will
-      have at least one statement in the transaction cache.
-     */
-    at_least_one_stmt= (pos > 0);
+    if (pending())
+    {
+      delete pending();
+      set_pending(0);
+    }
+    reinit_io_cache(&cache_log, WRITE_CACHE, pos, 0, 0);
+    cache_log.end_of_file= max_binlog_cache_size;
   }
 
   /*
@@ -205,28 +204,14 @@ public:
   void reset() {
     if (!empty())
       truncate(0);
-    before_stmt_pos= MY_OFF_T_UNDEF;
-    trans_log.end_of_file= max_binlog_cache_size;
+    cache_log.end_of_file= max_binlog_cache_size;
     DBUG_ASSERT(empty());
   }
 
-  Rows_log_event *pending() const
-  {
-    return m_pending;
-  }
-
-  void set_pending(Rows_log_event *const pending)
-  {
-    m_pending= pending;
-  }
-
-  IO_CACHE trans_log;                         // The transaction cache
-
-  /**
-    Boolean that is true if there is at least one statement in the
-    transaction cache.
+  /*
+    Cache to store changes before copying them to the binary log.
   */
-  bool at_least_one_stmt;
+  IO_CACHE cache_log;
 
 private:
   /*
@@ -235,11 +220,64 @@ private:
    */
   Rows_log_event *m_pending;
 
+  binlog_cache_mngr& operator=(const binlog_cache_mngr& info);
+  binlog_cache_mngr(const binlog_cache_mngr& info);
+};
+
+class binlog_cache_data {
 public:
+  binlog_cache_data()
+    : before_stmt_pos (MY_OFF_T_UNDEF) {}
+
+  my_off_t position() const {
+    return my_b_tell(&trx_cache.cache_log);
+  }
+
+  void reset_stmt_cache()
+  {
+    stmt_cache.reset();
+  }
+
+  void reset_trx_cache()
+  {
+    trx_cache.reset();
+    before_stmt_pos= MY_OFF_T_UNDEF;
+  }
+
+  my_off_t get_prv_position()
+  {
+     return(before_stmt_pos);
+  }
+
+  void set_prv_position(my_off_t pos)
+  {
+     before_stmt_pos= pos;
+  }
+  
+  void restore_prv_position()
+  {
+    trx_cache.truncate(before_stmt_pos);
+  }
+
+  void restore_savepoint(my_off_t pos)
+  {
+    trx_cache.truncate(pos);
+    if (pos < before_stmt_pos)
+      before_stmt_pos= MY_OFF_T_UNDEF;
+  }
+
+  binlog_cache_mngr stmt_cache;
+
+  binlog_cache_mngr trx_cache;
+
+private:
   /*
     Binlog position before the start of the current statement.
   */
   my_off_t before_stmt_pos;
+ 
+  binlog_cache_data& operator=(const binlog_cache_data& info);
+  binlog_cache_data(const binlog_cache_data& info);
 };
 
 handlerton *binlog_hton;
@@ -1273,8 +1311,8 @@ binlog_trans_log_savepos(THD *thd, my_of
   DBUG_ASSERT(pos != NULL);
   if (thd_get_ha_data(thd, binlog_hton) == NULL)
     thd->binlog_setup_trx_data();
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
   DBUG_ASSERT(mysql_bin_log.is_open());
   *pos= trx_data->position();
   DBUG_PRINT("return", ("*pos: %lu", (ulong) *pos));
@@ -1307,9 +1345,9 @@ binlog_trans_log_truncate(THD *thd, my_o
   /* Only true if binlog_trans_log_savepos() wasn't called before */
   DBUG_ASSERT(pos != ~(my_off_t) 0);
 
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
-  trx_data->truncate(pos);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
+  trx_data->restore_savepoint(pos);
   DBUG_VOID_RETURN;
 }
 
@@ -1338,30 +1376,30 @@ int binlog_init(void *p)
 
 static int binlog_close_connection(handlerton *hton, THD *thd)
 {
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
-  DBUG_ASSERT(trx_data->empty());
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
+  DBUG_ASSERT(trx_data->trx_cache.empty() &&  trx_data->stmt_cache.empty());
   thd_set_ha_data(thd, binlog_hton, NULL);
-  trx_data->~binlog_trx_data();
+  trx_data->~binlog_cache_data();
   my_free((uchar*)trx_data, MYF(0));
   return 0;
 }
 
 /*
-  End a transaction.
+  Flushes a transaction.
 
   SYNOPSIS
-    binlog_end_trans()
+    binlog_flush_trx_cache()
 
-    thd      The thread whose transaction should be ended
-    trx_data Pointer to the transaction data to use
+    thd      The thread whose transaction should be flushed
+    trx_data Pointer to the cache data to use
     end_ev   The end event to use, or NULL
-    all      True if the entire transaction should be ended, false if
-             only the statement transaction should be ended.
+    all      True if the entire transaction should be flushed, false
+             if only the statement transaction should be ended.
 
   DESCRIPTION
 
-    End the currently open transaction. The transaction can be either
+    Flushes the currently open transaction. The transaction can be either
     a real transaction (if 'all' is true) or a statement transaction
     (if 'all' is false).
 
@@ -1371,12 +1409,17 @@ static int binlog_close_connection(handl
     'all' is false), or reset completely (if 'all' is true).
  */
 static int
-binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
+binlog_flush_trx_cache(THD *thd, binlog_cache_data *trx_data,
                  Log_event *end_ev, bool all)
 {
-  DBUG_ENTER("binlog_end_trans");
+  DBUG_ENTER("binlog_flush_trx_cache");
   int error=0;
-  IO_CACHE *trans_log= &trx_data->trans_log;
+  IO_CACHE *cache_log= &trx_data->trx_cache.cache_log;
+  /*
+    This function handles transactional changes and as such
+    this flag equals to true.
+  */
+  bool const is_transactional= TRUE;
   DBUG_PRINT("enter", ("transaction: %s  end_ev: 0x%lx",
                        all ? "all" : "stmt", (long) end_ev));
   DBUG_PRINT("info", ("thd->options={ %s%s}",
@@ -1391,7 +1434,7 @@ binlog_end_trans(THD *thd, binlog_trx_da
   */
   if (end_ev != NULL)
   {
-    thd->binlog_flush_pending_rows_event(TRUE);
+    thd->binlog_flush_pending_rows_event(TRUE, is_transactional);
     /*
       Doing a commit or a rollback including non-transactional tables,
       i.e., ending a transaction where we might write the transaction
@@ -1402,8 +1445,9 @@ binlog_end_trans(THD *thd, binlog_trx_da
       were, we would have to ensure that we're not ending a statement
       inside a stored function.
      */
-    error= mysql_bin_log.write(thd, &trx_data->trans_log, end_ev);
-    trx_data->reset();
+    error= mysql_bin_log.write(thd, &trx_data->trx_cache.cache_log, end_ev,
+                               is_transactional);
+    trx_data->reset_trx_cache();
 
     /*
       We need to step the table map version after writing the
@@ -1411,10 +1455,10 @@ binlog_end_trans(THD *thd, binlog_trx_da
     */
     mysql_bin_log.update_table_map_version();
     statistic_increment(binlog_cache_use, &LOCK_status);
-    if (trans_log->disk_writes != 0)
+    if (cache_log->disk_writes != 0)
     {
       statistic_increment(binlog_cache_disk_use, &LOCK_status);
-      trans_log->disk_writes= 0;
+      cache_log->disk_writes= 0;
     }
   }
   else
@@ -1426,11 +1470,11 @@ binlog_end_trans(THD *thd, binlog_trx_da
       If rolling back a statement in a transaction, we truncate the
       transaction cache to remove the statement.
      */
-    thd->binlog_remove_pending_rows_event(TRUE);
+    thd->binlog_remove_pending_rows_event(TRUE, is_transactional);
     if (all || !(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT)))
-      trx_data->reset();
+      trx_data->reset_trx_cache();
     else                                        // ...statement
-      trx_data->truncate(trx_data->before_stmt_pos);
+      trx_data->restore_prv_position();
 
     /*
       We need to step the table map version on a rollback to ensure
@@ -1440,7 +1484,7 @@ binlog_end_trans(THD *thd, binlog_trx_da
     mysql_bin_log.update_table_map_version();
   }
 
-  DBUG_ASSERT(thd->binlog_get_pending_rows_event() == NULL);
+  DBUG_ASSERT(thd->binlog_get_pending_rows_event(is_transactional) == NULL);
   DBUG_RETURN(error);
 }
 
@@ -1455,11 +1499,40 @@ static int binlog_prepare(handlerton *ht
   return 0;
 }
 
+static int
+binlog_flush_stmt_cache(THD *thd, binlog_cache_data *trx_data)
+{
+  int error= 0;
+  DBUG_ENTER("binlog_flush_stmt_cache");
+  /*
+    This function handles non-transactional changes and as such
+    this flag equals to false.
+  */
+  bool const is_transactional= FALSE;
+  IO_CACHE *cache_log= &trx_data->stmt_cache.cache_log;
+  thd->binlog_flush_pending_rows_event(TRUE, is_transactional);
+  if ((error= mysql_bin_log.write(thd, cache_log, 0, is_transactional)))
+    DBUG_RETURN(error);
+  trx_data->reset_stmt_cache();
+
+  /*
+    We need to step the table map version after writing the
+    transaction cache to disk.
+  */
+  mysql_bin_log.update_table_map_version();
+  statistic_increment(binlog_cache_use, &LOCK_status);
+  if (cache_log->disk_writes != 0)
+  {
+    statistic_increment(binlog_cache_disk_use, &LOCK_status);
+    cache_log->disk_writes= 0;
+  }
+  DBUG_RETURN(error);
+}
+
 /**
   This function is called once after each statement.
 
-  It has the responsibility to flush the transaction cache to the
-  binlog file on commits.
+  It has the responsibility to flush the caches to the binlog file on commits.
 
   @param hton  The binlog handlerton.
   @param thd   The client thread that executes the transaction.
@@ -1472,13 +1545,18 @@ static int binlog_commit(handlerton *hto
 {
   int error= 0;
   DBUG_ENTER("binlog_commit");
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
+
+  if (!trx_data->stmt_cache.empty())
+  {
+    binlog_flush_stmt_cache(thd, trx_data);
+  }
 
-  if (trx_data->empty())
+  if (trx_data->trx_cache.empty())
   {
-    // we're here because trans_log was flushed in MYSQL_BIN_LOG::log_xid()
-    trx_data->reset();
+    // we're here because cache_log was flushed in MYSQL_BIN_LOG::log_xid()
+    trx_data->reset_trx_cache();
     DBUG_RETURN(0);
   }
 
@@ -1494,9 +1572,8 @@ static int binlog_commit(handlerton *hto
   ulonglong const in_transaction=
     thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN);
   DBUG_PRINT("debug",
-             ("all: %d, empty: %s, in_transaction: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s",
+             ("all: %d, in_transaction: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s",
               all,
-              YESNO(trx_data->empty()),
               YESNO(in_transaction),
               YESNO(thd->transaction.all.modified_non_trans_table),
               YESNO(thd->transaction.stmt.modified_non_trans_table)));
@@ -1504,23 +1581,18 @@ static int binlog_commit(handlerton *hto
   {
     Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
     qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
-    error= binlog_end_trans(thd, trx_data, &qev, all);
-    goto end;
+    error= binlog_flush_trx_cache(thd, trx_data, &qev, all);
   }
 
-end:
   if (!all)
-    trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
+    trx_data->set_prv_position(MY_OFF_T_UNDEF); // part of the stmt commit
   DBUG_RETURN(error);
 }
 
 /**
-  This function is called when a transaction involving a transactional
-  table is rolled back.
+  This function is called when a transaction or a statement is rolled back.
 
-  It has the responsibility to flush the transaction cache to the
-  binlog file. However, if the transaction does not involve
-  non-transactional tables, nothing needs to be logged.
+  It has the responsibility to flush the caches to the binlog file.
 
   @param hton  The binlog handlerton.
   @param thd   The client thread that executes the transaction.
@@ -1533,11 +1605,17 @@ static int binlog_rollback(handlerton *h
 {
   DBUG_ENTER("binlog_rollback");
   int error=0;
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
 
-  if (trx_data->empty()) {
-    trx_data->reset();
+  if (!trx_data->stmt_cache.empty())
+  {
+    binlog_flush_stmt_cache(thd, trx_data);
+  }
+
+  if (trx_data->trx_cache.empty()) 
+  {
+    trx_data->reset_trx_cache();
     DBUG_RETURN(0);
   }
 
@@ -1557,9 +1635,18 @@ static int binlog_rollback(handlerton *h
       transactional table in that statement as well, which needs to be
       rolled back on the slave.
     */
-    Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
-    qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
-    error= binlog_end_trans(thd, trx_data, &qev, all);
+    if (thd->variables.binlog_format == BINLOG_FORMAT_STMT &&
+        thd->transaction.all.modified_non_trans_table)
+    {
+      Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
+      qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
+      error= binlog_flush_trx_cache(thd, trx_data, &qev, all);
+    }
+    else
+      /*
+        We do what follows to clean up the cache. 
+      */
+      error= binlog_flush_trx_cache(thd, trx_data, 0, all);
   }
   else if (all && !thd->transaction.all.modified_non_trans_table ||
            !all && !thd->transaction.stmt.modified_non_trans_table)
@@ -1569,10 +1656,10 @@ static int binlog_rollback(handlerton *h
       the transaction cache without writing anything to the binary
       log.
      */
-    error= binlog_end_trans(thd, trx_data, 0, all);
+    error= binlog_flush_trx_cache(thd, trx_data, 0, all);
   }
   if (!all)
-    trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt rollback
+    trx_data->set_prv_position(MY_OFF_T_UNDEF); // part of the stmt rollback
   DBUG_RETURN(error);
 }
 
@@ -1609,7 +1696,8 @@ static int binlog_savepoint_set(handlert
   
   int const error=
     thd->binlog_query(THD::STMT_QUERY_TYPE,
-                      thd->query, thd->query_length, TRUE, FALSE);
+                      thd->query, thd->query_length, TRUE, FALSE,
+                      FALSE, THD::KILLED_NO_VALUE);
   DBUG_RETURN(error);
 }
 
@@ -1627,7 +1715,8 @@ static int binlog_savepoint_rollback(han
   {
     int error=
       thd->binlog_query(THD::STMT_QUERY_TYPE,
-                        thd->query, thd->query_length, TRUE, FALSE);
+                        thd->query, thd->query_length, TRUE, FALSE,
+                        FALSE, THD::KILLED_NO_VALUE);
     DBUG_RETURN(error);
   }
   binlog_trans_log_truncate(thd, *(my_off_t*)sv);
@@ -3621,15 +3710,17 @@ bool MYSQL_BIN_LOG::is_query_in_union(TH
 int THD::binlog_setup_trx_data()
 {
   DBUG_ENTER("THD::binlog_setup_trx_data");
-  binlog_trx_data *trx_data=
-    (binlog_trx_data*) thd_get_ha_data(this, binlog_hton);
+  binlog_cache_data *trx_data=
+    (binlog_cache_data*) thd_get_ha_data(this, binlog_hton);
 
   if (trx_data)
     DBUG_RETURN(0);                             // Already set up
 
-  trx_data= (binlog_trx_data*) my_malloc(sizeof(binlog_trx_data), MYF(MY_ZEROFILL));
+  trx_data= (binlog_cache_data*) my_malloc(sizeof(binlog_cache_data), MYF(MY_ZEROFILL));
   if (!trx_data ||
-      open_cached_file(&trx_data->trans_log, mysql_tmpdir,
+      open_cached_file(&trx_data->stmt_cache.cache_log, mysql_tmpdir,
+                       LOG_PREFIX, binlog_cache_size, MYF(MY_WME)) ||
+      open_cached_file(&trx_data->trx_cache.cache_log, mysql_tmpdir,
                        LOG_PREFIX, binlog_cache_size, MYF(MY_WME)))
   {
     my_free((uchar*)trx_data, MYF(MY_ALLOW_ZERO_PTR));
@@ -3637,7 +3728,7 @@ int THD::binlog_setup_trx_data()
   }
   thd_set_ha_data(this, binlog_hton, trx_data);
 
-  trx_data= new (thd_get_ha_data(this, binlog_hton)) binlog_trx_data;
+  trx_data= new (thd_get_ha_data(this, binlog_hton)) binlog_cache_data;
 
   DBUG_RETURN(0);
 }
@@ -3655,11 +3746,10 @@ int THD::binlog_setup_trx_data()
     - Start a transaction if not in autocommit mode or if a BEGIN
       statement has been seen.
 
-    - Start a statement transaction to allow us to truncate the binary
-      log.
+    - Start a statement transaction to allow us to truncate the cache.
 
     - Save the currrent binlog position so that we can roll back the
-      statement by truncating the transaction log.
+      statement by truncating the cache.
 
       We only update the saved position if the old one was undefined,
       the reason is that there are some cases (e.g., for CREATE-SELECT)
@@ -3673,15 +3763,15 @@ int THD::binlog_setup_trx_data()
 void
 THD::binlog_start_trans_and_stmt()
 {
-  binlog_trx_data *trx_data= (binlog_trx_data*) thd_get_ha_data(this, binlog_hton);
+  binlog_cache_data *trx_data= (binlog_cache_data*) thd_get_ha_data(this, binlog_hton);
   DBUG_ENTER("binlog_start_trans_and_stmt");
   DBUG_PRINT("enter", ("trx_data: 0x%lx  trx_data->before_stmt_pos: %lu",
                        (long) trx_data,
-                       (trx_data ? (ulong) trx_data->before_stmt_pos :
+                       (trx_data ? (ulong) trx_data->get_prv_position() :
                         (ulong) 0)));
 
   if (trx_data == NULL ||
-      trx_data->before_stmt_pos == MY_OFF_T_UNDEF)
+      trx_data->get_prv_position() == MY_OFF_T_UNDEF)
   {
     this->binlog_set_stmt_begin();
     if (options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
@@ -3702,8 +3792,8 @@ THD::binlog_start_trans_and_stmt()
 }
 
 void THD::binlog_set_stmt_begin() {
-  binlog_trx_data *trx_data=
-    (binlog_trx_data*) thd_get_ha_data(this, binlog_hton);
+  binlog_cache_data *trx_data=
+    (binlog_cache_data*) thd_get_ha_data(this, binlog_hton);
 
   /*
     The call to binlog_trans_log_savepos() might create the trx_data
@@ -3713,8 +3803,8 @@ void THD::binlog_set_stmt_begin() {
   */
   my_off_t pos= 0;
   binlog_trans_log_savepos(this, &pos);
-  trx_data= (binlog_trx_data*) thd_get_ha_data(this, binlog_hton);
-  trx_data->before_stmt_pos= pos;
+  trx_data= (binlog_cache_data*) thd_get_ha_data(this, binlog_hton);
+  trx_data->set_prv_position(pos);
 }
 
 
@@ -3722,7 +3812,7 @@ void THD::binlog_set_stmt_begin() {
   Write a table map to the binary log.
  */
 
-int THD::binlog_write_table_map(TABLE *table, bool is_trans)
+int THD::binlog_write_table_map(TABLE *table, bool is_transactional)
 {
   int error;
   DBUG_ENTER("THD::binlog_write_table_map");
@@ -3738,12 +3828,19 @@ int THD::binlog_write_table_map(TABLE *t
     flags= Table_map_log_event::TM_NO_FLAGS;
 
   Table_map_log_event
-    the_event(this, table, table->s->table_map_id, is_trans, flags);
+    the_event(this, table, table->s->table_map_id, is_transactional, flags);
 
-  if (is_trans && binlog_table_maps == 0)
+  if (binlog_table_maps == 0)
     binlog_start_trans_and_stmt();
 
-  if ((error= mysql_bin_log.write(&the_event)))
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(this, binlog_hton);
+
+  IO_CACHE *file= (is_transactional ?
+                   &trx_data->trx_cache.cache_log :
+                   &trx_data->stmt_cache.cache_log);
+
+  if ((error= the_event.write(file)))
     DBUG_RETURN(error);
 
   binlog_table_maps++;
@@ -3752,30 +3849,37 @@ int THD::binlog_write_table_map(TABLE *t
 }
 
 Rows_log_event*
-THD::binlog_get_pending_rows_event() const
+THD::binlog_get_pending_rows_event(bool is_transactional) const
 {
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(this, binlog_hton);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(this, binlog_hton);
+
   /*
     This is less than ideal, but here's the story: If there is no
     trx_data, prepare_pending_rows_event() has never been called
     (since the trx_data is set up there). In that case, we just return
     NULL.
    */
-  return trx_data ? trx_data->pending() : NULL;
+  return (trx_data ? (is_transactional ?
+                      trx_data->trx_cache.pending() :
+                      trx_data->stmt_cache.pending())
+         : NULL);
 }
 
 void
-THD::binlog_set_pending_rows_event(Rows_log_event* ev)
+THD::binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional)
 {
   if (thd_get_ha_data(this, binlog_hton) == NULL)
     binlog_setup_trx_data();
 
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(this, binlog_hton);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(this, binlog_hton);
 
   DBUG_ASSERT(trx_data);
-  trx_data->set_pending(ev);
+
+  binlog_cache_mngr *cache_data= (is_transactional ?
+                          &trx_data->trx_cache : &trx_data->stmt_cache);
+  cache_data->set_pending(ev);
 }
 
 
@@ -3786,19 +3890,21 @@ THD::binlog_set_pending_rows_event(Rows_
   no-op.
  */
 int
-MYSQL_BIN_LOG::remove_pending_rows_event(THD *thd)
+MYSQL_BIN_LOG::remove_pending_rows_event(THD *thd, bool is_transactional)
 {
   DBUG_ENTER("MYSQL_BIN_LOG::remove_pending_rows_event");
 
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
 
   DBUG_ASSERT(trx_data);
 
-  if (Rows_log_event* pending= trx_data->pending())
+  binlog_cache_mngr *cache_data= (is_transactional ?
+                          &trx_data->trx_cache : &trx_data->stmt_cache);
+  if (Rows_log_event* pending= cache_data->pending())
   {
     delete pending;
-    trx_data->set_pending(NULL);
+    cache_data->set_pending(NULL);
   }
 
   DBUG_RETURN(0);
@@ -3811,7 +3917,8 @@ MYSQL_BIN_LOG::remove_pending_rows_event
 */
 int
 MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
-                                                Rows_log_event* event)
+                                                Rows_log_event* event,
+                                                bool is_transactional)
 {
   DBUG_ENTER("MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)");
   DBUG_ASSERT(mysql_bin_log.is_open());
@@ -3819,52 +3926,34 @@ MYSQL_BIN_LOG::flush_and_set_pending_row
 
   int error= 0;
 
-  binlog_trx_data *const trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+  binlog_cache_data *const trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
 
   DBUG_ASSERT(trx_data);
 
-  DBUG_PRINT("info", ("trx_data->pending(): 0x%lx", (long) trx_data->pending()));
+  binlog_cache_mngr *cache_data= (is_transactional ?
+                          &trx_data->trx_cache : &trx_data->stmt_cache);
 
-  if (Rows_log_event* pending= trx_data->pending())
-  {
-    IO_CACHE *file= &log_file;
-
-    /*
-      Decide if we should write to the log file directly or to the
-      transaction log.
-    */
-    if (pending->get_cache_stmt() || my_b_tell(&trx_data->trans_log))
-      file= &trx_data->trans_log;
+  DBUG_PRINT("info", ("trx_data->pending(): 0x%lx", (long) cache_data->pending()));
 
-    /*
-      If we are writing to the log file directly, we could avoid
-      locking the log. This does not work since we need to step the
-      m_table_map_version below, and that change has to be protected
-      by the LOCK_log mutex.
-    */
-    pthread_mutex_lock(&LOCK_log);
+  if (Rows_log_event* pending= cache_data->pending())
+  {
+    IO_CACHE *file= &cache_data->cache_log;
 
     /*
-      Write pending event to log file or transaction cache
+      Write pending event to the cache.
     */
     if (pending->write(file))
-    {
-      pthread_mutex_unlock(&LOCK_log);
       DBUG_RETURN(1);
-    }
 
     /*
       We step the table map version if we are writing an event
-      representing the end of a statement.  We do this regardless of
-      wheather we write to the transaction cache or to directly to the
-      file.
-
-      In an ideal world, we could avoid stepping the table map version
-      if we were writing to a transaction cache, since we could then
-      reuse the table map that was written earlier in the transaction
-      cache.  This does not work since STMT_END_F implies closing all
-      table mappings on the slave side.
+      representing the end of a statement.  
+
+      In an ideal world, we could avoid stepping the table map version,
+      since we could then reuse the table map that was written earlier
+      in the cache. This does not work since STMT_END_F implies closing
+      all table mappings on the slave side.
 
       TODO: Find a solution so that table maps does not have to be
       written several times within a transaction.
@@ -3873,21 +3962,9 @@ MYSQL_BIN_LOG::flush_and_set_pending_row
       ++m_table_map_version;
 
     delete pending;
-
-    if (file == &log_file)
-    {
-      error= flush_and_sync();
-      if (!error)
-      {
-        signal_update();
-        rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
-      }
-    }
-
-    pthread_mutex_unlock(&LOCK_log);
   }
 
-  thd->binlog_set_pending_rows_event(event);
+  thd->binlog_set_pending_rows_event(event, is_transactional);
 
   DBUG_RETURN(error);
 }
@@ -3896,7 +3973,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_row
   Write an event to the binary log.
 */
 
-bool MYSQL_BIN_LOG::write(Log_event *event_info)
+bool MYSQL_BIN_LOG::write(Log_event *event_info, bool direct)
 {
   THD *thd= event_info->thd;
   bool error= 1;
@@ -3909,25 +3986,20 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
       We will log the function call to the binary log on function exit
     */
     thd->binlog_evt_union.unioned_events= TRUE;
-    thd->binlog_evt_union.unioned_events_trans |= event_info->cache_stmt;
+    thd->binlog_evt_union.unioned_events_trans |= 
+      event_info->is_trans_event();
     DBUG_RETURN(0);
   }
 
   /*
-    Flush the pending rows event to the transaction cache or to the
-    log file.  Since this function potentially aquire the LOCK_log
-    mutex, we do this before aquiring the LOCK_log mutex in this
-    function.
-
     We only end the statement if we are in a top-level statement.  If
     we are inside a stored function, we do not end the statement since
     this will close all tables on the slave.
   */
   bool const end_stmt=
     thd->prelocked_mode && thd->lex->requires_prelocking();
-  thd->binlog_flush_pending_rows_event(end_stmt);
-
-  pthread_mutex_lock(&LOCK_log);
+  thd->binlog_flush_pending_rows_event(end_stmt,
+                                       event_info->is_trans_event());
 
   /*
      In most cases this is only called if 'is_open()' is true; in fact this is
@@ -3936,7 +4008,6 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
   */
   if (likely(is_open()))
   {
-    IO_CACHE *file= &log_file;
 #ifdef HAVE_REPLICATION
     /*
       In the future we need to add to the following if tests like
@@ -3946,48 +4017,50 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
     const char *local_db= event_info->get_db();
     if ((thd && !(thd->options & OPTION_BIN_LOG)) ||
 	(!binlog_filter->db_ok(local_db)))
-    {
-      VOID(pthread_mutex_unlock(&LOCK_log));
       DBUG_RETURN(0);
-    }
 #endif /* HAVE_REPLICATION */
+    IO_CACHE *file= NULL;
 
-#if defined(USING_TRANSACTIONS) 
     /*
-      Should we write to the binlog cache or to the binlog on disk?
-      Write to the binlog cache if:
-      - it is already not empty (meaning we're in a transaction; note that the
-     present event could be about a non-transactional table, but still we need
-     to write to the binlog cache in that case to handle updates to mixed
-     trans/non-trans table types the best possible in binlogging)
-      - or if the event asks for it (cache_stmt == TRUE).
+      This is an ugly hacking that must be removed as soon as we fix a bug in
+      NDB. In a nutshell, this  means that we should use the binary log directly
+      if we are processing a DDL.
     */
-    if (opt_using_transactions && thd)
+
+    bool ddl=
+      (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
+       !thd->transaction.stmt.modified_non_trans_table &&
+       !thd->transaction.stmt.modified_trans_table &&
+       !thd->transaction.all.modified_non_trans_table &&
+       !thd->transaction.all.modified_trans_table &&
+       !event_info->is_trans_event());
+
+    direct= direct || ddl;
+
+    if (direct)
+    {
+      file= &log_file;
+      pthread_mutex_lock(&LOCK_log);
+    }
+    else
     {
-      if (thd->binlog_setup_trx_data())
+      thd->binlog_setup_trx_data();
         goto err;
 
-      binlog_trx_data *const trx_data=
-        (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
-      IO_CACHE *trans_log= &trx_data->trans_log;
-      my_off_t trans_log_pos= my_b_tell(trans_log);
-      if (event_info->get_cache_stmt() || trans_log_pos != 0)
-      {
-        DBUG_PRINT("info", ("Using trans_log: cache: %d, trans_log_pos: %lu",
-                            event_info->get_cache_stmt(),
-                            (ulong) trans_log_pos));
-        if (trans_log_pos == 0)
-          thd->binlog_start_trans_and_stmt();
-        file= trans_log;
-      }
-      /*
-        TODO as Mats suggested, for all the cases above where we write to
-        trans_log, it sounds unnecessary to lock LOCK_log. We should rather
-        test first if we want to write to trans_log, and if not, lock
-        LOCK_log.
-      */
+      binlog_cache_data *const trx_data=
+        (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
+
+      if (thd->current_stmt_binlog_row_based)
+        file= event_info->is_trans_event() ? &trx_data->trx_cache.cache_log :
+                                             &trx_data->stmt_cache.cache_log;
+      else if (trx_data->trx_cache.empty() && !event_info->is_trans_event())
+        file= &trx_data->stmt_cache.cache_log;
+      else
+        file= &trx_data->trx_cache.cache_log;
+   
+      thd->binlog_start_trans_and_stmt();
     }
-#endif /* USING_TRANSACTIONS */
+
     DBUG_PRINT("info",("event type: %d",event_info->get_type_code()));
 
     /*
@@ -4058,15 +4131,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
     if (event_info->write(file))
       goto err;
 
-    if (file == &log_file) // we are writing to the real log (disk)
-    {
-      if (flush_and_sync())
-	goto err;
-      signal_update();
-      rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
-    }
-    error=0;
-
+    error= 0;
 err:
     if (error)
     {
@@ -4076,12 +4141,24 @@ err:
 	my_error(ER_ERROR_ON_WRITE, MYF(0), name, errno);
       write_error=1;
     }
+    if (direct)
+    {
+      if (!error)
+      {
+        error= flush_and_sync();
+        if (!error)
+        {
+          signal_update();
+          rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
+        }
+      }
+      pthread_mutex_unlock(&LOCK_log);
+    }
   }
 
   if (event_info->flags & LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F)
     ++m_table_map_version;
 
-  pthread_mutex_unlock(&LOCK_log);
   DBUG_RETURN(error);
 }
 
@@ -4193,7 +4270,7 @@ uint MYSQL_BIN_LOG::next_file_id()
     write_cache()
     cache    Cache to write to the binary log
     lock_log True if the LOCK_log mutex should be aquired, false otherwise
-    sync_log True if the log should be flushed and sync:ed
+    sync_log True if the log should be flushed and synced
 
   DESCRIPTION
     Write the contents of the cache to the binary log. The cache will
@@ -4348,14 +4425,12 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
     'cache' needs to be reinitialized after this functions returns.
 */
 
-bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event)
+bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
+                          bool is_transactional)
 {
   DBUG_ENTER("MYSQL_BIN_LOG::write(THD *, IO_CACHE *, Log_event *)");
   VOID(pthread_mutex_lock(&LOCK_log));
 
-  /* NULL would represent nothing to replicate after ROLLBACK */
-  DBUG_ASSERT(commit_event != NULL);
-
   DBUG_ASSERT(is_open());
   if (likely(is_open()))                       // Should always be true
   {
@@ -4365,34 +4440,38 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_C
      */
     if (my_b_tell(cache) > 0)
     {
-      /*
-        Log "BEGIN" at the beginning of every transaction.  Here, a
-        transaction is either a BEGIN..COMMIT block or a single
-        statement in autocommit mode.
-      */
-      Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE);
-      /*
-        Imagine this is rollback due to net timeout, after all
-        statements of the transaction succeeded. Then we want a
-        zero-error code in BEGIN.  In other words, if there was a
-        really serious error code it's already in the statement's
-        events, there is no need to put it also in this internally
-        generated event, and as this event is generated late it would
-        lead to false alarms.
+      if (is_transactional)
+      {
+        /*
+          Log "BEGIN" at the beginning of every transaction.  Here, a
+          transaction is either a BEGIN..COMMIT block or a single
+          statement in autocommit mode.
+        */
+        Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), is_transactional,
+                              FALSE);
+        /*
+          Imagine this is rollback due to net timeout, after all
+          statements of the transaction succeeded. Then we want a
+          zero-error code in BEGIN.  In other words, if there was a
+          really serious error code it's already in the statement's
+          events, there is no need to put it also in this internally
+          generated event, and as this event is generated late it would
+          lead to false alarms.
 
-        This is safer than thd->clear_error() against kills at shutdown.
-      */
-      qinfo.error_code= 0;
-      /*
-        Now this Query_log_event has artificial log_pos 0. It must be
-        adjusted to reflect the real position in the log. Not doing it
-        would confuse the slave: it would prevent this one from
-        knowing where he is in the master's binlog, which would result
-        in wrong positions being shown to the user, MASTER_POS_WAIT
-        undue waiting etc.
-      */
-      if (qinfo.write(&log_file))
-        goto err;
+          This is safer than thd->clear_error() against kills at shutdown.
+        */
+        qinfo.error_code= 0;
+        /*
+          Now this Query_log_event has artificial log_pos 0. It must be
+          adjusted to reflect the real position in the log. Not doing it
+          would confuse the slave: it would prevent this one from
+          knowing where he is in the master's binlog, which would result
+          in wrong positions being shown to the user, MASTER_POS_WAIT
+          undue waiting etc.
+        */
+        if (qinfo.write(&log_file))
+          goto err;
+      }
 
       DBUG_EXECUTE_IF("crash_before_writing_xid",
                       {
@@ -5447,13 +5526,13 @@ int TC_LOG_BINLOG::log_xid(THD *thd, my_
 {
   DBUG_ENTER("TC_LOG_BINLOG::log");
   Xid_log_event xle(thd, xid);
-  binlog_trx_data *trx_data=
-    (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+  binlog_cache_data *trx_data=
+    (binlog_cache_data*) thd_get_ha_data(thd, binlog_hton);
   /*
     We always commit the entire transaction when writing an XID. Also
     note that the return value is inverted.
    */
-  DBUG_RETURN(!binlog_end_trans(thd, trx_data, &xle, TRUE));
+  DBUG_RETURN(!binlog_flush_trx_cache(thd, trx_data, &xle, TRUE));
 }
 
 void TC_LOG_BINLOG::unlog(ulong cookie, my_xid xid)

=== modified file 'sql/log.h'
--- a/sql/log.h	2009-01-23 12:22:05 +0000
+++ b/sql/log.h	2009-06-06 17:51:51 +0000
@@ -317,8 +317,9 @@ public:
   ulonglong table_map_version() const { return m_table_map_version; }
   void update_table_map_version() { ++m_table_map_version; }
 
-  int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event);
-  int remove_pending_rows_event(THD *thd);
+  int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event,
+                                       bool is_transactional);
+  int remove_pending_rows_event(THD *thd, bool is_transactional);
 
 #endif /* !defined(MYSQL_CLIENT) */
   void reset_bytes_written()
@@ -355,8 +356,9 @@ public:
   /* Use this to start writing a new log file */
   void new_file();
 
-  bool write(Log_event* event_info); // binary log write
-  bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event);
+  bool write(Log_event* event_info, bool direct= FALSE); // binary log write
+  bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event,
+             bool is_transactional);
 
   int  write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
 

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-05-15 13:03:22 +0000
+++ b/sql/log_event.cc	2009-06-06 17:51:51 +0000
@@ -636,7 +636,7 @@ Log_event::Log_event(THD* thd_arg, uint1
 {
   server_id=	thd->server_id;
   when=		thd->start_time;
-  cache_stmt=	using_trans;
+  is_transactional= using_trans;
 }
 
 
@@ -648,7 +648,7 @@ Log_event::Log_event(THD* thd_arg, uint1
 */
 
 Log_event::Log_event()
-  :temp_buf(0), exec_time(0), flags(0), cache_stmt(0),
+  :temp_buf(0), exec_time(0), flags(0), is_transactional(0),
    thd(0)
 {
   server_id=	::server_id;
@@ -668,7 +668,7 @@ Log_event::Log_event()
 
 Log_event::Log_event(const char* buf,
                      const Format_description_log_event* description_event)
-  :temp_buf(0), cache_stmt(0)
+  :temp_buf(0), is_transactional(0)
 {
 #ifndef MYSQL_CLIENT
   thd = 0;
@@ -7200,6 +7200,7 @@ int Rows_log_event::do_apply_event(Relay
       by mysql_reset_thd_for_next_command.
     */
     thd->transaction.stmt.modified_non_trans_table= FALSE;
+    thd->transaction.stmt.modified_trans_table= FALSE;
     /*
       Check if the slave is set to use SBR.  If so, it should switch
       to using RBR until the end of the "statement", i.e., next
@@ -7422,6 +7423,9 @@ int Rows_log_event::do_apply_event(Relay
       if (error == 0 && !transactional_table)
         thd->transaction.all.modified_non_trans_table=
           thd->transaction.stmt.modified_non_trans_table= TRUE;
+      else if (error == 0 && transactional_table)
+        thd->transaction.all.modified_trans_table=
+          thd->transaction.stmt.modified_trans_table= TRUE;
     } // row processing loop
 
     DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
@@ -7439,7 +7443,7 @@ int Rows_log_event::do_apply_event(Relay
       error= 0;
     }
 
-    if (!cache_stmt)
+    if (!is_transactional)
     {
       DBUG_PRINT("info", ("Marked that we need to keep log"));
       thd->options|= OPTION_KEEP_LOG;
@@ -7468,7 +7472,7 @@ int Rows_log_event::do_apply_event(Relay
     last_event_start_time here instead.
   */
   else if (table && (table->s->primary_key == MAX_KEY) &&
-           !cache_stmt && get_flags(STMT_END_F) == RLE_NO_FLAGS)
+           !is_transactional && get_flags(STMT_END_F) == RLE_NO_FLAGS)
   {
     /*
       ------------ Temporary fix until WL#2975 is implemented ---------
@@ -7536,7 +7540,7 @@ static int rows_event_stmt_cleanup(Relay
       (assume the last master's transaction is ignored by the slave because of
       replicate-ignore rules).
     */
-    thd->binlog_flush_pending_rows_event(true);
+    thd->binlog_flush_pending_rows_event(TRUE);
 
     /*
       If this event is not in a transaction, the call below will, if some
@@ -7793,7 +7797,7 @@ int Table_map_log_event::save_field_meta
 #if !defined(MYSQL_CLIENT)
 Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
                                          bool is_transactional, uint16 flags)
-  : Log_event(thd, 0, true),
+  : Log_event(thd, 0, is_transactional),
     m_table(tbl),
     m_dbnam(tbl->s->db.str),
     m_dblen(m_dbnam ? tbl->s->db.length : 0),

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	2009-04-08 23:42:51 +0000
+++ b/sql/log_event.h	2009-06-06 17:51:51 +0000
@@ -899,7 +899,7 @@ public:
   */
   uint16 flags;
 
-  bool cache_stmt;
+  bool is_transactional;
 
   /**
     A storage to cache the global system variable's value.
@@ -911,7 +911,7 @@ public:
   THD* thd;
 
   Log_event();
-  Log_event(THD* thd_arg, uint16 flags_arg, bool cache_stmt);
+  Log_event(THD* thd_arg, uint16 flags_arg, bool is_transactional);
   /*
     read_log_event() functions read an event from a binlog or relay
     log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the
@@ -1009,7 +1009,7 @@ public:
   void set_relay_log_event() { flags |= LOG_EVENT_RELAY_LOG_F; }
   bool is_artificial_event() const { return flags & LOG_EVENT_ARTIFICIAL_F; }
   bool is_relay_log_event() const { return flags & LOG_EVENT_RELAY_LOG_F; }
-  inline bool get_cache_stmt() const { return cache_stmt; }
+  inline bool is_trans_event() const { return is_transactional; }
   Log_event(const char* buf, const Format_description_log_event
             *description_event);
   virtual ~Log_event() { free_temp_buf();}
@@ -3308,10 +3308,10 @@ public:
     return new table_def(m_coltype, m_colcnt, m_field_metadata,
                          m_field_metadata_size, m_null_bits);
   }
+#endif
   ulong get_table_id() const        { return m_table_id; }
   const char *get_table_name() const { return m_tblnam; }
   const char *get_db_name() const    { return m_dbnam; }
-#endif
 
   virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }
   virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }

=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc	2009-02-13 16:41:47 +0000
+++ b/sql/log_event_old.cc	2009-06-06 17:51:51 +0000
@@ -229,7 +229,7 @@ Old_rows_log_event::do_apply_event(Old_r
     DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
                     const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
     error= do_after_row_operations(table, error);
-    if (!ev->cache_stmt)
+    if (!ev->is_transactional)
     {
       DBUG_PRINT("info", ("Marked that we need to keep log"));
       thd->options|= OPTION_KEEP_LOG;
@@ -275,7 +275,7 @@ Old_rows_log_event::do_apply_event(Old_r
     last_event_start_time here instead.
   */
   if (table && (table->s->primary_key == MAX_KEY) &&
-      !ev->cache_stmt && 
+      !ev->is_transactional && 
       ev->get_flags(Old_rows_log_event::STMT_END_F) == Old_rows_log_event::RLE_NO_FLAGS)
   {
     /*
@@ -1541,7 +1541,7 @@ int Old_rows_log_event::do_apply_event(R
         NOTE: For this new scheme there should be no pending event:
         need to add code to assert that is the case.
        */
-      thd->binlog_flush_pending_rows_event(false);
+      thd->binlog_flush_pending_rows_event(FALSE);
       TABLE_LIST *tables= rli->tables_to_lock;
       close_tables_for_reopen(thd, &tables);
 
@@ -1747,7 +1747,7 @@ int Old_rows_log_event::do_apply_event(R
     DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
                     const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
     error= do_after_row_operations(rli, error);
-    if (!cache_stmt)
+    if (!is_transactional)
     {
       DBUG_PRINT("info", ("Marked that we need to keep log"));
       thd->options|= OPTION_KEEP_LOG;
@@ -1793,7 +1793,7 @@ int Old_rows_log_event::do_apply_event(R
     last_event_start_time here instead.
   */
   if (table && (table->s->primary_key == MAX_KEY) &&
-      !cache_stmt && get_flags(STMT_END_F) == RLE_NO_FLAGS)
+      !is_transactional && get_flags(STMT_END_F) == RLE_NO_FLAGS)
   {
     /*
       ------------ Temporary fix until WL#2975 is implemented ---------
@@ -1858,7 +1858,7 @@ Old_rows_log_event::do_update_pos(Relay_
       (assume the last master's transaction is ignored by the slave because of
       replicate-ignore rules).
     */
-    thd->binlog_flush_pending_rows_event(true);
+    thd->binlog_flush_pending_rows_event(TRUE);
 
     /*
       If this event is not in a transaction, the call below will, if some

=== modified file 'sql/rpl_injector.cc'
--- a/sql/rpl_injector.cc	2008-02-19 11:43:01 +0000
+++ b/sql/rpl_injector.cc	2009-06-06 17:51:51 +0000
@@ -61,7 +61,7 @@ injector::transaction::~transaction()
 int injector::transaction::commit()
 {
    DBUG_ENTER("injector::transaction::commit()");
-   m_thd->binlog_flush_pending_rows_event(true);
+   m_thd->binlog_flush_pending_rows_event(TRUE);
    /*
      Cluster replication does not preserve statement or
      transaction boundaries of the master.  Instead, a new

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2009-05-15 12:57:51 +0000
+++ b/sql/set_var.cc	2009-06-06 17:51:51 +0000
@@ -3053,6 +3053,7 @@ static bool set_option_autocommit(THD *t
   /* The test is negative as the flag we use is NOT autocommit */
 
   ulonglong org_options= thd->options;
+  int error= 0;
 
   if (var->save_result.ulong_value != 0)
     thd->options&= ~((sys_var_thd_bit*) var->var)->bit_flag;
@@ -3065,18 +3066,20 @@ static bool set_option_autocommit(THD *t
     {
       /* We changed to auto_commit mode */
       thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG);
-      thd->transaction.all.modified_non_trans_table= FALSE;
+      thd->transaction.all.modified_non_trans_table= 
+        thd->transaction.all.modified_trans_table= FALSE;
       thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
-      if (ha_commit(thd))
-	return 1;
+      error= ha_commit(thd);
+      thd->server_status&= ~SERVER_STATUS_IN_TRANS;
     }
     else
     {
-      thd->transaction.all.modified_non_trans_table= FALSE;
+      thd->transaction.all.modified_non_trans_table= 
+        thd->transaction.all.modified_trans_table= FALSE;
       thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
     }
   }
-  return 0;
+  return error;
 }
 
 static int check_log_update(THD *thd, set_var *var)

=== modified file 'sql/sp.cc'
--- a/sql/sp.cc	2009-04-08 23:42:51 +0000
+++ b/sql/sp.cc	2009-06-06 17:51:51 +0000
@@ -941,7 +941,7 @@ sp_create_routine(THD *thd, int type, sp
       /* Such a statement can always go directly to binlog, no trans cache */
       thd->binlog_query(THD::MYSQL_QUERY_TYPE,
                         log_query.c_ptr(), log_query.length(),
-                        FALSE, FALSE, THD::NOT_KILLED);
+                        FALSE, FALSE, FALSE, THD::NOT_KILLED);
       thd->variables.sql_mode= 0;
     }
 

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2009-05-15 12:57:51 +0000
+++ b/sql/sp_head.cc	2009-06-06 17:51:51 +0000
@@ -355,12 +355,14 @@ sp_eval_expr(THD *thd, Field *result_fie
   enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
   bool save_abort_on_warning= thd->abort_on_warning;
   bool save_stmt_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
+  bool save_stmt_modified_trans_table= thd->transaction.stmt.modified_trans_table;
 
   thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
   thd->abort_on_warning=
     thd->variables.sql_mode &
     (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES);
-  thd->transaction.stmt.modified_non_trans_table= FALSE;
+  thd->transaction.stmt.modified_non_trans_table=
+    thd->transaction.stmt.modified_trans_table= FALSE;
 
   /* Save the value in the field. Convert the value if needed. */
 
@@ -369,6 +371,7 @@ sp_eval_expr(THD *thd, Field *result_fie
   thd->count_cuted_fields= save_count_cuted_fields;
   thd->abort_on_warning= save_abort_on_warning;
   thd->transaction.stmt.modified_non_trans_table= save_stmt_modified_non_trans_table;
+  thd->transaction.stmt.modified_trans_table= save_stmt_modified_trans_table;
 
   if (thd->is_error())
   {
@@ -2691,7 +2694,9 @@ sp_lex_keeper::reset_lex_and_exec_core(T
     It's merged with the saved parent's value at the exit of this func.
   */
   bool parent_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
-  thd->transaction.stmt.modified_non_trans_table= FALSE;
+  bool parent_modified_trans_table= thd->transaction.stmt.modified_trans_table;
+  thd->transaction.stmt.modified_non_trans_table= 
+    thd->transaction.stmt.modified_trans_table= FALSE;
   DBUG_ASSERT(!thd->derived_tables);
   DBUG_ASSERT(thd->change_list.is_empty());
   /*
@@ -2767,6 +2772,7 @@ sp_lex_keeper::reset_lex_and_exec_core(T
     what is needed from the substatement gained
   */
   thd->transaction.stmt.modified_non_trans_table |= parent_modified_non_trans_table;
+  thd->transaction.stmt.modified_trans_table |= parent_modified_trans_table;
   /*
     Unlike for PS we should not call Item's destructors for newly created
     items after execution of each instruction in stored routine. This is

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2009-05-25 13:00:18 +0000
+++ b/sql/sql_acl.cc	2009-06-06 17:51:51 +0000
@@ -1655,7 +1655,7 @@ bool change_password(THD *thd, const cha
                   new_password));
     thd->clear_error();
     thd->binlog_query(THD::MYSQL_QUERY_TYPE, buff, query_length,
-                      FALSE, FALSE, THD::NOT_KILLED);
+                      FALSE, FALSE, FALSE, THD::NOT_KILLED);
   }
 end:
   close_thread_tables(thd);

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2009-05-15 13:03:22 +0000
+++ b/sql/sql_base.cc	2009-06-06 17:51:51 +0000
@@ -1543,7 +1543,7 @@ void close_temporary_tables(THD *thd)
                             s_query.length() - 1 /* to remove trailing ',' */,
                             0, FALSE, THD::NOT_KILLED);
       thd->variables.character_set_client= cs_save;
-      mysql_bin_log.write(&qinfo);
+      mysql_bin_log.write(&qinfo, TRUE);
       thd->variables.pseudo_thread_id= save_pseudo_thread_id;
     }
     else
@@ -4017,7 +4017,7 @@ retry:
                       share->db.str,"`.`",share->table_name.str,"`", NullS);
         thd->binlog_query(THD::STMT_QUERY_TYPE,
                           query, (ulong)(end-query),
-                          FALSE, FALSE, THD::NOT_KILLED);
+                          FALSE, FALSE, FALSE, THD::NOT_KILLED);
         my_free(query, MYF(0));
       }
       else
@@ -5101,7 +5101,10 @@ int decide_logging_format(THD *thd, TABL
       HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE;
 
     my_bool multi_engine= FALSE;
-    void* prev_ht= NULL;
+    my_bool mixed_engine= FALSE;
+    my_bool trans_engine= TRUE;
+    TABLE* prev_write_table= NULL;
+    TABLE* prev_access_table= NULL;
     for (TABLE_LIST *table= tables; table; table= table->next_global)
     {
       if (table->placeholder())
@@ -5115,14 +5118,23 @@ int decide_logging_format(THD *thd, TABL
                             table->table_name,
                             FLAGSTR(flags, HA_BINLOG_STMT_CAPABLE),
                             FLAGSTR(flags, HA_BINLOG_ROW_CAPABLE)));
-        if (prev_ht && prev_ht != table->table->file->ht)
+        if (prev_write_table && prev_write_table->file->ht != table->table->file->ht)
           multi_engine= TRUE;
-        prev_ht= table->table->file->ht;
+        trans_engine= trans_engine && table->table->file->has_transactions();
+        prev_write_table= table->table;
         flags_all_set &= flags;
         flags_some_set |= flags;
       }
+      if (prev_access_table && prev_access_table->file->ht != table->table->file->ht)
+        mixed_engine= mixed_engine || (prev_access_table->file->has_transactions() !=
+                      table->table->file->has_transactions());
+      prev_access_table= table->table;
     }
 
+    if (mixed_engine ||
+        (thd->transaction.all.modified_trans_table && !trans_engine))
+      thd->lex->set_stmt_unsafe();
+
     DBUG_PRINT("info", ("flags_all_set: %s%s",
                         FLAGSTR(flags_all_set, HA_BINLOG_STMT_CAPABLE),
                         FLAGSTR(flags_all_set, HA_BINLOG_ROW_CAPABLE)));
@@ -5192,9 +5204,7 @@ int decide_logging_format(THD *thd, TABL
     */
     if (thd->lex->is_stmt_unsafe() ||
         (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
-    {
       thd->set_current_stmt_binlog_row_based_if_mixed();
-    }
   }
 
   return 0;

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2009-05-15 13:25:29 +0000
+++ b/sql/sql_class.cc	2009-06-06 17:51:51 +0000
@@ -777,7 +777,10 @@ void THD::init(void)
   else
     options &= ~OPTION_BIG_SELECTS;
 
-  transaction.all.modified_non_trans_table= transaction.stmt.modified_non_trans_table= FALSE;
+  transaction.all.modified_non_trans_table=
+    transaction.stmt.modified_non_trans_table= 
+    transaction.all.modified_trans_table=
+    transaction.stmt.modified_trans_table= FALSE;
   open_options=ha_open_options;
   update_lock_default= (variables.low_priority_updates ?
 			TL_WRITE_LOW_PRIORITY :
@@ -3197,7 +3200,7 @@ THD::binlog_prepare_pending_rows_event(T
   if (binlog_setup_trx_data())
     DBUG_RETURN(NULL);
 
-  Rows_log_event* pending= binlog_get_pending_rows_event();
+  Rows_log_event* pending= binlog_get_pending_rows_event(is_transactional);
 
   if (unlikely(pending && !pending->is_valid()))
     DBUG_RETURN(NULL);
@@ -3231,7 +3234,9 @@ THD::binlog_prepare_pending_rows_event(T
       flush the pending event and replace it with the newly created
       event...
     */
-    if (unlikely(mysql_bin_log.flush_and_set_pending_rows_event(this, ev)))
+    if (unlikely(
+        mysql_bin_log.flush_and_set_pending_rows_event(this, ev,
+                                                       is_transactional)))
     {
       delete ev;
       DBUG_RETURN(NULL);
@@ -3555,14 +3560,15 @@ int THD::binlog_delete_row(TABLE* table,
 }
 
 
-int THD::binlog_remove_pending_rows_event(bool clear_maps)
+int THD::binlog_remove_pending_rows_event(bool clear_maps,
+                                          bool is_transactional)
 {
   DBUG_ENTER("THD::binlog_remove_pending_rows_event");
 
   if (!mysql_bin_log.is_open())
     DBUG_RETURN(0);
 
-  mysql_bin_log.remove_pending_rows_event(this);
+  mysql_bin_log.remove_pending_rows_event(this, is_transactional);
 
   if (clear_maps)
     binlog_table_maps= 0;
@@ -3570,7 +3576,7 @@ int THD::binlog_remove_pending_rows_even
   DBUG_RETURN(0);
 }
 
-int THD::binlog_flush_pending_rows_event(bool stmt_end)
+int THD::binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional)
 {
   DBUG_ENTER("THD::binlog_flush_pending_rows_event");
   /*
@@ -3586,7 +3592,7 @@ int THD::binlog_flush_pending_rows_event
     flag is set.
   */
   int error= 0;
-  if (Rows_log_event *pending= binlog_get_pending_rows_event())
+  if (Rows_log_event *pending= binlog_get_pending_rows_event(is_transactional))
   {
     if (stmt_end)
     {
@@ -3595,7 +3601,8 @@ int THD::binlog_flush_pending_rows_event
       binlog_table_maps= 0;
     }
 
-    error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0);
+    error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0,
+                                                          is_transactional);
   }
 
   DBUG_RETURN(error);
@@ -3649,7 +3656,7 @@ show_query_type(THD::enum_binlog_query_t
 */
 int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
                       ulong query_len, bool is_trans, bool suppress_use,
-                      THD::killed_state killed_status_arg)
+                      bool direct, THD::killed_state killed_status_arg)
 {
   DBUG_ENTER("THD::binlog_query");
   DBUG_PRINT("enter", ("qtype: %s  query: '%s'",
@@ -3666,7 +3673,7 @@ int THD::binlog_query(THD::enum_binlog_q
     top-most close_thread_tables().
   */
   if (this->prelocked_mode == NON_PRELOCKED)
-    if (int error= binlog_flush_pending_rows_event(TRUE))
+    if (int error= binlog_flush_pending_rows_event(TRUE, is_trans))
       DBUG_RETURN(error);
 
   /*
@@ -3724,7 +3731,7 @@ int THD::binlog_query(THD::enum_binlog_q
         log event is written to the binary log, we pretend that no
         table maps were written.
        */
-      int error= mysql_bin_log.write(&qinfo);
+      int error= mysql_bin_log.write(&qinfo, direct);
       binlog_table_maps= 0;
       DBUG_RETURN(error);
     }

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2009-05-15 12:57:51 +0000
+++ b/sql/sql_class.h	2009-06-06 17:51:51 +0000
@@ -1390,10 +1390,15 @@ public:
                                       size_t needed,
                                       bool is_transactional,
 				      RowsEventT* hint);
-  Rows_log_event* binlog_get_pending_rows_event() const;
-  void            binlog_set_pending_rows_event(Rows_log_event* ev);
-  int binlog_flush_pending_rows_event(bool stmt_end);
-  int binlog_remove_pending_rows_event(bool clear_maps);
+  Rows_log_event* binlog_get_pending_rows_event(bool is_transactional) const;
+  void binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional);
+  inline int binlog_flush_pending_rows_event(bool stmt_end)
+  {
+    binlog_flush_pending_rows_event(stmt_end, FALSE);
+    binlog_flush_pending_rows_event(stmt_end, TRUE);
+  }
+  int binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional);
+  int binlog_remove_pending_rows_event(bool clear_maps, bool is_transactional);
 
 private:
   /*
@@ -1888,8 +1893,8 @@ public:
   
   int binlog_query(enum_binlog_query_type qtype,
                    char const *query, ulong query_len,
-                   bool is_trans, bool suppress_use,
-                   THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
+                   bool is_trans, bool suppress_use, bool direct,
+                   THD::killed_state killed_err_arg);
 #endif
 
   /*

=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc	2009-05-15 13:25:29 +0000
+++ b/sql/sql_delete.cc	2009-06-06 17:51:51 +0000
@@ -377,7 +377,11 @@ cleanup:
   transactional_table= table->file->has_transactions();
 
   if (!transactional_table && deleted > 0)
-    thd->transaction.stmt.modified_non_trans_table= TRUE;
+    thd->transaction.stmt.modified_non_trans_table=
+      thd->transaction.all.modified_non_trans_table= TRUE;
+  else if (transactional_table && deleted > 0)
+    thd->transaction.stmt.modified_trans_table=
+      thd->transaction.all.modified_trans_table= TRUE;
   
   /* See similar binlogging code in sql_update.cc, for comments */
   if ((error < 0) || thd->transaction.stmt.modified_non_trans_table)
@@ -402,16 +406,15 @@ cleanup:
       */
       int log_result= thd->binlog_query(query_type,
                                         thd->query, thd->query_length,
-                                        is_trans, FALSE, killed_status);
+                                        is_trans, FALSE, FALSE, killed_status);
 
       if (log_result && transactional_table)
       {
 	error=1;
       }
     }
-    if (thd->transaction.stmt.modified_non_trans_table)
-      thd->transaction.all.modified_non_trans_table= TRUE;
   }
+
   DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
   free_underlaid_joins(thd, select_lex);
   if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error))
@@ -756,6 +759,8 @@ bool multi_delete::send_data(List<Item> 
         deleted++;
         if (!table->file->has_transactions())
           thd->transaction.stmt.modified_non_trans_table= TRUE;
+        else
+          thd->transaction.stmt.modified_trans_table= TRUE;
         if (table->triggers &&
             table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
                                               TRG_ACTION_AFTER, FALSE))
@@ -809,6 +814,11 @@ void multi_delete::abort()
   if (deleted)
     query_cache_invalidate3(thd, delete_tables, 1);
 
+  if (thd->transaction.stmt.modified_non_trans_table)
+    thd->transaction.all.modified_non_trans_table= TRUE;
+  if (thd->transaction.stmt.modified_trans_table)
+    thd->transaction.all.modified_trans_table= TRUE;
+
   /*
     If rows from the first table only has been deleted and it is
     transactional, just do rollback.
@@ -838,10 +848,11 @@ void multi_delete::abort()
     {
       thd->binlog_query(THD::ROW_QUERY_TYPE,
                         thd->query, thd->query_length,
-                        transactional_tables, FALSE);
+                        transactional_tables, FALSE,
+                        FALSE, THD::KILLED_NO_VALUE);
     }
-    thd->transaction.all.modified_non_trans_table= true;
   }
+  
   DBUG_VOID_RETURN;
 }
 
@@ -936,6 +947,9 @@ int multi_delete::do_deletes()
     }
     if (last_deleted != deleted && !table->file->has_transactions())
       thd->transaction.stmt.modified_non_trans_table= TRUE;
+    else if (last_deleted != deleted && table->file->has_transactions())
+      thd->transaction.stmt.modified_trans_table= TRUE;
+
     end_read_record(&info);
     if (thd->killed && !local_error)
       local_error= 1;
@@ -967,6 +981,11 @@ bool multi_delete::send_eof()
   /* reset used flags */
   thd_proc_info(thd, "end");
 
+  if (thd->transaction.stmt.modified_non_trans_table)
+    thd->transaction.all.modified_non_trans_table= TRUE;
+  if (thd->transaction.stmt.modified_trans_table)
+    thd->transaction.all.modified_trans_table= TRUE;
+
   /*
     We must invalidate the query cache before binlog writing and
     ha_autocommit_...
@@ -983,15 +1002,15 @@ bool multi_delete::send_eof()
         thd->clear_error();
       if (thd->binlog_query(THD::ROW_QUERY_TYPE,
                             thd->query, thd->query_length,
-                            transactional_tables, FALSE, killed_status) &&
+                            transactional_tables, FALSE,
+                            FALSE, killed_status) &&
           !normal_tables)
       {
 	local_error=1;  // Log write failed: roll back the SQL statement
       }
     }
-    if (thd->transaction.stmt.modified_non_trans_table)
-      thd->transaction.all.modified_non_trans_table= TRUE;
   }
+
   if (local_error != 0)
     error_handled= TRUE; // to force early leave from ::send_error()
 

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2009-05-15 12:57:51 +0000
+++ b/sql/sql_insert.cc	2009-06-06 17:51:51 +0000
@@ -858,6 +858,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
       */
       query_cache_invalidate3(thd, table_list, 1);
     }
+
+    if (thd->transaction.stmt.modified_non_trans_table)
+      thd->transaction.all.modified_non_trans_table= TRUE;
+    if (thd->transaction.stmt.modified_trans_table)
+	thd->transaction.all.modified_trans_table= TRUE;
+
     if (changed && error <= 0 || thd->transaction.stmt.modified_non_trans_table
 	|| was_insert_delayed)
     {
@@ -892,15 +898,13 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
 	DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0);
 	if (thd->binlog_query(THD::ROW_QUERY_TYPE,
 			      thd->query, thd->query_length,
-			      transactional_table, FALSE,
+			      transactional_table, FALSE, FALSE,
 			      (error>0) ? thd->killed : THD::NOT_KILLED) &&
 	    transactional_table)
         {
 	  error=1;
 	}
       }
-      if (thd->transaction.stmt.modified_non_trans_table)
-	thd->transaction.all.modified_non_trans_table= TRUE;
     }
     DBUG_ASSERT(transactional_table || !changed || 
                 thd->transaction.stmt.modified_non_trans_table);
@@ -1519,6 +1523,8 @@ int write_record(THD *thd, TABLE *table,
           info->deleted++;
           if (!table->file->has_transactions())
             thd->transaction.stmt.modified_non_trans_table= TRUE;
+          else
+            thd->transaction.stmt.modified_trans_table= TRUE;
           if (table->triggers &&
               table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
                                                 TRG_ACTION_AFTER, TRUE))
@@ -1571,6 +1577,8 @@ ok_or_after_trg_err:
     my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
   if (!table->file->has_transactions())
     thd->transaction.stmt.modified_non_trans_table= TRUE;
+  else
+    thd->transaction.stmt.modified_trans_table= TRUE;
   DBUG_RETURN(trg_error);
 
 err:
@@ -2531,6 +2539,7 @@ bool Delayed_insert::handle_inserts(void
 {
   int error;
   ulong max_rows;
+  bool has_trans = TRUE;
   bool using_ignore= 0, using_opt_replace= 0,
        using_bin_log= mysql_bin_log.is_open();
   delayed_row *row;
@@ -2667,17 +2676,10 @@ bool Delayed_insert::handle_inserts(void
         thd.variables.time_zone = row->time_zone;
       }
 
-      /*
-        If the query has several rows to insert, only the first row will come
-        here. In row-based binlogging, this means that the first row will be
-        written to binlog as one Table_map event and one Rows event (due to an
-        event flush done in binlog_query()), then all other rows of this query
-        will be binlogged together as one single Table_map event and one
-        single Rows event.
-      */
       thd.binlog_query(THD::ROW_QUERY_TYPE,
                        row->query.str, row->query.length,
-                       FALSE, FALSE);
+                       FALSE, FALSE,
+                       FALSE, THD::KILLED_NO_VALUE);
 
       thd.time_zone_used = backup_time_zone_used;
       thd.variables.time_zone = backup_time_zone;
@@ -2746,8 +2748,10 @@ bool Delayed_insert::handle_inserts(void
 
     TODO: Move the logging to last in the sequence of rows.
    */
+  has_trans= thd.lex->sql_command == SQLCOM_CREATE_TABLE ||
+                        table->file->has_transactions();
   if (thd.current_stmt_binlog_row_based)
-    thd.binlog_flush_pending_rows_event(TRUE);
+    thd.binlog_flush_pending_rows_event(TRUE, has_trans);
 
   if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
   {						// This shouldn't happen
@@ -3180,9 +3184,13 @@ bool select_insert::send_eof()
       and ha_autocommit_or_rollback.
     */
     query_cache_invalidate3(thd, table, 1);
-    if (thd->transaction.stmt.modified_non_trans_table)
-      thd->transaction.all.modified_non_trans_table= TRUE;
   }
+
+  if (thd->transaction.stmt.modified_non_trans_table)
+    thd->transaction.all.modified_non_trans_table= TRUE;
+  if (thd->transaction.stmt.modified_trans_table)
+    thd->transaction.all.modified_trans_table= TRUE;
+
   DBUG_ASSERT(trans_table || !changed || 
               thd->transaction.stmt.modified_non_trans_table);
 
@@ -3198,7 +3206,7 @@ bool select_insert::send_eof()
       thd->clear_error();
     thd->binlog_query(THD::ROW_QUERY_TYPE,
                       thd->query, thd->query_length,
-                      trans_table, FALSE, killed_status);
+                      trans_table, FALSE, FALSE, killed_status);
   }
   table->file->ha_release_auto_increment();
 
@@ -3266,12 +3274,18 @@ void select_insert::abort() {
     {
         if (mysql_bin_log.is_open())
           thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
-                            transactional_table, FALSE);
+                            transactional_table, FALSE,
+                            FALSE, THD::KILLED_NO_VALUE);
+        /*
+          Alfranio: I am not sure which is the intention of the code below.
+        */
         if (!thd->current_stmt_binlog_row_based && !can_rollback_data())
           thd->transaction.all.modified_non_trans_table= TRUE;
+
 	if (changed)
 	  query_cache_invalidate3(thd, table, 1);
     }
+    
     DBUG_ASSERT(transactional_table || !changed ||
 		thd->transaction.stmt.modified_non_trans_table);
     table->file->ha_release_auto_increment();
@@ -3661,7 +3675,8 @@ select_create::binlog_show_create_table(
     thd->binlog_query(THD::STMT_QUERY_TYPE,
                       query.ptr(), query.length(),
                       /* is_trans */ TRUE,
-                      /* suppress_use */ FALSE);
+                      /* suppress_use */ FALSE,
+                      FALSE, THD::KILLED_NO_VALUE);
 }
 
 void select_create::store_values(List<Item> &values)
@@ -3758,8 +3773,9 @@ void select_create::abort()
   tmp_disable_binlog(thd);
   select_insert::abort();
   thd->transaction.stmt.modified_non_trans_table= FALSE;
+  thd->transaction.stmt.modified_trans_table= TRUE;
   reenable_binlog(thd);
-  thd->binlog_flush_pending_rows_event(TRUE);
+  thd->binlog_flush_pending_rows_event(TRUE, TRUE);
 
   if (m_plock)
   {

=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc	2009-03-17 20:29:24 +0000
+++ b/sql/sql_load.cc	2009-06-06 17:51:51 +0000
@@ -505,6 +505,8 @@ int mysql_load(THD *thd,sql_exchange *ex
 
   if (thd->transaction.stmt.modified_non_trans_table)
     thd->transaction.all.modified_non_trans_table= TRUE;
+  if (thd->transaction.stmt.modified_trans_table)
+    thd->transaction.all.modified_trans_table= TRUE;
 #ifndef EMBEDDED_LIBRARY
   if (mysql_bin_log.is_open())
   {
@@ -517,7 +519,7 @@ int mysql_load(THD *thd,sql_exchange *ex
       after this point.
      */
     if (thd->current_stmt_binlog_row_based)
-      thd->binlog_flush_pending_rows_event(true);
+      thd->binlog_flush_pending_rows_event(TRUE, transactional_table);
     else
     {
       /*

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-05-15 13:40:09 +0000
+++ b/sql/sql_parse.cc	2009-06-06 17:51:51 +0000
@@ -118,14 +118,15 @@ static bool xa_trans_rolled_back(XID_STA
 }
 
 /**
-  Rollback work done on behalf of at ransaction branch.
+  Rollback work done on behalf of at transaction branch.
 */
 static bool xa_trans_rollback(THD *thd)
 {
   bool status= test(ha_rollback(thd));
 
   thd->options&= ~(ulong) OPTION_BEGIN;
-  thd->transaction.all.modified_non_trans_table= FALSE;
+  thd->transaction.all.modified_non_trans_table= 
+    thd->transaction.all.modified_trans_table= FALSE;
   thd->server_status&= ~SERVER_STATUS_IN_TRANS;
   xid_cache_delete(&thd->transaction.xid_state);
   thd->transaction.xid_state.xa_state= XA_NOTR;
@@ -172,7 +173,8 @@ bool end_active_trans(THD *thd)
       error=1;
   }
   thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
-  thd->transaction.all.modified_non_trans_table= FALSE;
+  thd->transaction.all.modified_non_trans_table=
+    thd->transaction.all.modified_trans_table= FALSE;
   DBUG_RETURN(error);
 }
 
@@ -710,7 +712,8 @@ int end_trans(THD *thd, enum enum_mysql_
     thd->server_status&= ~SERVER_STATUS_IN_TRANS;
     res= ha_commit(thd);
     thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
-    thd->transaction.all.modified_non_trans_table= FALSE;
+    thd->transaction.all.modified_non_trans_table=
+      thd->transaction.all.modified_trans_table= FALSE;
     break;
   case COMMIT_RELEASE:
     do_release= 1; /* fall through */
@@ -728,7 +731,8 @@ int end_trans(THD *thd, enum enum_mysql_
     if (ha_rollback(thd))
       res= -1;
     thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
-    thd->transaction.all.modified_non_trans_table= FALSE;
+    thd->transaction.all.modified_non_trans_table=
+      thd->transaction.all.modified_trans_table= FALSE;
     if (!res && (completion == ROLLBACK_AND_CHAIN))
       res= begin_trans(thd);
     break;
@@ -3117,7 +3121,7 @@ end_with_restore_list:
       if (incident)
       {
         Incident_log_event ev(thd, incident);
-        mysql_bin_log.write(&ev);
+        mysql_bin_log.write(&ev, TRUE);
         mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE);
       }
       DBUG_PRINT("debug", ("Just after generate_incident()"));
@@ -4679,7 +4683,8 @@ create_sp_error:
     thd->transaction.xid_state.rm_error= 0;
     thd->transaction.xid_state.xid.set(thd->lex->xid);
     xid_cache_insert(&thd->transaction.xid_state);
-    thd->transaction.all.modified_non_trans_table= FALSE;
+    thd->transaction.all.modified_non_trans_table=
+      thd->transaction.all.modified_trans_table= FALSE;
     thd->options= ((thd->options & ~(OPTION_KEEP_LOG)) | OPTION_BEGIN);
     thd->server_status|= SERVER_STATUS_IN_TRANS;
     my_ok(thd);
@@ -4787,7 +4792,8 @@ create_sp_error:
       break;
     }
     thd->options&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
-    thd->transaction.all.modified_non_trans_table= FALSE;
+    thd->transaction.all.modified_non_trans_table=
+      thd->transaction.all.modified_trans_table= FALSE;
     thd->server_status&= ~SERVER_STATUS_IN_TRANS;
     xid_cache_delete(&thd->transaction.xid_state);
     thd->transaction.xid_state.xa_state=XA_NOTR;
@@ -5650,7 +5656,8 @@ void mysql_reset_thd_for_next_command(TH
   if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
   {
     thd->options&= ~OPTION_KEEP_LOG;
-    thd->transaction.all.modified_non_trans_table= FALSE;
+    thd->transaction.all.modified_non_trans_table=
+      thd->transaction.all.modified_trans_table= FALSE;
   }
   DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
   thd->thread_specific_used= FALSE;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2009-05-19 04:25:36 +0000
+++ b/sql/sql_table.cc	2009-06-06 17:51:51 +0000
@@ -1463,7 +1463,8 @@ void write_bin_log(THD *thd, bool clear_
     if (clear_error)
       thd->clear_error();
     thd->binlog_query(THD::STMT_QUERY_TYPE,
-                      query, query_length, FALSE, FALSE, THD::NOT_KILLED);
+                      query, query_length, FALSE, FALSE, 
+                      FALSE, THD::NOT_KILLED);
   }
 }
 

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2009-05-15 13:03:22 +0000
+++ b/sql/sql_update.cc	2009-06-06 17:51:51 +0000
@@ -767,6 +767,8 @@ int mysql_update(THD *thd,
 
   if (!transactional_table && updated > 0)
     thd->transaction.stmt.modified_non_trans_table= TRUE;
+  else if (transactional_table && updated > 0)
+    thd->transaction.stmt.modified_trans_table= TRUE;
 
   end_read_record(&info);
   delete select;
@@ -781,6 +783,11 @@ int mysql_update(THD *thd,
   {
     query_cache_invalidate3(thd, table_list, 1);
   }
+  
+  if (thd->transaction.stmt.modified_non_trans_table)
+      thd->transaction.all.modified_non_trans_table= TRUE;
+  if (thd->transaction.stmt.modified_trans_table)
+    thd->transaction.all.modified_trans_table= TRUE;
 
   /*
     error < 0 means really no error at all: we processed all rows until the
@@ -799,15 +806,15 @@ int mysql_update(THD *thd,
         thd->clear_error();
       if (thd->binlog_query(THD::ROW_QUERY_TYPE,
                             thd->query, thd->query_length,
-                            transactional_table, FALSE, killed_status) &&
+                            transactional_table, FALSE, 
+                            FALSE, killed_status) &&
           transactional_table)
       {
         error=1;				// Rollback update
       }
     }
-    if (thd->transaction.stmt.modified_non_trans_table)
-      thd->transaction.all.modified_non_trans_table= TRUE;
   }
+
   DBUG_ASSERT(transactional_table || !updated || thd->transaction.stmt.modified_non_trans_table);
   free_underlaid_joins(thd, select_lex);
 
@@ -1737,7 +1744,10 @@ bool multi_update::send_data(List<Item> 
           /* non-transactional or transactional table got modified   */
           /* either multi_update class' flag is raised in its branch */
           if (table->file->has_transactions())
+          {
             transactional_tables= 1;
+            thd->transaction.stmt.modified_trans_table= TRUE;
+          }
           else
           {
             trans_safe= 0;
@@ -1849,10 +1859,15 @@ void multi_update::abort()
       */
       thd->binlog_query(THD::ROW_QUERY_TYPE,
                         thd->query, thd->query_length,
-                        transactional_tables, FALSE);
+                        transactional_tables, FALSE,
+                        FALSE, THD::KILLED_NO_VALUE);
     }
     thd->transaction.all.modified_non_trans_table= TRUE;
   }
+ 
+  if (thd->transaction.stmt.modified_trans_table)
+    thd->transaction.all.modified_trans_table= TRUE;
+
   DBUG_ASSERT(trans_safe || !updated || thd->transaction.stmt.modified_non_trans_table);
 }
 
@@ -1987,7 +2002,10 @@ int multi_update::do_updates()
     if (updated != org_updated)
     {
       if (table->file->has_transactions())
+      {
         transactional_tables= 1;
+        thd->transaction.stmt.modified_trans_table= TRUE;
+      }
       else
       {
         trans_safe= 0;				// Can't do safe rollback
@@ -2020,7 +2038,10 @@ err2:
   if (updated != org_updated)
   {
     if (table->file->has_transactions())
+    {
       transactional_tables= 1;
+      thd->transaction.stmt.modified_trans_table= TRUE;
+    }
     else
     {
       trans_safe= 0;
@@ -2069,8 +2090,11 @@ bool multi_update::send_eof()
     either from the query's list or via a stored routine: bug#13270,23333
   */
 
-  DBUG_ASSERT(trans_safe || !updated || 
-              thd->transaction.stmt.modified_non_trans_table);
+  if (thd->transaction.stmt.modified_non_trans_table)
+    thd->transaction.all.modified_non_trans_table= TRUE;
+  if (thd->transaction.stmt.modified_trans_table)
+    thd->transaction.all.modified_trans_table= TRUE;
+
   if (local_error == 0 || thd->transaction.stmt.modified_non_trans_table)
   {
     if (mysql_bin_log.is_open())
@@ -2079,15 +2103,18 @@ bool multi_update::send_eof()
         thd->clear_error();
       if (thd->binlog_query(THD::ROW_QUERY_TYPE,
                             thd->query, thd->query_length,
-                            transactional_tables, FALSE, killed_status) &&
+                            transactional_tables, FALSE, 
+                            FALSE, killed_status) &&
           trans_safe)
       {
 	local_error= 1;				// Rollback update
       }
     }
-    if (thd->transaction.stmt.modified_non_trans_table)
-      thd->transaction.all.modified_non_trans_table= TRUE;
   }
+
+  DBUG_ASSERT(trans_safe || !updated || 
+              thd->transaction.stmt.modified_non_trans_table);
+
   if (local_error != 0)
     error_handled= TRUE; // to force early leave from ::send_error()
 

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2009-05-15 12:57:51 +0000
+++ b/sql/sql_view.cc	2009-06-06 17:51:51 +0000
@@ -662,7 +662,8 @@ bool mysql_create_view(THD *thd, TABLE_L
     buff.append(views->source.str, views->source.length);
 
     thd->binlog_query(THD::STMT_QUERY_TYPE,
-                      buff.ptr(), buff.length(), FALSE, FALSE, THD::NOT_KILLED);
+                      buff.ptr(), buff.length(), FALSE, FALSE, 
+                      FALSE, THD::NOT_KILLED);
   }
 
   VOID(pthread_mutex_unlock(&LOCK_open));


Attachment: [text/bzr-bundle]
Thread
bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Alfranio Correia6 Jun
  • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Luís Soares17 Jun
    • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Alfranio Correia17 Jun
      • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Luís Soares18 Jun
        • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Alfranio Correia16 Aug
  • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687He Zhenxing29 Jun
    • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Alfranio Correia12 Aug
      • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687He Zhenxing13 Aug
        • Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Alfranio Correia16 Aug
Re: bzr commit into mysql-5.1-bugteam branch (alfranio.correia:2911)WL#2687Alfranio Correia18 Jun