List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:March 26 2008 2:07pm
Subject:Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020
View as plain text  
Mats, hello.


I have agreed with many ideas this patch implemented.
As this work is big enough so that it's naturally for me to have some
questions.

> Below is the list of changes that have just been committed into a local
> 5.1 repository of mats.  When mats does a push these changes
> will be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>
> ChangeSet@stripped, 2008-03-25 10:39:27+01:00, mats@mats-laptop.(none) +29 -0
>   BUG#29020 (Event results not correctly replicated to slave in RBR):
>   

Could you please state what is the problem of the bug.
My version: it's lack of atomicity in binlogging the Table map and subjected
to the event ordinary Rows_log_events.

>   Bug is fixed by writing non-transactional events to the transaction cache and
>   flushing the cache to the binary log at statement commit. To mimic the behavior
>   of normal statement-based replication, we flush the transaction cache in row-
>   based mode when there is no committed statements in the transaction cache,
>   which means we are committing the first one. This means that it will be written
>   to the binary log as a "mini-transaction" with just the rows for the statement.


As we talked about limitations on #rep yestarday I think you need to
add here that the bug scenario will be possible if the server is
compliled w/o transactional support.

I think you need to mention some facts about user visible behavior
like possible appearence of redundant COMMIT/ROLLBACK in binlog
(discussed further).


