List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:March 13 2007 9:38am
Subject:bk commit into 5.1 tree (aelkin:1.2472) BUG#27044
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of elkin. When elkin 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, 2007-03-13 11:38:06+02:00, aelkin@stripped +3 -0
  Bug#27044 replicated with unique field ndb table allows duplkey inserts
  The bug in that slave version of a table with unique field still was
  able to execute INSERT query as replace whereas it's impossible on master.
  
  The reason of this artifact is lack of resetting of extra() [see files' comments]

  mysql-test/r/rpl_ndb_do_table.result@stripped, 2007-03-13 11:38:03+02:00, aelkin@stripped +4 -0
    results changed

  mysql-test/t/rpl_ndb_do_table.test@stripped, 2007-03-13 11:38:03+02:00, aelkin@stripped +12 -0
    regression test for the bug. Since it appeared to be not possible
    to summon the bug with other engines, the test is here.

  sql/log_event.cc@stripped, 2007-03-13 11:38:04+02:00, aelkin@stripped +5 -0
    do_after_row_operation resets effects of d_before_'s work that 
    instructed the table handler to ignore duplicates and replace
    with:
      table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);  // Needed for ndbcluster
      table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);  // Needed for ndbcluster
      table->file->extra(HA_EXTRA_IGNORE_NO_KEY);   // Needed for ndbcluster
    
    According to sql_insert.cc code resetting is necessary completing part
    replace execution. And that was missed in replication code. 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	aelkin
# Host:	dsl-kpogw6-fe8ddc00-181.dhcp.inet.fi
# Root:	/home/elkin/MySQL/TEAM/FIXES/5.1/bug27044_slave_dup2unique

--- 1.273/sql/log_event.cc	2007-03-01 16:16:13 +02:00
+++ 1.274/sql/log_event.cc	2007-03-13 11:38:04 +02:00
@@ -6633,7 +6633,12 @@
 int Write_rows_log_event::do_after_row_operations(TABLE *table, int error)
 {
   if (error == 0)
+  {
+    table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
+    table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
+    table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY);
     error= table->file->ha_end_bulk_insert();
+  }
   return error;
 }
 

--- 1.2/mysql-test/r/rpl_ndb_do_table.result	2007-01-04 05:08:31 +02:00
+++ 1.3/mysql-test/r/rpl_ndb_do_table.result	2007-03-13 11:38:03 +02:00
@@ -19,4 +19,8 @@
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 3
+INSERT INTO t1 VALUES (3, repeat('bad',1));
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
+INSERT INTO t1 VALUES (3, repeat('bad too',1));
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
 DROP TABLE IF EXISTS t1, t2;

--- 1.2/mysql-test/t/rpl_ndb_do_table.test	2007-01-04 05:08:22 +02:00
+++ 1.3/mysql-test/t/rpl_ndb_do_table.test	2007-03-13 11:38:03 +02:00
@@ -27,6 +27,18 @@
 SHOW TABLES;
 SELECT COUNT(*) FROM t1;
 
+#
+# Bug #27044 replicated with unique field ndb table allows dup key inserts
+#
+connection master;
+
+--error 1582
+INSERT INTO t1 VALUES (3, repeat('bad',1));
+
+connection slave;
+--error 1582
+INSERT INTO t1 VALUES (3, repeat('bad too',1));
+
 connection master;
 DROP TABLE IF EXISTS t1, t2;
 --sync_slave_with_master
Thread
bk commit into 5.1 tree (aelkin:1.2472) BUG#27044Andrei Elkin13 Mar