MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Libing Song Date:March 1 2010 12:17pm
Subject:Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3346)
Bug#50407
View as plain text  
Hi Zhengxing,
   Thanks for your review.
   The new patch has been committed, please review it again.

On Mon, 2010-03-01 at 12:11 +0800, He Zhenxing wrote:
> Hi Libing,
> 
> Thank you for the work!
> 
> STATUS
> ------
> Not approved
> 
> REQUIRED CHANGES
> ----------------
> 
> RC1. Hmm, I think the same problem exist for --binlog-do-db as well (),
> please check and fix it if confirmed.
OK.
> 
> REQUESTS
> --------
> N/A
> 
> SUGGESTION
> ----------
> 
> S1, I think 'is_trans_stmt' is better than 'is_trans_keyword'
I 
> 
> Li-Bing.Song@stripped wrote:
> > #At file:///home/anders/work/bzrwork/worktree1/mysql-5.1-bugteam/ based on
> revid:joro@stripped
> > 
> >  3346 Li-Bing.Song@stripped	2010-02-24
> >       Bug #50407  mysqlbinlog --database=X produces bad output for SAVEPOINTs
> >       
> >       When mysqlbinlog was given the --database=X flag, it always printed
> 'ROLLBACK TO',
> >       but the corresponding 'SAVEPOINT' statement was not printed.
> >       The replicated filter(--replicated-do-db) has the same problem. It is
> solved 
> >       in this patch together.
> >       
> >       
> >       After this patch, We always check whether the query is 'SAVEPOINT'
> statement or not.
> >       Becaust this is a literal check, 'SAVEPOINT' and 'ROLLBACK TO' statements
> are also
> >       binlogged in uppercase with no any comments.
> > 
> >     modified:
> >       client/mysqlbinlog.cc
> >       mysql-test/r/mysqlbinlog.result
> >       mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
> >       mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
> >       mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
> >       mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
> >       mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test
> >       mysql-test/t/mysqlbinlog.test
> >       sql/log.cc
> >       sql/log_event.cc
> >       sql/log_event.h
> > === modified file 'client/mysqlbinlog.cc'
> > --- a/client/mysqlbinlog.cc	2010-01-21 08:10:05 +0000
> > +++ b/client/mysqlbinlog.cc	2010-02-24 03:37:14 +0000
> > @@ -730,9 +730,7 @@ Exit_status process_event(PRINT_EVENT_IN
> >  
> >      switch (ev_type) {
> >      case QUERY_EVENT:
> > -      if (strncmp(((Query_log_event*)ev)->query, "BEGIN", 5) && 
> > -          strncmp(((Query_log_event*)ev)->query, "COMMIT", 6) && 
> > -          strncmp(((Query_log_event*)ev)->query, "ROLLBACK", 8) && 
> 
> > +      if (!((Query_log_event*)ev)->is_trans_keyword() &&
> >            shall_skip_database(((Query_log_event*)ev)->db))
> >          goto end;
> >        if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
> > 
> > === modified file 'mysql-test/r/mysqlbinlog.result'
> > --- a/mysql-test/r/mysqlbinlog.result	2010-01-27 12:23:28 +0000
> > +++ b/mysql-test/r/mysqlbinlog.result	2010-02-24 03:37:14 +0000
> > @@ -479,7 +479,7 @@ FLUSH LOGS;
> >  RESET MASTER;
> >  FLUSH LOGS;
> >  #
> > -# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database
> specified is exist
> > +# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database
> specified exists
> >  /*!40019 SET @@session.max_insert_delayed_threads=0*/;
> >  /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
> >  DELIMITER /*!*/;
> > @@ -532,7 +532,7 @@ DELIMITER ;
> >  ROLLBACK /* added by mysqlbinlog */;
> >  /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
> >  #
> > -# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database
> specified is not exist
> > +# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database
> specified does not exist
> >  /*!40019 SET @@session.max_insert_delayed_threads=0*/;
> >  /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
> >  DELIMITER /*!*/;
> > @@ -565,5 +565,76 @@ DELIMITER ;
> >  # End of log file
> >  ROLLBACK /* added by mysqlbinlog */;
> >  /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
> > +#
> > +# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified
> exists
> > +/*!40019 SET @@session.max_insert_delayed_threads=0*/;
> > +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
> > +DELIMITER /*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +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
> > +/*!*/;
> > +use test/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +SavePoint mixed_cases
> > +/*!*/;
> > +use db1/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")
> > +/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +INSERT INTO db1.t1 VALUES(40)
> > +/*!*/;
> > +use test/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +ROLLBACK TO mixed_cases
> > +/*!*/;
> > +use db1/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +INSERT INTO db1.t2 VALUES("after rollback to")
> > +/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +INSERT INTO db1.t1 VALUES(50)
> > +/*!*/;
> > +COMMIT/*!*/;
> > +DELIMITER ;
> > +# End of log file
> > +ROLLBACK /* added by mysqlbinlog */;
> > +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
> > +#
> > +# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified
> does not exist
> > +/*!40019 SET @@session.max_insert_delayed_threads=0*/;
> > +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
> > +DELIMITER /*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +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
> > +/*!*/;
> > +use test/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +SavePoint mixed_cases
> > +/*!*/;
> > +SET TIMESTAMP=1266652094/*!*/;
> > +ROLLBACK TO mixed_cases
> > +/*!*/;
> > +COMMIT/*!*/;
> > +DELIMITER ;
> > +# End of log file
> > +ROLLBACK /* added by mysqlbinlog */;
> > +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
> >  End of 5.0 tests
> >  End of 5.1 tests
> > 
> > === 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	2010-01-22
> 09:38:21 +0000
> > +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2010-02-24
> 03:37:14 +0000
> > @@ -48,12 +48,12 @@ Log_name	Pos	Event_type	Server_id	End_lo
> >  master-bin.000001	#	Query	#	#	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	#	Query	#	#	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	#	Query	#	#	ROLLBACK TO my_savepoint
> >  master-bin.000001	#	Xid	#	#	COMMIT /* XID */
> >  delete from t1;
> >  delete from t2;
> > @@ -77,12 +77,12 @@ Log_name	Pos	Event_type	Server_id	End_lo
> >  master-bin.000001	#	Query	#	#	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	#	Query	#	#	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	#	Query	#	#	ROLLBACK TO 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	#	Xid	#	#	COMMIT /* XID */
> > 
> > === 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-12-06
> 01:11:32 +0000
> > +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2010-02-24
> 03:37:14 +0000
> > @@ -44,10 +44,10 @@ show binlog events from <binlog_start>;
> >  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> >  master-bin.000001	#	Query	#	#	BEGIN
> >  master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(3)
> > -master-bin.000001	#	Query	#	#	use `test`; savepoint my_savepoint
> > +master-bin.000001	#	Query	#	#	SAVEPOINT my_savepoint
> >  master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(4)
> >  master-bin.000001	#	Query	#	#	use `test`; insert into t2 select * from t1
> > -master-bin.000001	#	Query	#	#	use `test`; rollback to savepoint my_savepoint
> > +master-bin.000001	#	Query	#	#	ROLLBACK TO my_savepoint
> >  master-bin.000001	#	Xid	#	#	COMMIT /* XID */
> >  delete from t1;
> >  delete from t2;
> > @@ -70,10 +70,10 @@ show binlog events from <binlog_start>;
> >  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> >  master-bin.000001	#	Query	#	#	BEGIN
> >  master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(5)
> > -master-bin.000001	#	Query	#	#	use `test`; savepoint my_savepoint
> > +master-bin.000001	#	Query	#	#	SAVEPOINT my_savepoint
> >  master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(6)
> >  master-bin.000001	#	Query	#	#	use `test`; insert into t2 select * from t1
> > -master-bin.000001	#	Query	#	#	use `test`; rollback to savepoint my_savepoint
> > +master-bin.000001	#	Query	#	#	ROLLBACK TO my_savepoint
> >  master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(7)
> >  master-bin.000001	#	Xid	#	#	COMMIT /* XID */
> >  delete from t1;
> > 
> > === modified file 'mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result'
> > --- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	2009-05-31
> 05:44:41 +0000
> > +++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	2010-02-24
> 03:37:14 +0000
> > @@ -102,8 +102,65 @@ SELECT * from db1.t2;
> >  s
> >  before call db1.p1()
> >  executed db1.p2()
> > +START SLAVE;
> > +#
> > +# SAVEPOINT and ROLLBACK TO have the same problem in BUG#43263
> > +# This was reported by BUG#50407
> > +[on master]
> > +SET SESSION AUTOCOMMIT=0
> > +BEGIN;
> > +INSERT INTO db1.t1 VALUES(20);
> > +# 
> > +# Verify whether this statement is binlogged correctly
> > +/*comment*/ SAVEPOINT has_comment;
> > +USE db1;
> > +INSERT INTO db1.t1 VALUES(30);
> > +INSERT INTO db1.t2 VALUES("in savepoint has_comment");
> > +USE test;
> > +SavePoint mixed_cases;
> > +USE db1;
> > +INSERT INTO db1.t2 VALUES("in savepoint mixed_cases");
> > +INSERT INTO db1.t1 VALUES(40);
> > +USE test;
> > +ROLLBACK TO mixed_cases;
> > +Warnings:
> > +Warning	1196	Some non-transactional changed tables couldn't be rolled back
> > +ROLLBACK TO has_comment;
> > +Warnings:
> > +Warning	1196	Some non-transactional changed tables couldn't be rolled back
> > +USE db1;
> > +INSERT INTO db1.t2 VALUES("after rollback to");
> > +INSERT INTO db1.t1 VALUES(50);
> > +USE test;
> > +COMMIT;
> > +show binlog events from <binlog_start>;
> > +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
> > +master-bin.000001	#	Query	#	#	BEGIN
> > +master-bin.000001	#	Query	#	#	use `test`; INSERT INTO db1.t1 VALUES(20)
> > +master-bin.000001	#	Query	#	#	SAVEPOINT has_comment
> > +master-bin.000001	#	Query	#	#	use `db1`; INSERT INTO db1.t1 VALUES(30)
> > +master-bin.000001	#	Query	#	#	use `db1`; INSERT INTO db1.t2 VALUES("in
> savepoint has_comment")
> > +master-bin.000001	#	Query	#	#	SAVEPOINT mixed_cases
> > +master-bin.000001	#	Query	#	#	use `db1`; INSERT INTO db1.t2 VALUES("in
> savepoint mixed_cases")
> > +master-bin.000001	#	Query	#	#	use `db1`; INSERT INTO db1.t1 VALUES(40)
> > +master-bin.000001	#	Query	#	#	ROLLBACK TO mixed_cases
> > +master-bin.000001	#	Query	#	#	ROLLBACK TO has_comment
> > +master-bin.000001	#	Query	#	#	use `db1`; INSERT INTO db1.t2 VALUES("after
> rollback to")
> > +master-bin.000001	#	Query	#	#	use `db1`; INSERT INTO db1.t1 VALUES(50)
> > +master-bin.000001	#	Xid	#	#	COMMIT /* XID */
> > +[on slave]
> > +#
> > +# Verify INSERT statements in savepoints are executed, for MyISAM table
> > +# is not effected by ROLLBACK TO
> > +SELECT * FROM db1.t2 WHERE s LIKE '% savepoint %';
> > +s
> > +in savepoint has_comment
> > +in savepoint mixed_cases
> > +#
> > +# Verify INSERT statements on the Innodb table are rolled back;
> > +SELECT * FROM db1.t1 WHERE a IN (30, 40);
> > +a
> >  #
> >  # Clean up
> >  #
> >  DROP DATABASE db1;
> > -DROP DATABASE db1;
> > 
> > === modified file 'mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result'
> > --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result	2010-01-30 12:49:25
> +0000
> > +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result	2010-02-24 03:37:14
> +0000
> > @@ -998,7 +998,7 @@ master-bin.000001	#	Query	1	#	use `test_
> >  master-bin.000001	#	Xid	1	#	#
> >  master-bin.000001	#	Query	1	#	BEGIN
> >  master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES (5, 'before
> savepoint s2')
> > -master-bin.000001	#	Query	1	#	use `test_rpl`; SAVEPOINT s2
> > +master-bin.000001	#	Query	1	#	SAVEPOINT s2
> >  master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES (6, 'after
> savepoint s2')
> >  master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t1)
> >  master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
> > 
> > === modified file 'mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test'
> > --- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test	2009-05-31 05:44:41
> +0000
> > +++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test	2010-02-24 03:37:14
> +0000
> > @@ -116,10 +116,54 @@ eval SELECT $result as 'Must be 0';
> >  SELECT * from db1.t1;
> >  SELECT * from db1.t2;
> >  
> > +START SLAVE;
> > +source include/wait_for_slave_sql_to_start.inc;
> > +
> > +--echo #
> > +--echo # SAVEPOINT and ROLLBACK TO have the same problem in BUG#43263
> > +--echo # This was reported by BUG#50407
> > +connection master;
> > +echo [on master]
> > +SET SESSION AUTOCOMMIT=0;
> > +let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1);
> > +
> > +BEGIN;
> > +INSERT INTO db1.t1 VALUES(20);
> > +
> > +--echo # 
> > +--echo # Verify whether this statement is binlogged correctly
> > +/*comment*/ SAVEPOINT has_comment;
> > +USE db1;
> > +INSERT INTO db1.t1 VALUES(30);
> > +INSERT INTO db1.t2 VALUES("in savepoint has_comment");
> > +USE test;
> > +SavePoint mixed_cases;
> > +USE db1;
> > +INSERT INTO db1.t2 VALUES("in savepoint mixed_cases");
> > +INSERT INTO db1.t1 VALUES(40);
> > +USE test;
> > +ROLLBACK TO mixed_cases;
> > +ROLLBACK TO has_comment;
> > +USE db1;
> > +INSERT INTO db1.t2 VALUES("after rollback to");
> > +INSERT INTO db1.t1 VALUES(50);
> > +USE test;
> > +COMMIT;
> > +source include/show_binlog_events.inc;
> > +sync_slave_with_master;
> > +
> > +--echo [on slave]
> > +--echo #
> > +--echo # Verify INSERT statements in savepoints are executed, for MyISAM table
> > +--echo # is not effected by ROLLBACK TO
> > +SELECT * FROM db1.t2 WHERE s LIKE '% savepoint %';
> > +--echo #
> > +--echo # Verify INSERT statements on the Innodb table are rolled back;
> > +SELECT * FROM db1.t1 WHERE a IN (30, 40);
> > +
> >  --echo #
> >  --echo # Clean up
> >  --echo #
> >  connection master;
> >  DROP DATABASE db1;
> > -connection slave;
> > -DROP DATABASE db1;
> > +source include/master-slave-end.inc;
> > 
> > === modified file 'mysql-test/t/mysqlbinlog.test'
> > --- a/mysql-test/t/mysqlbinlog.test	2009-12-06 01:11:32 +0000
> > +++ b/mysql-test/t/mysqlbinlog.test	2010-02-24 03:37:14 +0000
> > @@ -434,12 +434,19 @@ FLUSH LOGS;
> >  # Transaction3 end
> >  
> >  --echo #
> > ---echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the
> database specified is exist
> > +--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the
> database specified exists
> >  --exec $MYSQL_BINLOG --database=test --short-form
> $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
> >  --echo #
> > ---echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the
> database specified is not exist
> > +--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the
> database specified does not exist
> >  --exec $MYSQL_BINLOG --database=not_exist --short-form
> $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
> >  
> > +--echo #
> > +--echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database
> specified exists
> > +--exec $MYSQL_BINLOG --database=db1 --short-form
> $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001
> > +--echo #
> > +--echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database
> specified does not exist
> > +--exec $MYSQL_BINLOG --database=not_exist --short-form
> $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001
> > +
> >  --echo End of 5.0 tests
> >  
> >  --echo End of 5.1 tests
> > 
> > === modified file 'sql/log.cc'
> > --- a/sql/log.cc	2010-01-24 07:03:23 +0000
> > +++ b/sql/log.cc	2010-02-24 03:37:14 +0000
> > @@ -1713,11 +1713,14 @@ static int binlog_savepoint_set(handlert
> >    binlog_trans_log_savepos(thd, (my_off_t*) sv);
> >    /* Write it to the binary log */
> >  
> > +  String log_query;
> > +  if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) ||
> > +      log_query.append(thd->lex->ident.str,
> thd->lex->ident.length))
> > +    DBUG_RETURN(1);
> >    int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
> > -  int const error=
> > -    thd->binlog_query(THD::STMT_QUERY_TYPE,
> > -                      thd->query(), thd->query_length(), TRUE, FALSE,
> errcode);
> > -  DBUG_RETURN(error);
> > +  Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),
> > +                        TRUE, TRUE, errcode);
> > +  DBUG_RETURN(mysql_bin_log.write(&qinfo));
> >  }
> >  
> >  static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
> > @@ -1732,11 +1735,14 @@ static int binlog_savepoint_rollback(han
> >    if (unlikely(thd->transaction.all.modified_non_trans_table || 
> >                 (thd->options & OPTION_KEEP_LOG)))
> >    {
> > +    String log_query;
> > +    if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) ||
> > +        log_query.append(thd->lex->ident.str,
> thd->lex->ident.length))
> > +      DBUG_RETURN(1);
> >      int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
> > -    int error=
> > -      thd->binlog_query(THD::STMT_QUERY_TYPE,
> > -                        thd->query(), thd->query_length(), TRUE, FALSE,
> errcode);
> > -    DBUG_RETURN(error);
> > +    Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),
> > +                          TRUE, TRUE, errcode);
> > +    DBUG_RETURN(mysql_bin_log.write(&qinfo));
> >    }
> >    binlog_trans_log_truncate(thd, *(my_off_t*)sv);
> >    DBUG_RETURN(0);
> > 
> > === modified file 'sql/log_event.cc'
> > --- a/sql/log_event.cc	2010-01-28 21:51:40 +0000
> > +++ b/sql/log_event.cc	2010-02-24 03:37:14 +0000
> > @@ -3063,10 +3063,7 @@ int Query_log_event::do_apply_event(Rela
> >              ::do_apply_event(), then the companion SET also have so
> >              we don't need to reset_one_shot_variables().
> >    */
> > -  if (!strncmp(query_arg, "BEGIN", q_len_arg) ||
> > -      !strncmp(query_arg, "COMMIT", q_len_arg) ||
> > -      !strncmp(query_arg, "ROLLBACK", q_len_arg) ||
> > -      rpl_filter->db_ok(thd->db))
> > +  if (is_trans_keyword() || rpl_filter->db_ok(thd->db))
> >    {
> >      thd->set_time((time_t)when);
> >      thd->set_query((char*)query_arg, q_len_arg);
> > 
> > === modified file 'sql/log_event.h'
> > --- a/sql/log_event.h	2010-01-27 17:27:49 +0000
> > +++ b/sql/log_event.h	2010-02-24 03:37:14 +0000
> > @@ -1682,6 +1682,23 @@ public:        /* !!! Public in this pat
> >                         const char *query_arg,
> >                         uint32 q_len_arg);
> >  #endif /* HAVE_REPLICATION */
> > +  /*
> > +    If true, the event always be applied by slave SQL thread or be printed by
> > +    mysqlbinlog
> > +   */
> > +  bool is_trans_keyword()
> > +  {
> > +    /*
> > +      Before the patch for bug#50407, The 'SAVEPOINT and ROLLBACK TO'
> > +      queries input by user was written into log events directly.
> > +      So the keywords can be written in both upper case and lower case
> > +      together. strncasecmp is used to check both cases.
> > +     */
> > +    return !strncmp(query, "BEGIN", q_len) ||
> > +      !strncmp(query, "COMMIT", q_len) ||
> > +      !strncasecmp(query, "SAVEPOINT", 9) ||
> > +      !strncasecmp(query, "ROLLBACK", 8);
> > +  }
> >  };
> >  
> > 
> > 
> 
> 


-- 
Your Sincerely,
Libing Song
==================================
MySQL Replication Team
Software Engineer
Certified (ISC)2 CISSP

Email : Li-Bing.Song@stripped
Skype : libing.song
MSN   : slb_database@stripped
Phone : +86 010-6505-4020 ext. 319
Mobile: +86 138-1144-2038
==================================


Thread
bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3346) Bug#50407Li-Bing.Song24 Feb
  • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3346)Bug#50407Luís Soares25 Feb
  • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3346)Bug#50407He Zhenxing1 Mar
    • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3346)Bug#50407Luís Soares1 Mar
      • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3346)Bug#50407He Zhenxing1 Mar
    • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3346)Bug#50407Libing Song1 Mar