List:Commits« Previous MessageNext Message »
From:Leonard Zhou Date:February 26 2009 2:00am
Subject:bzr commit into mysql-5.1-bugteam branch (leonard:2810) Bug#22504
View as plain text  
#At file:///home/zhl/mysql/rep/5.1/bug22504/

 2810 Leonard Zhou	2009-02-26
      BUG#22504 load data infile sql statement in replication architecture get error
      
      The problem is issued because we set wrong start position and stop position of query string into binlog.
      That two values is stored as part of head info of query string.
      So when we parse binlog, we will get position values then get the query string according position values.
      But seems that two values is not calculated correctly after the parse of Yacc.
      
      We don't wan to touch so much of yacc because it maybe influence other code.
      So just add one space after 'INTO' key word when parsing.
      This can easily resolve the problem.
modified:
  mysql-test/suite/rpl/r/rpl_loaddatalocal.result
  mysql-test/suite/rpl/t/rpl_loaddatalocal.test
  sql/log_event.cc

per-file messages:
  mysql-test/suite/rpl/r/rpl_loaddatalocal.result
    Test result
  mysql-test/suite/rpl/t/rpl_loaddatalocal.test
    Test case
  sql/log_event.cc
    Add space after 'INTO'.
=== modified file 'mysql-test/suite/rpl/r/rpl_loaddatalocal.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result	2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result	2009-02-26 02:00:11 +0000
@@ -29,3 +29,28 @@ a
 2
 3
 drop table t1;
+==== Bug22504 Initialize ====
+[on master]
+SET sql_mode='ignore_space';
+CREATE TABLE t1(a int);
+insert into t1 values (1), (2), (3), (4);
+select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
+truncate table t1;
+load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+[on slave]
+SELECT * FROM t1 ORDER BY a;
+a
+1
+2
+3
+4
+==== Clean up ====
+[on master]
+DROP TABLE t1;
+[on slave]

=== modified file 'mysql-test/suite/rpl/t/rpl_loaddatalocal.test'
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test	2008-10-23 19:27:09 +0000
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test	2009-02-26 02:00:11 +0000
@@ -64,3 +64,37 @@ drop table t1;
 save_master_pos;
 connection slave;
 sync_with_master;
+
+
+#
+# Bug22504 load data infile sql statement in replication architecture get error
+#
+--echo ==== Bug22504 Initialize ====
+
+--echo [on master]
+--connection master
+
+SET sql_mode='ignore_space';
+CREATE TABLE t1(a int);
+insert into t1 values (1), (2), (3), (4);
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
+truncate table t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
+SELECT * FROM t1 ORDER BY a;
+
+--echo [on slave]
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+--echo ==== Clean up ====
+
+--echo [on master]
+connection master;
+DROP TABLE t1;
+
+--echo [on slave]
+sync_slave_with_master;
+

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-02-04 11:08:27 +0000
+++ b/sql/log_event.cc	2009-02-26 02:00:11 +0000
@@ -6618,7 +6618,7 @@ void Execute_load_query_log_event::print
     my_b_printf(&cache, "\'");
     if (dup_handling == LOAD_DUP_REPLACE)
       my_b_printf(&cache, " REPLACE");
-    my_b_printf(&cache, " INTO");
+    my_b_printf(&cache, " INTO ");
     my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end);
     my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
   }
@@ -6699,7 +6699,7 @@ Execute_load_query_log_event::do_apply_e
     /* Ordinary load data */
     break;
   }
-  p= strmake(p, STRING_WITH_LEN(" INTO"));
+  p= strmake(p, STRING_WITH_LEN(" INTO "));
   p= strmake(p, query+fn_pos_end, q_len-fn_pos_end);
 
   error= Query_log_event::do_apply_event(rli, buf, p-buf);

Thread
bzr commit into mysql-5.1-bugteam branch (leonard:2810) Bug#22504Leonard Zhou28 Feb
  • Re: bzr commit into mysql-5.1-bugteam branch (leonard:2810) Bug#22504Guangbao Ni2 Mar
  • Re: bzr commit into mysql-5.1-bugteam branch (leonard:2810) Bug#22504Andrei Elkin2 Mar