>
>   mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test@stripped, 2008-03-25 10:39:21+01:00,
> mats@mats-laptop.(none) +0 -1
>     Removing SHOW BINLOG EVENTS causing test to be non-deterministic.
>
>   mysql-test/suite/binlog/r/binlog_multi_engine.result@stripped, 2008-03-25
> 10:39:21+01:00, mats@mats-laptop.(none) +2 -0
>     Result file change.
>
>   mysql-test/suite/binlog/r/binlog_row_binlog.result@stripped, 2008-03-25 10:39:21+01:00,
> mats@mats-laptop.(none) +27 -3
>     Result file change.
>
>   mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result@stripped, 2008-03-25
> 10:39:21+01:00, mats@mats-laptop.(none) +13 -0
>     Result file change.
>
>   mysql-test/suite/binlog/r/binlog_row_insert_select.result@stripped, 2008-03-25
> 10:39:21+01:00, mats@mats-laptop.(none) +2 -0
>     Result file change.
>
>   mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result@stripped, 2008-03-25
> 10:39:22+01:00, mats@mats-laptop.(none) +35 -3
>     Result file change.
>
>   mysql-test/suite/binlog/r/binlog_stm_binlog.result@stripped, 2008-03-25 10:39:22+01:00,
> mats@mats-laptop.(none) +6 -0
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result@stripped, 2008-03-25 10:39:22+01:00,
> mats@mats-laptop.(none) +6 -2
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result@stripped, 2008-03-25 10:39:22+01:00,
> mats@mats-laptop.(none) +6 -2
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_create_table.result@stripped, 2008-03-25 10:39:22+01:00,
> mats@mats-laptop.(none) +53 -46
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_delayed_ins.result@stripped, 2008-03-25 10:39:22+01:00,
> mats@mats-laptop.(none) +0 -10
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result@stripped, 2008-03-25 10:39:22+01:00,
> mats@mats-laptop.(none) +2 -2
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result@stripped, 2008-03-25 10:39:22+01:00,
> mats@mats-laptop.(none) +2 -2
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_log.result@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +26 -8
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_log_innodb.result@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +7 -5
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_row_until.result@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +10 -10
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_slave_skip.result@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +10 -4
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result@stripped, 2008-03-25
> 10:39:23+01:00, mats@mats-laptop.(none) +0 -668
>     Result file change.
>
>   mysql-test/suite/rpl/r/rpl_truncate_2myisam.result@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +6 -0
>     Result file change.
>
>   mysql-test/suite/rpl/t/rpl_row_create_table.test@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +3 -3
>     Binlog position change.
>
>   mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +1 -1
>     Binlog position change.
>
>   mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test@stripped, 2008-03-25 10:39:23+01:00,
> mats@mats-laptop.(none) +11 -6
>     Binlog position change. Added stop position to mysqlbinlog argments to prevent
>     extreneous output.
>
>   mysql-test/suite/rpl/t/rpl_row_until.test@stripped, 2008-03-25 10:39:24+01:00,
> mats@mats-laptop.(none) +1 -1
>     Binlog position change.
>
>   mysql-test/suite/rpl/t/rpl_slave_skip.test@stripped, 2008-03-25 10:39:24+01:00,
> mats@mats-laptop.(none) +1 -1
>     Binlog position change.
>
>   mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test@stripped, 2008-03-25
> 10:39:24+01:00, mats@mats-laptop.(none) +1 -3
>     Removing extreneous SHOW BINLOG EVENTS causing test to be non-deterministic.
>
>   sql/log.cc@stripped, 2008-03-25 10:39:24+01:00, mats@mats-laptop.(none) +104 -40
>     Adding variable at_least_one_stmt to denote that there is at least one
>     statement committed to the transaction cache (but there might be more).
>     
>     Removing duplicate checks from binlog_end_trans(). The transaction cache
>     should always be committed or rolled back when this function is called.
>     
>     Correcting conditions for binlog_rollback() and binlog_commit() and removing
>     the previous "invisible commit" in favor of always using explicit commits
>     in the binary log.
>
>   sql/log_event.cc@stripped, 2008-03-25 10:39:24+01:00, mats@mats-laptop.(none) +1 -1
>     Marking table map event to be cached.
>
>   sql/sql_insert.cc@stripped, 2008-03-25 10:39:25+01:00, mats@mats-laptop.(none) +6 -6
>     Adding missing call to ha_autocommit_or_rollback() for delayed thread. Marking
>     CREATE-SELECT statements as transactional, since they don't need to be logged.
>
>   sql/sql_load.cc@stripped, 2008-03-25 10:39:25+01:00, mats@mats-laptop.(none) +1 -0
>     Adding missing ha_autocommit_or_rollback() to mysql_load().
>
> diff -Nrup a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
> b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
> --- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test	2007-03-30 10:26:59 +02:00
> +++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test	2008-03-25 10:39:21 +01:00
> @@ -15,7 +15,6 @@ SELECT * FROM t1 ORDER BY a;
>  sync_slave_with_master;
>  
>  connection master;
> -source include/show_binlog_events.inc;
>  sync_slave_with_master;
>  SELECT * FROM t1 ORDER BY a;
>  connection master;
> diff -Nrup a/mysql-test/suite/binlog/r/binlog_multi_engine.result
> b/mysql-test/suite/binlog/r/binlog_multi_engine.result
> --- a/mysql-test/suite/binlog/r/binlog_multi_engine.result	2008-02-28 22:50:05
> +01:00
> +++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result	2008-03-25 10:39:21
> +01:00
> @@ -78,8 +78,10 @@ UPDATE t1n, t1b SET e = 2, b = 3 WHERE f
>  ERROR HY000: Binary logging not possible. Message: Row-based format required for
> this statement, but not allowed by this combination of engines
>  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.t1m)
>  master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>  master-bin.000001	#	Query	#	#	BEGIN
>  master-bin.000001	#	Table_map	#	#	table_id: # (test.t1n)
>  master-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
> diff -Nrup a/mysql-test/suite/binlog/r/binlog_row_binlog.result
> b/mysql-test/suite/binlog/r/binlog_row_binlog.result
> --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result	2008-02-08 16:55:01 +01:00
> +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result	2008-03-25 10:39:21 +01:00
> @@ -1085,9 +1085,11 @@ 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	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
> +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
>  End of 5.0 tests
>  reset master;
>  create table t1 (id tinyint auto_increment primary key);
> @@ -1111,8 +1113,10 @@ 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
> @@ -1123,12 +1127,18 @@ 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;
>  set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
> @@ -1138,8 +1148,10 @@ insert delayed into t1 values (300);
>  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
> @@ -1150,20 +1162,32 @@ 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
>  insert delayed into t1 values (null),(null),(null),(null);
>  insert delayed into t1 values (null),(null),(400),(null);
>  11 == 11
> diff -Nrup a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
> b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
> --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result	2007-06-27 14:27:31
> +02:00
> +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result	2008-03-25 10:39:21
> +01:00
> @@ -5,13 +5,26 @@ 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.foreign_key_checks=1, @@session.sql_auto_is_null=1,
> @@session.unique_checks=1/*!*/;
> +SET @@session.sql_mode=0/*!*/;
> +/*!\C latin1 *//*!*/;
> +SET
> @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
> +BEGIN
> +/*!*/;
> +SET TIMESTAMP=10000/*!*/;
> +COMMIT
> +/*!*/;
>  DELIMITER ;
>  # End of log file
>  ROLLBACK /* added by mysqlbinlog */;
> diff -Nrup a/mysql-test/suite/binlog/r/binlog_row_insert_select.result
> b/mysql-test/suite/binlog/r/binlog_row_insert_select.result
> --- a/mysql-test/suite/binlog/r/binlog_row_insert_select.result	2007-06-27 14:27:24
> +02:00
> +++ b/mysql-test/suite/binlog/r/binlog_row_insert_select.result	2008-03-25 10:39:21
> +01:00
> @@ -8,8 +8,10 @@ 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
> diff -Nrup a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
> b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
> --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2008-03-05
> 13:59:21 +01:00
> +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2008-03-25
> 10:39:22 +01:00
> @@ -117,8 +117,10 @@ 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;
> @@ -131,8 +133,10 @@ 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
>  insert into t1 values(11);
>  commit;
>  show binlog events from <binlog_start>;
> @@ -141,8 +145,10 @@ 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
>  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
> @@ -272,14 +278,20 @@ 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
>  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;
> @@ -362,38 +374,52 @@ 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`; COMMIT
>  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`; BEGIN
>  master-bin.000001	#	Query	#	#	use `test`; TRUNCATE table t2
>  master-bin.000001	#	Xid	#	#	COMMIT /* XID */
> -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	#	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	#	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`; 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	#	Query	#	#	use `test`; TRUNCATE table t2
>  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`; DROP TABLE `t1` /* generated by server */
>  reset master;
>  create table t1 (a int) engine=innodb;
> @@ -489,9 +515,11 @@ 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(*)
> @@ -506,9 +534,11 @@ 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(*)
> @@ -564,11 +594,13 @@ 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(*)
> diff -Nrup a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
> b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
> --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2008-02-08 13:47:22 +01:00
> +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2008-03-25 10:39:22 +01:00
> @@ -648,12 +648,18 @@ 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
>  insert delayed into t1 values (null),(null),(null),(null);
>  insert delayed into t1 values (null),(null),(400),(null);
>  11 == 11
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
> b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
> --- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2007-08-21 14:32:26 +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2008-03-25 10:39:22 +01:00
> @@ -18,8 +18,10 @@ 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	#
> @@ -28,7 +30,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000001
> -Read_Master_Log_Pos	457
> +Read_Master_Log_Pos	594
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000001
> @@ -43,7 +45,7 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	0
>  Last_Error	
>  Skip_Counter	0
> -Exec_Master_Log_Pos	457
> +Exec_Master_Log_Pos	594
>  Relay_Log_Space	#
>  Until_Condition	None
>  Until_Log_File	
> @@ -66,6 +68,8 @@ slave-bin.000001	#	Format_desc	2	#	Serve
>  slave-bin.000001	#	Query	2	#	use `test`; drop table if exists
> t1,t2,t3,t4,t5,t6,t7,t8,t9
>  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	#	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	#	COMMIT
>  DROP TABLE IF EXISTS t1;
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
> b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
> --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result	2007-12-12 11:14:49 +01:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result	2008-03-25 10:39:22 +01:00
> @@ -27,8 +27,10 @@ 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
> @@ -56,8 +58,10 @@ 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	Table_map	1	233	table_id: # (test.t1)
> -master-bin.000001	233	Write_rows	1	272	table_id: # flags: STMT_END_F
> +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
>  DROP TABLE t1;
>  ================ Test for BUG#17620 ================
>  drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_create_table.result
> b/mysql-test/suite/rpl/r/rpl_row_create_table.result
> --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result	2007-12-14 14:40:43 +01:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result	2008-03-25 10:39:22 +01:00
> @@ -140,8 +140,10 @@ a	b
>  SHOW BINLOG EVENTS FROM 1374;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  #	1374	Query	#	1474	use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
> -#	1474	Table_map	#	1516	table_id: # (test.t7)
> -#	1516	Write_rows	#	1572	table_id: # flags: STMT_END_F
> +#	1474	Query	#	1542	use `test`; BEGIN
> +#	1542	Table_map	#	1584	table_id: # (test.t7)
> +#	1584	Write_rows	#	1640	table_id: # flags: STMT_END_F
> +#	1640	Query	#	1711	use `test`; ROLLBACK
>  SELECT * FROM t7 ORDER BY a,b;
>  a	b
>  1	2
> @@ -154,10 +156,12 @@ INSERT INTO t7 SELECT a,b FROM tt4;
>  ROLLBACK;
>  Warnings:
>  Warning	1196	Some non-transactional changed tables couldn't be rolled back
> -SHOW BINLOG EVENTS FROM 1572;
> +SHOW BINLOG EVENTS FROM 1711;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> -#	1572	Table_map	#	1614	table_id: # (test.t7)
> -#	1614	Write_rows	#	1670	table_id: # flags: STMT_END_F
> +#	1711	Query	#	1779	use `test`; BEGIN
> +#	1779	Table_map	#	1821	table_id: # (test.t7)
> +#	1821	Write_rows	#	1877	table_id: # flags: STMT_END_F
> +#	1877	Query	#	1946	use `test`; COMMIT
>  SELECT * FROM t7 ORDER BY a,b;
>  a	b
>  1	2
> @@ -192,10 +196,10 @@ Create Table	CREATE TABLE `t9` (
>    `a` int(11) DEFAULT NULL,
>    `b` int(11) DEFAULT NULL
>  ) ENGINE=MyISAM DEFAULT CHARSET=latin1
> -SHOW BINLOG EVENTS FROM 1670;
> +SHOW BINLOG EVENTS FROM 1946;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> -#	1670	Query	#	1756	use `test`; CREATE TABLE t8 LIKE t4
> -#	1756	Query	#	1895	use `test`; CREATE TABLE `t9` (
> +#	1946	Query	#	2032	use `test`; CREATE TABLE t8 LIKE t4
> +#	2032	Query	#	2171	use `test`; CREATE TABLE `t9` (
>    `a` int(11) DEFAULT NULL,
>    `b` int(11) DEFAULT NULL
>  )
> @@ -276,31 +280,35 @@ SHOW BINLOG EVENTS;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  #	4	Format_desc	#	106	Server ver: #, Binlog ver: #
>  #	106	Query	#	192	use `test`; CREATE TABLE t1 (a INT)
> -#	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` (
> +#	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` (
>    `a` int(11) DEFAULT NULL
>  ) ENGINE=InnoDB
> -#	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` (
> +#	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` (
>    `a` int(11) DEFAULT NULL
>  ) ENGINE=InnoDB
> -#	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` (
> +#	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` (
>    `a` int(11) DEFAULT NULL
>  ) ENGINE=InnoDB
> -#	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
> +#	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	#	1551	use `test`; COMMIT
>  SHOW TABLES;
>  Tables_in_test
>  t1
> @@ -367,15 +375,17 @@ SHOW BINLOG EVENTS;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  #	4	Format_desc	#	106	Server ver: #, Binlog ver: #
>  #	106	Query	#	192	use `test`; CREATE TABLE t1 (a INT)
> -#	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 */
> +#	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 */
>  SELECT * FROM t2 ORDER BY a;
>  a
>  1
> @@ -396,17 +406,14 @@ Warnings:
>  Warning	1196	Some non-transactional changed tables couldn't be rolled back
>  SELECT * FROM t2 ORDER BY a;
>  a
> -SHOW BINLOG EVENTS FROM 637;
> +SHOW BINLOG EVENTS FROM 949;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> -#	637	Query	#	705	use `test`; BEGIN
> -#	705	Query	#	785	use `test`; TRUNCATE TABLE t2
> -#	785	Xid	#	812	COMMIT /* XID */
> -#	812	Query	#	880	use `test`; BEGIN
> -#	880	Table_map	#	921	table_id: # (test.t2)
> -#	921	Write_rows	#	965	table_id: # flags: STMT_END_F
> -#	965	Table_map	#	1006	table_id: # (test.t2)
> -#	1006	Write_rows	#	1045	table_id: # flags: STMT_END_F
> -#	1045	Query	#	1116	use `test`; ROLLBACK
> +#	949	Query	#	1017	use `test`; BEGIN
> +#	1017	Table_map	#	1058	table_id: # (test.t2)
> +#	1058	Write_rows	#	1102	table_id: # flags: STMT_END_F
> +#	1102	Table_map	#	1143	table_id: # (test.t2)
> +#	1143	Write_rows	#	1182	table_id: # flags: STMT_END_F
> +#	1182	Query	#	1253	use `test`; ROLLBACK
>  SELECT * FROM t2 ORDER BY a;
>  a
>  DROP TABLE t1,t2;
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result
> b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result
> --- a/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result	2007-06-27 14:27:32 +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_delayed_ins.result	2008-03-25 10:39:22 +01:00
> @@ -14,16 +14,6 @@ a
>  1
>  2
>  3
> -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 not null primary
> key) engine=myisam
> -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	#	Table_map	#	#	table_id: # (test.t1)
> -master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> -master-bin.000001	#	Query	#	#	use `test`; flush tables
>  SELECT * FROM t1 ORDER BY a;
>  a
>  1
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
> b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
> --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result	2007-08-21 14:32:26 +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result	2008-03-25 10:39:22 +01:00
> @@ -12,13 +12,13 @@ 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 623 ;
> +SHOW BINLOG EVENTS FROM 897 ;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  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 623 ;
> +SHOW BINLOG EVENTS FROM 897 ;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t5, t2 to t1
>  master-bin.000001	#	Query	1	#	use `test`; flush tables
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
> b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
> --- a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result	2007-08-21 14:32:26 +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result	2008-03-25 10:39:22 +01:00
> @@ -24,7 +24,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000001
> -Read_Master_Log_Pos	605
> +Read_Master_Log_Pos	1153
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000001
> @@ -39,7 +39,7 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	1146
>  Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
>  Skip_Counter	0
> -Exec_Master_Log_Pos	530
> +Exec_Master_Log_Pos	941
>  Relay_Log_Space	#
>  Until_Condition	None
>  Until_Log_File	
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_log.result
> b/mysql-test/suite/rpl/r/rpl_row_log.result
> --- a/mysql-test/suite/rpl/r/rpl_row_log.result	2007-08-21 14:32:52 +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_log.result	2008-03-25 10:39:23 +01:00
> @@ -20,22 +20,26 @@ 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	#	Table_map	1	#	table_id: # (test.t1)
> +master-bin.000001	#	Query	1	#	use `test`; BEGIN
>  show binlog events from 106 limit 2,1;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> -master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
>  flush logs;
>  create table t3 (a int)ENGINE=MyISAM;
>  select * from t1 order by 1 asc;
> @@ -192,47 +196,59 @@ 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	1266
> -master-bin.000002	379
> +master-bin.000001	1540
> +master-bin.000002	516
>  start slave;
>  show binary logs;
>  Log_name	File_size
> -slave-bin.000001	1364
> -slave-bin.000002	280
> +slave-bin.000001	1602
> +slave-bin.000002	399
>  show binlog events in 'slave-bin.000001' from 4;
>  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	#	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	#	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	#	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	#	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	#	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	#	COMMIT
>  SHOW SLAVE STATUS;
>  Slave_IO_State	#
>  Master_Host	127.0.0.1
> @@ -240,7 +256,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000002
> -Read_Master_Log_Pos	379
> +Read_Master_Log_Pos	516
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000002
> @@ -255,7 +271,7 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	0
>  Last_Error	
>  Skip_Counter	0
> -Exec_Master_Log_Pos	379
> +Exec_Master_Log_Pos	516
>  Relay_Log_Space	#
>  Until_Condition	None
>  Until_Log_File	
> @@ -284,8 +300,10 @@ set insert_id=5;
>  insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
>  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
>  select * from t1;
>  a	b
>  1	1
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
> b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
> --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2007-12-14 14:40:43 +01:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2008-03-25 10:39:23 +01:00
> @@ -223,8 +223,8 @@ master-bin.000002	474
>  start slave;
>  show binary logs;
>  Log_name	File_size
> -slave-bin.000001	1536
> -slave-bin.000002	366
> +slave-bin.000001	1602
> +slave-bin.000002	399
>  show binlog events in 'slave-bin.000001' from 4;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
> @@ -232,13 +232,13 @@ slave-bin.000001	#	Query	1	#	use `test`;
>  slave-bin.000001	#	Query	1	#	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	#	Xid	1	#	COMMIT /* XID */
> +slave-bin.000001	#	Query	1	#	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=InnoDB
>  slave-bin.000001	#	Query	1	#	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	#	Xid	1	#	COMMIT /* XID */
> +slave-bin.000001	#	Query	1	#	COMMIT
>  slave-bin.000001	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=InnoDB
>  slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
>  show binlog events in 'slave-bin.000002' from 4;
> @@ -248,7 +248,7 @@ slave-bin.000002	#	Query	1	#	use `test`;
>  slave-bin.000002	#	Query	1	#	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	#	Xid	1	#	COMMIT /* XID */
> +slave-bin.000002	#	Query	1	#	COMMIT
>  SHOW SLAVE STATUS;
>  Slave_IO_State	#
>  Master_Host	127.0.0.1
> @@ -300,8 +300,10 @@ set insert_id=5;
>  insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
>  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
>  select * from t1;
>  a	b
>  1	1
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_until.result
> b/mysql-test/suite/rpl/r/rpl_row_until.result
> --- a/mysql-test/suite/rpl/r/rpl_row_until.result	2007-08-21 14:33:00 +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_row_until.result	2008-03-25 10:39:23 +01:00
> @@ -26,7 +26,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000001
> -Read_Master_Log_Pos	750
> +Read_Master_Log_Pos	1161
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000001
> @@ -41,7 +41,7 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	0
>  Last_Error	
>  Skip_Counter	0
> -Exec_Master_Log_Pos	317
> +Exec_Master_Log_Pos	454
>  Relay_Log_Space	#
>  Until_Condition	Master
>  Until_Log_File	master-bin.000001
> @@ -72,7 +72,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000001
> -Read_Master_Log_Pos	750
> +Read_Master_Log_Pos	1161
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000001
> @@ -87,7 +87,7 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	0
>  Last_Error	
>  Skip_Counter	0
> -Exec_Master_Log_Pos	317
> +Exec_Master_Log_Pos	454
>  Relay_Log_Space	#
>  Until_Condition	Master
>  Until_Log_File	master-no-such-bin.000001
> @@ -104,7 +104,7 @@ Last_IO_Errno	#
>  Last_IO_Error	#
>  Last_SQL_Errno	0
>  Last_SQL_Error	
> -start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
> +start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=1014;
>  select * from t2;
>  n
>  1
> @@ -116,7 +116,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000001
> -Read_Master_Log_Pos	750
> +Read_Master_Log_Pos	1161
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000001
> @@ -131,11 +131,11 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	0
>  Last_Error	
>  Skip_Counter	0
> -Exec_Master_Log_Pos	594
> +Exec_Master_Log_Pos	868
>  Relay_Log_Space	#
>  Until_Condition	Relay
>  Until_Log_File	slave-relay-bin.000004
> -Until_Log_Pos	728
> +Until_Log_Pos	1014
>  Master_SSL_Allowed	No
>  Master_SSL_CA_File	
>  Master_SSL_CA_Path	
> @@ -158,7 +158,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000001
> -Read_Master_Log_Pos	750
> +Read_Master_Log_Pos	1161
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000001
> @@ -173,7 +173,7 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	0
>  Last_Error	
>  Skip_Counter	0
> -Exec_Master_Log_Pos	750
> +Exec_Master_Log_Pos	1161
>  Relay_Log_Space	#
>  Until_Condition	Master
>  Until_Log_File	master-bin.000001
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_slave_skip.result
> b/mysql-test/suite/rpl/r/rpl_slave_skip.result
> --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result	2007-10-19 14:18:30 +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result	2008-03-25 10:39:23 +01:00
> @@ -17,14 +17,20 @@ 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`; CREATE TABLE t2 (c INT, d 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.t2)
>  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	#	Table_map	#	#	table_id: # (test.t2)
>  master-bin.000001	#	Update_rows	#	#	table_id: #
>  master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>  SELECT * FROM t1;
>  a	b
>  1	1
> @@ -36,7 +42,7 @@ c	d
>  2	16
>  3	54
>  **** On Slave ****
> -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=484;
> +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
>  SHOW SLAVE STATUS;
>  Slave_IO_State	#
>  Master_Host	127.0.0.1
> @@ -44,7 +50,7 @@ Master_User	root
>  Master_Port	MASTER_PORT
>  Connect_Retry	1
>  Master_Log_File	master-bin.000001
> -Read_Master_Log_Pos	722
> +Read_Master_Log_Pos	1133
>  Relay_Log_File	#
>  Relay_Log_Pos	#
>  Relay_Master_Log_File	master-bin.000001
> @@ -59,11 +65,11 @@ Replicate_Wild_Ignore_Table	
>  Last_Errno	0
>  Last_Error	
>  Skip_Counter	0
> -Exec_Master_Log_Pos	488
> +Exec_Master_Log_Pos	762
>  Relay_Log_Space	#
>  Until_Condition	Master
>  Until_Log_File	master-bin.000001
> -Until_Log_Pos	484
> +Until_Log_Pos	762
>  Master_SSL_Allowed	No
>  Master_SSL_CA_File	
>  Master_SSL_CA_Path	
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
> b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
> --- a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result	2007-12-14 14:40:43
> +01:00
> +++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result	2008-03-25 10:39:23
> +01:00
> @@ -425,673 +425,5 @@ INSERT INTO t13 VALUES (USER());
>  INSERT INTO t13 VALUES (my_user());
>  INSERT INTO t13 VALUES (CURRENT_USER());
>  INSERT INTO t13 VALUES (my_current_user());

I really appreciate that you are removing big results of show-binlog-events.

Still, I think it's necessary to explain why `show binlog event' is safe to
remove. Do we have any risk to loosing something in that dropped piece of
results?


