MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:May 29 2007 12:53pm
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

ChangeSet@stripped, 2007-05-29 15:53:03+03:00, aelkin@stripped +1 -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 wrong usage of ndb->extra:s.
  Fixed with resetting flags at do_after.
  There is open issue with symmetrical resetting
  which i had to hand to bug#27077.
  The test for the current bug was committed in a cset for bug#27320.

  sql/, 2007-05-29 15:53:01+03:00, aelkin@stripped +31 -7
    fixing do_after_row_operation to reset the effect of the extra engine's 
    flags set at do_before;
    comments on meaning of extra flags added;
    execution of table->file->ha_end_bulk_insert() in do_after is not dependant on error;

# 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:
# Root:	/home/elkin/MySQL/TEAM/FIXES/5.1/bug27044_slave_dup2unique

--- 1.273/sql/	2007-03-01 16:16:13 +02:00
+++ 1.274/sql/	2007-05-29 15:53:01 +03:00
@@ -6601,10 +6601,23 @@ int Write_rows_log_event::do_before_row_
     lex->duplicates flag.
   thd->lex->sql_command= SQLCOM_REPLACE;
-  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
+  /* 
+     Do not raise the error flag in case of hitting to an unique attribute
+  */
+  table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
+  /* 
+     NDB specific: update from ndb master wrapped as Write_rows
+  */
+  /*
+    so that the event should be applied to replace slave's row
+  */
+  table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
+  /* 
+     NDB specific: if update from ndb master wrapped as Write_rows
+     does not find the row it's assumed idempotent binlog applying
+     is taking place; don't raise the error.
+  */
+  table->file->extra(HA_EXTRA_IGNORE_NO_KEY);
     TODO: the cluster team (Tomas?) says that it's better if the engine knows
     how many rows are going to be inserted, then it can allocate needed memory
@@ -6632,9 +6645,20 @@ int Write_rows_log_event::do_before_row_
 int Write_rows_log_event::do_after_row_operations(TABLE *table, int error)
-  if (error == 0)
-    error= table->file->ha_end_bulk_insert();
-  return error;
+  int local_error= 0;
+  table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
+  table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
+  /*
+    reseting the extra with 
+    table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY); 
+    fires bug#27077
+    todo: explain or fix
+  */
+  if (local_error= table->file->ha_end_bulk_insert())
+  {
+    table->file->print_error(local_error, MYF(0));
+  }
+  return error? error : local_error;
 int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli,
bk commit into 5.1 tree (aelkin:1.2472) BUG#27044Andrei Elkin29 May