MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:October 9 2009 8:55am
Subject:bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3154) Bug#47323
View as plain text  
#At file:///media/sdb2/hezx/work/mysql/bzrwork/r47323/5.1-bugteam/ based on revid:magnus.blaudd@stripped5329-js8uwfs4iym6nlnz

 3154 He Zhenxing	2009-10-09
      Bug#47323 : mysqlbinlog --verbose displays bad output when events contain subset of columns
      
      Commit the non-NDB specific part (originated by frazer) to 5.1 mainline.

    A  mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
    A  mysql-test/suite/binlog/std_data/update-full-row.binlog
    A  mysql-test/suite/binlog/std_data/update-partial-row.binlog
    A  mysql-test/suite/binlog/std_data/write-full-row.binlog
    A  mysql-test/suite/binlog/std_data/write-partial-row.binlog
    A  mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test
    M  sql/log_event.cc
=== added file 'mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result'
--- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result	2009-10-09 08:54:48 +0000
@@ -0,0 +1,161 @@
+Verbose statements from : write-partial-row.binlog
+select txt from raw_binlog_rows where txt like '###%';
+txt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+###   @1=1
+###   @2=25769803786
+###   @3=''
+###   @4=0
+###   @5=0
+### INSERT INTO test.ba
+### SET
+###   @1=3
+###   @2=3
+###   @3=3
+### INSERT INTO test.ba
+### SET
+###   @1=1
+###   @2=1
+###   @3=1
+### INSERT INTO test.ba
+### SET
+###   @1=2
+###   @2=2
+###   @3=2
+### INSERT INTO test.ba
+### SET
+###   @1=4
+###   @2=4
+###   @3=4
+### INSERT INTO test.ba
+### SET
+###   @1=4
+###   @3=40
+### DELETE FROM test.ba
+### WHERE
+###   @1=2
+drop table raw_binlog_rows;
+Verbose statements from : write-full-row.binlog
+select txt from raw_binlog_rows where txt like '###%';
+txt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+###   @1=2
+###   @2=25769803786
+###   @3=''
+###   @4=0
+###   @5=0
+### INSERT INTO test.ba
+### SET
+###   @1=3
+###   @2=3
+###   @3=3
+### INSERT INTO test.ba
+### SET
+###   @1=1
+###   @2=1
+###   @3=1
+### INSERT INTO test.ba
+### SET
+###   @1=2
+###   @2=2
+###   @3=2
+### INSERT INTO test.ba
+### SET
+###   @1=4
+###   @2=4
+###   @3=4
+### INSERT INTO test.ba
+### SET
+###   @1=4
+###   @2=4
+###   @3=40
+### DELETE FROM test.ba
+### WHERE
+###   @1=2
+drop table raw_binlog_rows;
+Verbose statements from : update-partial-row.binlog
+select txt from raw_binlog_rows where txt like '###%';
+txt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+###   @1=3
+###   @2=25769803786
+###   @3=''
+###   @4=0
+###   @5=0
+### INSERT INTO test.ba
+### SET
+###   @1=3
+###   @2=3
+###   @3=3
+### INSERT INTO test.ba
+### SET
+###   @1=1
+###   @2=1
+###   @3=1
+### INSERT INTO test.ba
+### SET
+###   @1=2
+###   @2=2
+###   @3=2
+### INSERT INTO test.ba
+### SET
+###   @1=4
+###   @2=4
+###   @3=4
+### UPDATE test.ba
+### WHERE
+###   @1=4
+###   @3=4
+### SET
+###   @1=4
+###   @3=40
+### DELETE FROM test.ba
+### WHERE
+###   @1=2
+drop table raw_binlog_rows;
+Verbose statements from : update-full-row.binlog
+select txt from raw_binlog_rows where txt like '###%';
+txt
+### INSERT INTO mysql.ndb_apply_status
+### SET
+###   @1=4
+###   @2=25769803786
+###   @3=''
+###   @4=0
+###   @5=0
+### INSERT INTO test.ba
+### SET
+###   @1=3
+###   @2=3
+###   @3=3
+### INSERT INTO test.ba
+### SET
+###   @1=1
+###   @2=1
+###   @3=1
+### INSERT INTO test.ba
+### SET
+###   @1=2
+###   @2=2
+###   @3=2
+### INSERT INTO test.ba
+### SET
+###   @1=4
+###   @2=4
+###   @3=4
+### UPDATE test.ba
+### WHERE
+###   @1=4
+###   @2=4
+###   @3=4
+### SET
+###   @1=4
+###   @2=4
+###   @3=40
+### DELETE FROM test.ba
+### WHERE
+###   @1=2
+drop table raw_binlog_rows;