> -show binlog events from <binlog_start>;
> -Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> -master-bin.000001	#	Query	#	#	drop database if exists mysqltest1
> -master-bin.000001	#	Query	#	#	create database mysqltest1
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE TABLE t1 (a varchar(100))
> -master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t1)
...
> -master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t11)
> -master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; INSERT INTO t11 VALUES('Careful With
> That Axe, Eugene')
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; DROP TABLE IF EXISTS t12
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE TABLE t12 (data LONG)
> -master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t12)
> -master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost`
> FUNCTION my_user()


> -RETURNS CHAR(64)
> -BEGIN
> -DECLARE user CHAR(64);
> -SELECT USER() INTO user;
> -RETURN user;
> -END
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost`
> FUNCTION my_current_user()
> -RETURNS CHAR(64)
> -BEGIN
> -DECLARE user CHAR(64);
> -SELECT CURRENT_USER() INTO user;
> -RETURN user;
> -END
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; DROP TABLE IF EXISTS t13
> -master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE TABLE t13 (data CHAR(64))
> -master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> -master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> -master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> -master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> -master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> -master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> -master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> -master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>  drop database mysqltest1;
>  set global binlog_format =@my_binlog_format;
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
> b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
> --- a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result	2007-11-02 13:00:35 +01:00
> +++ b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result	2008-03-25 10:39:23 +01:00
> @@ -114,8 +114,10 @@ show binlog events from <binlog_start>;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t1
>  master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
> 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`; TRUNCATE TABLE t1
>  master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
>  RESET MASTER;
> @@ -230,9 +232,13 @@ show binlog events from <binlog_start>;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t1
>  master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
> 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	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Query	#	#	use `test`; COMMIT
>  master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
>  RESET MASTER;
> diff -Nrup a/mysql-test/suite/rpl/t/rpl_row_create_table.test
> b/mysql-test/suite/rpl/t/rpl_row_create_table.test
> --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test	2007-12-14 14:40:43 +01:00
> +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test	2008-03-25 10:39:23 +01:00
> @@ -94,7 +94,7 @@ INSERT INTO t7 SELECT a,b FROM tt4;
>  ROLLBACK;
>  --replace_column 1 # 4 #
>  --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
> -SHOW BINLOG EVENTS FROM 1572;
> +SHOW BINLOG EVENTS FROM 1711;
>  SELECT * FROM t7 ORDER BY a,b;
>  sync_slave_with_master;
>  SELECT * FROM t7 ORDER BY a,b;
> @@ -110,7 +110,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1;
>  --query_vertical SHOW CREATE TABLE t9
>  --replace_column 1 # 4 #
>  --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
> -SHOW BINLOG EVENTS FROM 1670;
> +SHOW BINLOG EVENTS FROM 1946;
>  sync_slave_with_master;
>  --echo **** On Slave ****
>  --query_vertical SHOW CREATE TABLE t8
> @@ -227,7 +227,7 @@ ROLLBACK;
>  SELECT * FROM t2 ORDER BY a;
>  --replace_column 1 # 4 #
>  --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver:
> .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
> -SHOW BINLOG EVENTS FROM 637;
> +SHOW BINLOG EVENTS FROM 949;
>  sync_slave_with_master;
>  SELECT * FROM t2 ORDER BY a;
>  
> diff -Nrup a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
> b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
> --- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test	2007-08-21 14:32:26 +02:00
> +++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test	2008-03-25 10:39:23 +01:00
> @@ -1,7 +1,7 @@
>  # depends on the binlog output
>  -- source include/have_binlog_format_row.inc
>  
> -let $rename_event_pos= 623;
> +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
> diff -Nrup a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
> b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
> --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2007-10-11 18:17:56 +02:00
> +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2008-03-25 10:39:23 +01:00
> @@ -164,12 +164,12 @@ connection master;
>  
>  
>  # this test for position option
> -# By setting this position to 413, we should only get the create of t3
> +# By setting this position to 416, we should only get the create of t3
>  --disable_query_log
>  select "--- Test 2 position test --" as "";
>  --enable_query_log
>  --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
> ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416
> $MYSQLTEST_VARDIR/log/master-bin.000001
> +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416
> --stop-position=569 $MYSQLTEST_VARDIR/log/master-bin.000001
>  
>  # These are tests for remote binlog.
>  # They should return the same as previous test.
> @@ -180,7 +180,7 @@ select "--- Test 3 First Remote test --"
>  
>  # This is broken now
>  --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
> ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
> --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT
> master-bin.000001
> +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
> --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1
> --port=$MASTER_MYPORT master-bin.000001
>  
>  # This part is disabled due to bug #17654
>  
> @@ -246,12 +246,17 @@ connection master;
>  --exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
>  ################### End Bug 17654 ######################
>  
> +# What is the point of this test? It seems entirely pointless. It
> +# might make sense for statement-based replication, but for row-based
> +# replication the LOAD DATA INFILE is printed just as empty
> +# transactions. /Matz
> +
>  # LOAD DATA
>  --disable_query_log
>  select "--- Test 5 LOAD DATA --" as "";
>  --enable_query_log
>  --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
> ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
> --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT
> master-bin.000002
> +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
> --stop-position=106 --read-from-remote-server --user=root --host=127.0.0.1
> --port=$MASTER_MYPORT master-bin.000002
>  
>  # Bug#7853 (mysqlbinlog does not accept input from stdin)
>  
> @@ -259,13 +264,13 @@ select "--- Test 5 LOAD DATA --" as "";
>  select "--- Test 6 reading stdin --" as "";
>  --enable_query_log
>  --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
> ---exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001
> +--exec $MYSQL_BINLOG --short-form --stop-position=569 - <
> $MYSQLTEST_VARDIR/log/master-bin.000001
>  
>  --disable_query_log
>  select "--- Test 7 reading stdin w/position --" as "";
>  --enable_query_log
>  --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
> ---exec $MYSQL_BINLOG --short-form --position=416 - <
> $MYSQLTEST_VARDIR/log/master-bin.000001
> +--exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - <
> $MYSQLTEST_VARDIR/log/master-bin.000001
>  
>  # Bug#16217 (mysql client did not know how not switch its internal charset)
>  --disable_query_log
> diff -Nrup a/mysql-test/suite/rpl/t/rpl_row_until.test
> b/mysql-test/suite/rpl/t/rpl_row_until.test
> --- a/mysql-test/suite/rpl/t/rpl_row_until.test	2007-10-26 16:11:18 +02:00
> +++ b/mysql-test/suite/rpl/t/rpl_row_until.test	2008-03-25 10:39:24 +01:00
> @@ -42,7 +42,7 @@ select * from t1;
>  source include/show_slave_status.inc;
>  
>  # try replicate all up to and not including the second insert to t2;
> -start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
> +start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=1014;
>  --source include/wait_for_slave_sql_to_stop.inc
>  select * from t2;
>  source include/show_slave_status.inc;
> diff -Nrup a/mysql-test/suite/rpl/t/rpl_slave_skip.test
> b/mysql-test/suite/rpl/t/rpl_slave_skip.test
> --- a/mysql-test/suite/rpl/t/rpl_slave_skip.test	2007-10-19 14:18:30 +02:00
> +++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test	2008-03-25 10:39:24 +01:00
> @@ -26,7 +26,7 @@ save_master_pos;
>  connection slave;
>  
>  # Stop when reaching the the first table map event.
> -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=484;
> +START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
>  wait_for_slave_to_stop;
>  --replace_result $MASTER_MYPORT MASTER_PORT
>  --replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
> diff -Nrup a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
> b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
> --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test	2007-12-06 16:26:59
> +01:00
> +++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test	2008-03-25 10:39:24
> +01:00
> @@ -1,4 +1,4 @@
> -#
> + #
>  # rpl_switch_stm_row_mixed tests covers
>  #
>  #   - switching explicitly between STATEMENT, ROW, and MIXED binlog format
> @@ -556,7 +556,6 @@ INSERT INTO t13 VALUES (my_user());
>  INSERT INTO t13 VALUES (CURRENT_USER());
>  INSERT INTO t13 VALUES (my_current_user());
>  
> -source include/show_binlog_events.inc;
>  sync_slave_with_master;
>  
>  # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
> @@ -571,7 +570,6 @@ sync_slave_with_master;
>  diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
> $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
>  
>  connection master;
> -source include/show_binlog_events.inc;
>  
>  # Now test that mysqlbinlog works fine on a binlog generated by the
>  # mixed mode
> diff -Nrup a/sql/log.cc b/sql/log.cc
> --- a/sql/log.cc	2008-03-05 09:44:37 +01:00
> +++ b/sql/log.cc	2008-03-25 10:39:24 +01:00
> @@ -155,7 +155,7 @@ private:
>  class binlog_trx_data {
>  public:
>    binlog_trx_data()
> -    : m_pending(0), before_stmt_pos(MY_OFF_T_UNDEF)
> +    : m_pending(0), before_stmt_pos(MY_OFF_T_UNDEF), at_least_one_stmt(0)
>    {
>      trans_log.end_of_file= max_binlog_cache_size;
>    }
> @@ -188,6 +188,16 @@ public:
>      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);
>    }
>  
>    /*
> @@ -213,6 +223,12 @@ public:
>  
>    IO_CACHE trans_log;                         // The transaction cache
>  
> +  /**
> +    Boolean that is true if there is at least one statement in the
> +    transaction cache.
> +  */
> +  bool at_least_one_stmt;
> +
>  private:
>    /*
>      Pending binrows event. This event is the event where the rows are

changes in the following hunk are safe while it's safe to remove
invisible commit (discussed further).

> @@ -1373,26 +1389,20 @@ binlog_end_trans(THD *thd, binlog_trx_da
>        inside a stored function.
>       */
>      thd->binlog_flush_pending_rows_event(TRUE);
> +
> +    error= mysql_bin_log.write(thd, &trx_data->trans_log, end_ev);
> +    trx_data->reset();
> +
>      /*
> -      We write the transaction cache to the binary log if either we're
> -      committing the entire transaction, or if we are doing an
> -      autocommit outside a transaction.
> -     */
> -    if (all || !(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT)))
> +      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 (trans_log->disk_writes != 0)
>      {
> -      error= mysql_bin_log.write(thd, &trx_data->trans_log, end_ev);
> -      trx_data->reset();
> -      /*
> -        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 (trans_log->disk_writes != 0)
> -      {
> -        statistic_increment(binlog_cache_disk_use, &LOCK_status);
> -        trans_log->disk_writes= 0;
> -      }
> +      statistic_increment(binlog_cache_disk_use, &LOCK_status);
> +      trans_log->disk_writes= 0;
>      }
>    }
>    else



> @@ -1431,6 +1441,8 @@ static int binlog_prepare(handlerton *ht
>    return 0;
>  }
>  
> +#define YESNO(X) ((X) ? "yes" : "no")
> +
>  /**
>    This function is called once after each statement.
>  

 binlog_commit()'s argument

  @param all   true if this is the last statement before a COMMIT
               statement; 
               
               false  
  
               if either this is a statement in a
               transaction but not the last, or if this is a statement
               not inside a BEGIN block and autocommit is on.

the false's meaning has extended with your patch. Could you please update the
comments?



> @@ -1458,26 +1470,63 @@ static int binlog_commit(handlerton *hto
>      trx_data->reset();
>      DBUG_RETURN(0);
>    }
> +
>    /*
> -    Write commit event if at least one of the following holds:
> -     - the user sends an explicit COMMIT; or
> -     - the autocommit flag is on, and we are not inside a BEGIN.
> -    However, if the user has not sent an explicit COMMIT, and we are
> -    either inside a BEGIN or run with autocommit off, then this is not
> -    the end of a transaction and we should not write a commit event.
> +    Decision table for committing a transaction:
> +

I like the idea of the table.

I was asking yesterday and you agreed to make the table desciption
more verbose.
Besides from what you kindly explained - the columns correspond to
combinations of the five paraments we need to clarify/define some of
them like Real transaction.

> +    =============================  = = = = = = = = = = = = = = = =
> +    Real transaction               N N N N N N N N N N N N N N N N
> +    Statement in cache             N N N N N N N N Y Y Y Y Y Y Y Y
> +    In transaction                 N N N N Y Y Y Y N N N N Y Y Y Y
> +    Stmt modified non-trans        N N Y Y N N Y Y N N Y Y N N Y Y
> +    All modified non-trans         N Y N Y N Y N Y N Y N Y N Y N Y
> +
> +    Action: (C)ommit/(A)ccumulate  C C C C A C C C - - - - A A A A
> +    =============================  = = = = = = = = = = = = = = = =
> +
> +
> +    =============================  = = = = = = = = = = = = = = = =
> +    Real transaction               Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
> +    Statement in cache             N N N N N N N N Y Y Y Y Y Y Y Y
> +    In transaction                 N N N N Y Y Y Y N N N N Y Y Y Y
> +    Stmt modified non-trans        N N Y Y N N Y Y N N Y Y N N Y Y
> +    All modified non-trans         N Y N Y N Y N Y N Y N Y N Y N Y
> +
> +    (C)ommit/(A)ccumulate/(-)      - - - - C C C C - - - - C C C C
> +    =============================  = = = = = = = = = = = = = = = =
> +

Without the definition a reader may get confused even more.
E.g consider the 7th column of the 2nd part of the table.

Y
N
Y
Y
N

C

Stmt modified non-trans Y constradicts to All modified non-trans N
while the combination is benign.



> +    In other words, we commit the transaction if and only if:
> +     - The keep log option is set

first,
i think there should be explicit

        OR

in between of the items

second,

the original logics do not mention  (thd->options & OPTION_KEEP_LOG)
in the following if arglist.
What is the reason on add it?



> +     - We are in a transaction and:
> +       - A full transaction is committed,
> +       - A non-transactional statement is committed and there is
> +         no statement cached, or

        OR (as above)

> +     - We are not in a transaction and committing a statement

the last condition is actually what your fixes add to the original
logics: binlog_commit() can be called with all == false and
in_transaction == false and with the very intention to sink the trans
cache into the binlog.


> +
> +    Otherwise, we accumulate the statement
>    */
> -  if (all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
> +  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,
> +              YESNO(trx_data->empty()),
> +              YESNO(in_transaction),
> +              YESNO(thd->transaction.all.modified_non_trans_table),
> +              YESNO(thd->transaction.stmt.modified_non_trans_table)));

> +  if ((thd->options & OPTION_KEEP_LOG) ||

so I am not sure about the first case (thd->options &
OPTION_KEEP_LOG) and need your clarification.

> +      in_transaction &&
> +      (all ||
> +       (!trx_data->at_least_one_stmt &&
> +        thd->transaction.stmt.modified_non_trans_table)) ||

Previously binlog_commit called binlog_end_trans(thd, trx_data, &qev)
having as warrants to do that either
 
  all or ! in_transaction

Now i see that in the case

   in_transaction is true,
   all is false,
   the current statement has made what the identifier says - 
   thd->transaction.stmt.modified_non_trans_table
   and the trans cache is empty 

binlog_commit() is going to inject COMMIT into the binlog.

And what is a use case scenario for such combination?
Previously the first two items
   in_transaction is true,
   all is false,
meant an ordirary dml query not commit is about to end and therefore
nothing to commit yet neither to binlog.

Btw that piece of code seems to work (effectively i.e with actual
writing into binlog) only if there is no xa-support.
Besides to clarify I am asking you to check how no-xa-support-in-server
is going to cooperate with the current patch.


> +      !in_transaction && !all)

and this is the new rule for committing which I am okay with.

>    {
>      Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
>      qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
>      int error= binlog_end_trans(thd, trx_data, &qev, all);
>      DBUG_RETURN(error);
>    }

> -  else
> -  {
> -    int error= binlog_end_trans(thd, trx_data, &invisible_commit, all);
> -    DBUG_RETURN(error);
> -  }

invisible_commit seemed to be a dead piece of code. Again, as was
suggested xa-off server testing can change this preliminary
conclusion.

If it proves to be dead indeed then you need to remove the global object and
the class as well.

From another hand, naturally redundant COMMIT and ROLLBACK completing events on
myisam table in the binlog is something we'd rather to consider how to
avoid. And this invisible commit could serve for such purpose.

But I am okay with the current approach having the redundant queries
in binlog in this case.


> +  DBUG_RETURN(0);
>  }
>  

It's worth to mention a confusing in my opinion description of `all'
for begin_rollback. Should not it be `ROLLBACK' on place of `COMMIT'?!
And actully all=true can be a reaction to force rolling back not the
query.


  @param all   true if this is the last statement before a COMMIT
               statement; false if either this is a statement in a
               transaction but not the last, or if this is a statement
               not inside a BEGIN block and autocommit is on.

