List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:February 27 2008 10:15pm
Subject:bk commit into 5.0 tree (cmiller:1.2580) BUG#33048
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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-02-27 17:15:53-05:00, cmiller@stripped +3 -0
  Bug#33048: Not able to recover binary/blob data correctly using \
  	mysqlbinlog
  
  mysqlbinlog wrote to stdout query text exactly as sent to the server,
  but some queries that can be inserted via the API are illegal or 
  impossible to send using the command-line "mysql" client.
  
  Now, do not consume carriage returns in a CR+NL sequence for 
  noninteractive commands.

  client/readline.cc@stripped, 2008-02-27 17:15:52-05:00, cmiller@stripped +1 -2
    Don't consume a carriage return before a newline in noninteractive
    commands.

  mysql-test/r/type_blob.result@stripped, 2008-02-27 17:15:52-05:00, cmiller@stripped +22 -0
    Show that literal CR+NLs are preserved across mysqlbinlog|mysql .

  mysql-test/t/type_blob.test@stripped, 2008-02-27 17:15:52-05:00, cmiller@stripped +37 -0
    Show that literal CR+NLs are preserved across mysqlbinlog|mysql .

diff -Nrup a/client/readline.cc b/client/readline.cc
--- a/client/readline.cc	2006-12-23 14:04:04 -05:00
+++ b/client/readline.cc	2008-02-27 17:15:52 -05:00
@@ -50,8 +50,7 @@ char *batch_readline(LINE_BUFFER *line_b
   if (!(pos=intern_read_line(line_buff,&out_length)))
     return 0;
   if (out_length && pos[out_length-1] == '\n')
-    if (--out_length && pos[out_length-1] == '\r')  /* Remove '\n' */
-      out_length--;                                 /* Remove '\r' */
+    out_length--;
   line_buff->read_length=out_length;
   pos[out_length]=0;
   return pos;
diff -Nrup a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
--- a/mysql-test/r/type_blob.result	2007-11-19 12:34:12 -05:00
+++ b/mysql-test/r/type_blob.result	2008-02-27 17:15:52 -05:00
@@ -821,4 +821,26 @@ LENGTH(c)	CHAR_LENGTH(c)
 65535	65535
 65535	65535
 DROP TABLE t;
+DROP DATABASE IF EXISTS dbbug33048;
+CREATE DATABASE dbbug33048;
+use dbbug33048;
+CREATE TABLE binfile (i int auto_increment primary key, bin_data LONGBLOB);
+FLUSH LOGS;
+INSERT INTO binfile (bin_data) values ('
+
+
+
');
+SELECT 'good, have failing data' as descr, i FROM binfile where bin_data = x'0d0a0d0d0a0a0d';
+descr	i
+good, have failing data	1
+SELECT bin_data INTO dumpfile 'bug33048-dump1' FROM binfile;
+FLUSH LOGS;
+DELETE FROM binfile;
+SELECT bin_data INTO dumpfile 'bug33048-dump2' FROM binfile;
+SELECT 'good, have failing data' as descr, i FROM binfile where bin_data = x'0d0a0d0d0a0a0d';
+descr	i
+good, have failing data	1
+DROP TABLE binfile;
+use test;
+DROP DATABASE dbbug33048;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
--- a/mysql-test/t/type_blob.test	2007-11-19 12:34:12 -05:00
+++ b/mysql-test/t/type_blob.test	2008-02-27 17:15:52 -05:00
@@ -447,4 +447,41 @@ INSERT INTO t (c) VALUES (REPEAT('3',655
 SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
 DROP TABLE t;
 
+#
+# Bug#33048: Not able to recover binary/blob data correctly using mysqlbinlog
+#
+--disable_warnings
+DROP DATABASE IF EXISTS dbbug33048;
+--enable_warnings
+CREATE DATABASE dbbug33048;
+
+use dbbug33048;
+CREATE TABLE binfile (i int auto_increment primary key, bin_data LONGBLOB);
+
+FLUSH LOGS;
+let $hexrepr=x'0d0a0d0d0a0a0d';
+let $blob=`select $hexrepr`;
+
+eval INSERT INTO binfile (bin_data) values ('$blob');
+eval SELECT 'good, have failing data' as descr, i FROM binfile where bin_data = $hexrepr;
+
+SELECT bin_data INTO dumpfile 'bug33048-dump1' FROM binfile;
+FLUSH LOGS;
+DELETE FROM binfile;
+
+exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=dbbug33048 $MYSQLTEST_VARDIR/log/master-bin.000002 |$MYSQL dbbug33048;
+
+SELECT bin_data INTO dumpfile 'bug33048-dump2' FROM binfile;
+eval SELECT 'good, have failing data' as descr, i FROM binfile where bin_data = $hexrepr;
+
+diff_files $MYSQLTEST_VARDIR/master-data/dbbug33048/bug33048-dump1 $MYSQLTEST_VARDIR/master-data/dbbug33048/bug33048-dump2;
+
+remove_file $MYSQLTEST_VARDIR/master-data/dbbug33048/bug33048-dump1;
+remove_file $MYSQLTEST_VARDIR/master-data/dbbug33048/bug33048-dump2;
+
+DROP TABLE binfile;
+use test;
+DROP DATABASE dbbug33048;
+
+##
 --echo End of 5.0 tests
Thread
bk commit into 5.0 tree (cmiller:1.2580) BUG#33048Chad MILLER27 Feb