From: Date: January 24 2008 1:01am Subject: bk commit into 5.1 tree (cmiller:1.2508) BUG#18337 List-Archive: http://lists.mysql.com/commits/41183 X-Bug: 18337 Message-Id: <20080124000118.943C283056@cornsilk.net> Below is the list of changes that have just been committed into a local 5.1 repository of cmiller. When cmiller 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-01-23 19:01:13-05:00, cmiller@stripped +4 -0 Bug#18337: mysqlbinlog not displaying BINLOG statements when called \ with --short-form Bug fix contributed by Terry Tao. No CLA needed for this size. The code to print BINLOG data should be outside the test for whether we are asking for the short-form. BitKeeper/etc/ignore@stripped, 2008-01-23 19:01:10-05:00, cmiller@stripped +1 -0 Added libmysqld/sql_profile.cc to the ignore list mysql-test/r/mysqlbinlog.result@stripped, 2008-01-23 19:01:10-05:00, cmiller@stripped +71 -0 Show that the short-form includes BINLOG sections. mysql-test/t/mysqlbinlog.test@stripped, 2008-01-23 19:01:10-05:00, cmiller@stripped +20 -0 Show that the short-form includes BINLOG sections. sql/log_event.cc@stripped, 2008-01-23 19:01:10-05:00, cmiller@stripped +5 -4 Move the printing of event info outside the short-form conditions. diff -Nrup a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore --- a/BitKeeper/etc/ignore 2007-12-13 06:49:43 -05:00 +++ b/BitKeeper/etc/ignore 2008-01-23 19:01:10 -05:00 @@ -3012,3 +3012,4 @@ win/vs8cache.txt ylwrap zlib/*.ds? zlib/*.vcproj +libmysqld/sql_profile.cc diff -Nrup a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result --- a/mysql-test/r/mysqlbinlog.result 2007-11-15 07:31:13 -05:00 +++ b/mysql-test/r/mysqlbinlog.result 2008-01-23 19:01:10 -05:00 @@ -352,4 +352,75 @@ a b 1 root@localhost DROP DATABASE mysqltest1; DROP USER untrusted@localhost; +flush logs; +use test; +create table bug18337 (a int); +insert into bug18337 values(1); +set binlog_format = 'row'; +insert into bug18337 values(2),(3); +flush logs; +Long: +/*!N SET @@session.max_insert_delayed_threads=N*/; +/*!N SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=N*/; +DELIMITER /*!*/; +# at N +timestamp server id N end_log_pos N Start version blah blah# at N +timestamp server id N end_log_pos N Query thread_id=N exec_time=N error_code=N +use test/*!*/; +SET TIMESTAMP=N/*!*/; +SET @@session.foreign_key_checks=N, @@session.sql_auto_is_null=N, @@session.unique_checks=N/*!*/; +SET @@session.sql_mode=N/*!*/; +/*!\C latinN *//*!*/; +SET @@session.character_set_client=N,@@session.collation_connection=N,@@session.collation_server=N/*!*/; +create table bugN (a int)/*!*/; +# at N +# at N +timestamp server id N end_log_pos N Table_map: `test`.`bugN` mapped to number N +timestamp server id N end_log_pos N Write_rows: table id N flags: STMT_END_F + +BINLOG ' +AMqaOxMBAAAALwAAAPUAAAAAABsAAAAAAAAABHRlcNQACGJNZzENMzMNAAEDAAE= +AMqaOxcBAAAAIgAAABcBAAAQABsAAAAAAAEAAf/+AQAAAA== +'/*!*/; +# at N +# at N +timestamp server id N end_log_pos N Table_map: `test`.`bugN` mapped to number N +timestamp server id N end_log_pos N Write_rows: table id N flags: STMT_END_F + +BINLOG ' +AMqaOxMBAAAALwAAAEYBAAAAABsAAAAAAAAABHRlcNQACGJNZzENMzMNAAEDAAE= +AMqaOxcBAAAAJwAAAGNBAAAQABsAAAAAAAEAAf/+AgAAAPNDAAAA +'/*!*/; +# at N +timestamp server id N end_log_pos N Rotate to master-bin.N pos: N +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!N SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +Short: +/*!N SET @@session.max_insert_delayed_threads=N*/; +/*!N SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=N*/; +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=N/*!*/; +SET @@session.foreign_key_checks=N, @@session.sql_auto_is_null=N, @@session.unique_checks=N/*!*/; +SET @@session.sql_mode=N/*!*/; +/*!\C latinN *//*!*/; +SET @@session.character_set_client=N,@@session.collation_connection=N,@@session.collation_server=N/*!*/; +create table bugN (a int)/*!*/; + +BINLOG ' +AMqaOxMBAAAALwAAAPUAAAAAABsAAAAAAAAABHRlcNQACGJNZzENMzMNAAEDAAE= +AMqaOxcBAAAAIgAAABcBAAAQABsAAAAAAAEAAf/+AQAAAA== +'/*!*/; + +BINLOG ' +AMqaOxMBAAAALwAAAEYBAAAAABsAAAAAAAAABHRlcNQACGJNZzENMzMNAAEDAAE= +AMqaOxcBAAAAJwAAAGNBAAAQABsAAAAAAAEAAf/+AgAAAPNDAAAA +'/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!N SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +drop table bug18337; End of 5.1 tests diff -Nrup a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test --- a/mysql-test/t/mysqlbinlog.test 2007-11-15 07:31:13 -05:00 +++ b/mysql-test/t/mysqlbinlog.test 2008-01-23 19:01:10 -05:00 @@ -282,4 +282,24 @@ connection default; DROP DATABASE mysqltest1; DROP USER untrusted@localhost; +# +# Bug#18337: mysqlbinlog not displaying BINLOG statements when called with --short-form +# +flush logs; +use test; +create table bug18337 (a int); +insert into bug18337 values(1); +set binlog_format = 'row'; +insert into bug18337 values(2),(3); +flush logs; +--enable_query_log +--enable_result_log +--echo Long: +--replace_regex /#[0-9]{6} ..:..:../timestamp/ /Start: binlog v.*/Start version blah blah/ /[0-9]+(\.[0-9]+)*/N/ +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000019 +--echo Short: +--replace_regex /#[0-9]{6} ..:..:../timestamp/ /Start: binlog v.*/Start version blah blah/ /[0-9]+(\.[0-9]+)*/N/ +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000019 +drop table bug18337; + --echo End of 5.1 tests diff -Nrup a/sql/log_event.cc b/sql/log_event.cc --- a/sql/log_event.cc 2007-12-20 15:24:03 -05:00 +++ b/sql/log_event.cc 2008-01-23 19:01:10 -05:00 @@ -6718,17 +6718,18 @@ void Rows_log_event::print_helper(FILE * { IO_CACHE *const head= &print_event_info->head_cache; IO_CACHE *const body= &print_event_info->body_cache; + bool const last_stmt_event= get_flags(STMT_END_F); + if (!print_event_info->short_form) { - bool const last_stmt_event= get_flags(STMT_END_F); print_header(head, print_event_info, !last_stmt_event); my_b_printf(head, "\t%s: table id %lu%s\n", name, m_table_id, last_stmt_event ? " flags: STMT_END_F" : ""); - print_base64(body, print_event_info, !last_stmt_event); } + print_base64(body, print_event_info, !last_stmt_event); - if (get_flags(STMT_END_F)) + if (last_stmt_event != NULL) { copy_event_cache_to_file_and_reinit(head, file); copy_event_cache_to_file_and_reinit(body, file); @@ -7259,8 +7260,8 @@ void Table_map_log_event::print(FILE *fi my_b_printf(&print_event_info->head_cache, "\tTable_map: `%s`.`%s` mapped to number %lu\n", m_dbnam, m_tblnam, m_table_id); - print_base64(&print_event_info->body_cache, print_event_info, TRUE); } + print_base64(&print_event_info->body_cache, print_event_info, TRUE); } #endif