If so, could you please fix that?

Also, as in the commit case the description of `all' needs updating.
Could you please state explicitly that all == false and 

>  /**
> @@ -1509,21 +1558,36 @@ static int binlog_rollback(handlerton *h
>      DBUG_RETURN(0);
>    }
>  
> -  /*
> -    Update the binary log with a BEGIN/ROLLBACK block if we have
> -    cached some queries and we updated some non-transactional
> -    table. Such cases should be rare (updating a
> -    non-transactional table inside a transaction...)
> -  */
> -  if (unlikely(thd->transaction.all.modified_non_trans_table || 
> -               (thd->options & OPTION_KEEP_LOG)))
> +  DBUG_PRINT("debug", ("all: %s, all.modified_non_trans_table: %s,
> stmt.modified_non_trans_table: %s",
> +                       YESNO(all),
> +                       YESNO(thd->transaction.all.modified_non_trans_table),
> +                       YESNO(thd->transaction.stmt.modified_non_trans_table)));
> +  if (all && thd->transaction.all.modified_non_trans_table ||
> +      !all && thd->transaction.stmt.modified_non_trans_table ||
> +      (thd->options & OPTION_KEEP_LOG))
>    {
> +    /*
> +      We write the transaction cache with a rollback last if we have
> +      modified any non-transactional table. We do this even if we are
> +      committing a single statement that has modified a
> +      non-transactional table since it can have modified a
> +      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);
>    }
> -  else
> +  else if (all && !thd->transaction.all.modified_non_trans_table ||
> +           !all && !thd->transaction.stmt.modified_non_trans_table)
> +  {
> +    /*
> +      If we have modified only transactional tables, we can truncate
> +      the transaction cache without writing anything to the binary
> +      log.
> +     */
>      error= binlog_end_trans(thd, trx_data, 0, all);
> +  }
>    DBUG_RETURN(error);
>  }
>  
> diff -Nrup a/sql/log_event.cc b/sql/log_event.cc
> --- a/sql/log_event.cc	2008-02-28 18:55:42 +01:00
> +++ b/sql/log_event.cc	2008-03-25 10:39:24 +01:00
> @@ -7054,7 +7054,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, is_transactional),
> +  : Log_event(thd, 0, true),
>      m_table(tbl),
>      m_dbnam(tbl->s->db.str),
>      m_dblen(m_dbnam ? tbl->s->db.length : 0),
> diff -Nrup a/sql/sql_insert.cc b/sql/sql_insert.cc
> --- a/sql/sql_insert.cc	2008-02-19 13:45:16 +01:00
> +++ b/sql/sql_insert.cc	2008-03-25 10:39:25 +01:00
> @@ -2426,6 +2426,7 @@ pthread_handler_t handle_delayed_insert(
>        */
>        di->table->file->ha_release_auto_increment();
>        mysql_unlock_tables(thd, lock);

> +      ha_autocommit_or_rollback(thd, 0);

that's clear why.
Still would be better to leave comments what the func is doing here.
(actually it's just in order to call  binlog_commit() eventually, is
not it?)


>        di->group_count=0;
>        pthread_mutex_lock(&di->mutex);
>      }
> @@ -3677,13 +3678,10 @@ void select_create::abort()
>    DBUG_ENTER("select_create::abort");
>  
>    /*
> -   Disable binlog, because we "roll back" partial inserts in ::abort
> -   by removing the table, even for non-transactional tables.
> -  */
> -  tmp_disable_binlog(thd);
> -  /*
>      In select_insert::abort() we roll back the statement, including
> -    truncating the transaction cache of the binary log.
> +    truncating the transaction cache of the binary log. To do this, we
> +    pretend that the statement is transactional, even though it might
> +    be the case that it was not.
>  
>      We roll back the statement prior to deleting the table and prior
>      to releasing the lock on the table, since there might be potential
> @@ -3694,7 +3692,9 @@ void select_create::abort()
>      of the table succeeded or not, since we need to reset the binary
>      log state.
>    */
> +  tmp_disable_binlog(thd);
>    select_insert::abort();
> +  thd->transaction.stmt.modified_non_trans_table= FALSE;
>    reenable_binlog(thd);
>  
>  
> diff -Nrup a/sql/sql_load.cc b/sql/sql_load.cc
> --- a/sql/sql_load.cc	2008-02-19 13:45:17 +01:00
> +++ b/sql/sql_load.cc	2008-03-25 10:39:25 +01:00
> @@ -513,6 +513,7 @@ bool mysql_load(THD *thd,sql_exchange *e
>  err:
>    DBUG_ASSERT(transactional_table || !(info.copied || info.deleted) ||
>                thd->transaction.stmt.modified_non_trans_table);

> +  ha_autocommit_or_rollback(thd, error);

Why do we need this reincarnation?
is anything wrong with relying on dispatch_command calls the function?


regards,

Andrei


Thread
bk commit into 5.1 tree (mats:1.2559) BUG#29020Mats Kindahl25 Mar
  • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Andrei Elkin26 Mar
    • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Mats Kindahl27 Mar
      • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Andrei Elkin27 Mar
        • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Mats Kindahl28 Mar
          • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Andrei Elkin28 Mar
            • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Mats Kindahl28 Mar
  • RE: bk commit into 5.1 tree (mats:1.2559) BUG#29020Chuck Bell26 Mar
    • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Mats Kindahl27 Mar
  • RE: bk commit into 5.1 tree (mats:1.2559) BUG#29020Chuck Bell26 Mar
    • Re: bk commit into 5.1 tree (mats:1.2559) BUG#29020Mats Kindahl27 Mar