=== added file 'mysql-test/suite/binlog/std_data/update-full-row.binlog'
二进制文件a/mysql-test/suite/binlog/std_data/update-full-row.binlog	1970-01-01 00:00:00 +0000和b/mysql-test/suite/binlog/std_data/update-full-row.binlog	2009-10-09 08:54:48 +0000有差异

=== added file 'mysql-test/suite/binlog/std_data/update-partial-row.binlog'
二进制文件a/mysql-test/suite/binlog/std_data/update-partial-row.binlog	1970-01-01 00:00:00 +0000和b/mysql-test/suite/binlog/std_data/update-partial-row.binlog	2009-10-09 08:54:48 +0000有差异

=== added file 'mysql-test/suite/binlog/std_data/write-full-row.binlog'
二进制文件a/mysql-test/suite/binlog/std_data/write-full-row.binlog	1970-01-01 00:00:00 +0000和b/mysql-test/suite/binlog/std_data/write-full-row.binlog	2009-10-09 08:54:48 +0000有差异

=== added file 'mysql-test/suite/binlog/std_data/write-partial-row.binlog'
二进制文件a/mysql-test/suite/binlog/std_data/write-partial-row.binlog	1970-01-01 00:00:00 +0000和b/mysql-test/suite/binlog/std_data/write-partial-row.binlog	2009-10-09 08:54:48 +0000有差异

=== added file 'mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test'
--- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test	2009-10-09 08:54:48 +0000
@@ -0,0 +1,82 @@
+########################################################
+# Test mysqlbinlog command with Ndb produced Binlog
+# variants
+#
+# WHAT
+# ====
+#  This test aims to check that the mysqlbinlog --verbose
+#  command can output binlogs in 4 format variants, currently
+#  used by Ndb
+#
+#  1) Updates logged as write_row events
+#     Only primary key and updated columns included in the 
+#     event
+#  2) Updates logged as write_row_events
+#     All columns included in the event
+#  3) Updates logged as update_row events
+#     Only primary key and updated columns included in the
+#     event
+#  4) Updates logged as update_row events
+#     All columns included in the event
+#
+# Format variant (1) is the Ndb default.
+# Bug#47323 resulted in binlogs generated in format (1) 
+# being incorrectly parsed by the mysqlbinlog --verbose
+# option
+#
+# HOW
+# ===
+#  Row-based binlog files in each format have been 
+#  captured from an Ndb cluster
+#  These are output using the mysqlbinlog --verbose
+#  tool and the output is checked.
+#
+########################################################
+
+# We require binlog_format_row as we're independent of binlog format
+# and there's no point running the same test 3 times
+-- source include/have_binlog_format_row.inc
+
+--disable_query_log
+--let $binlog_file=write-partial-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+select txt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;
+
+--disable_query_log
+--let $binlog_file=write-full-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+select txt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;
+
+--disable_query_log
+--let $binlog_file=update-partial-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+select txt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;
+
+--disable_query_log
+--let $binlog_file=update-full-row.binlog
+--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+create table raw_binlog_rows (txt varchar(1000));
+--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
+--enable_query_log
+--echo Verbose statements from : $binlog_file
+select txt from raw_binlog_rows where txt like '###%';
+drop table raw_binlog_rows;

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-09-29 13:08:18 +0000
+++ b/sql/log_event.cc	2009-10-09 08:54:48 +0000
@@ -1852,6 +1852,7 @@ Rows_log_event::print_verbose_one_row(IO
 {
   const uchar *value0= value;
   const uchar *null_bits= value;
+  uint null_bit_index= 0;
   char typestr[64]= "";
   
   value+= (m_width + 7) / 8;
@@ -1860,7 +1861,8 @@ Rows_log_event::print_verbose_one_row(IO
   
   for (size_t i= 0; i < td->size(); i ++)
   {
-    int is_null= (null_bits[i / 8] >> (i % 8))  & 0x01;
+    int is_null= (null_bits[null_bit_index / 8] 
+                  >> (null_bit_index % 8))  & 0x01;
 
     if (bitmap_is_set(cols_bitmap, i) == 0)
       continue;
@@ -1897,6 +1899,8 @@ Rows_log_event::print_verbose_one_row(IO
     }
     
     my_b_printf(file, "\n");
+    
+    null_bit_index++;
   }
   return value - value0;
 }

Attachment: [text/bzr-bundle] bzr/zhenxing.he@sun.com-20091009085448-nb5x4vl8atpy3d5r.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3154) Bug#47323He Zhenxing9 Oct