List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:April 7 2008 5:22pm
Subject:bk commit into 5.1 tree (aelkin:1.2567) BUG#35762
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of aelkin.  When aelkin 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-04-07 20:21:05+03:00, aelkin@mysql1000.(none) +3 -0
  Bug #35762 Failing CREATE-SELECT steels Table map of the following query
  
  Amoung two artifacts described the former is the critical one.
  It's in that the Table map of a query following failing CREATE..SELECT is skipped from
  instantionating and binlogging both. That ends up with sending a "chopped" (ie without
  the table map head) row-events. The slave can not apply the only data row events.
  It's not easy to force the slave to react with an error in such a case (the second complaint on the bug
  report) because the lack of a table
  in the row handling (Rows_log_event::do_apply_event) is a common situation to mean the event has
  been filtered out basing on the repliation do/ingore rules.
  
  Fixed: table map creating and binlogging is restored via deploying the standard cleanup call in
  select_create::abort().
  No error is reported if by chance the table map was not been binlogged.
  Leaving this out to resolve with considering how to combine the do/ingore rules with the situation
  when erronoulsy the Table_map is not written to binlog.
   

  mysql-test/suite/rpl/r/rpl_row_create_table.result@stripped, 2008-04-07 20:21:03+03:00, aelkin@mysql1000.(none) +13 -0
    results changed

  mysql-test/suite/rpl/t/rpl_row_create_table.test@stripped, 2008-04-07 20:21:03+03:00, aelkin@mysql1000.(none) +26 -0
    regression test for the bug

  sql/sql_insert.cc@stripped, 2008-04-07 20:21:03+03:00, aelkin@mysql1000.(none) +1 -1
    adding resetting of thd binlogging state that was missed for the particular case of failing CREATE..SELECT

diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result	2008-03-28 15:52:29 +02:00
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result	2008-04-07 20:21:03 +03:00
@@ -417,3 +417,16 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT * FROM t2 ORDER BY a;
 a
 DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(1);
+CREATE TABLE t2 (a INT UNIQUE) ENGINE=INNODB SELECT * FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'a'
+INSERT INTO t1 VALUES (2);
+the proof of the fix: select must show that the last insert performed on the slave
+SELECT * FROM t1;
+a
+1
+1
+2
+DROP TABLE t1;
+end of the tests
diff -Nrup a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test	2008-03-28 14:16:38 +02:00
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test	2008-04-07 20:21:03 +03:00
@@ -234,3 +234,29 @@ SELECT * FROM t2 ORDER BY a;
 connection master;
 DROP TABLE t1,t2;
 sync_slave_with_master;
+
+#
+# bug#35762 Failing CREATE-SELECT produces bad binlog in row mode
+#
+
+connection master;
+
+CREATE TABLE t1 (a INT);
+
+INSERT INTO t1 VALUES (1),(1);
+--error ER_DUP_ENTRY
+CREATE TABLE t2 (a INT UNIQUE) ENGINE=INNODB SELECT * FROM t1;
+INSERT INTO t1 VALUES (2);
+
+sync_slave_with_master;
+# connection slave;
+
+--echo the proof of the fix: select must show that the last insert performed on the slave
+SELECT * FROM t1;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+
+--echo end of the tests
diff -Nrup a/sql/sql_insert.cc b/sql/sql_insert.cc
--- a/sql/sql_insert.cc	2008-03-28 19:58:21 +02:00
+++ b/sql/sql_insert.cc	2008-04-07 20:21:03 +03:00
@@ -3720,7 +3720,7 @@ void select_create::abort()
   select_insert::abort();
   thd->transaction.stmt.modified_non_trans_table= FALSE;
   reenable_binlog(thd);
-
+  thd->binlog_flush_pending_rows_event(TRUE);
 
   if (m_plock)
   {
Thread
bk commit into 5.1 tree (aelkin:1.2567) BUG#35762Andrei Elkin7 Apr
  • Re: bk commit into 5.1 tree (aelkin:1.2567) BUG#35762Mats Kindahl8 Apr