List:Commits« Previous MessageNext Message »
From:Luis Soares Date:July 15 2011 11:51am
Subject:bzr push into mysql-trunk branch (luis.soares:3262 to 3263)
View as plain text  
 3263 Luis Soares	2011-07-15 [merge]
      Automerge from mysql-5.5 into mysql-trunk.

    modified:
      sql/log_event.cc
 3262 Gleb Shchepa	2011-07-14
      BUG #11754979 - 46675: ON DUPLICATE KEY UPDATE AND UPDATECOUNT() POSSIBLY WRONG
      
      The mysql_affected_rows() client call returns 3 instead of 2 on
      INSERT ... ON DUPLICATE KEY UPDATE query with a duplicated key value.
      
      The fix for the old bug #29692 was incomplete: unnecessary double
      increment of "touched" rows still happened.
      
      This bugfix removes:
      1) unneeded increment of "touched" rows and
      2) useless double resetting of auto-increment value.
     @ sql/sql_insert.cc
        write_record() function:
        Unneeded increment of "touched" rows and useless double resetting
        of auto-increment value has been removed.
     @ tests/mysql_client_test.c
        New test case.

    modified:
      sql/sql_insert.cc
      tests/mysql_client_test.c
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-07-14 12:46:00 +0000
+++ b/sql/log_event.cc	2011-07-15 11:48:35 +0000
@@ -101,6 +101,11 @@ static int rows_event_stmt_cleanup(Relay
 
 static const char *HA_ERR(int i)
 {
+  /* 
+    This function should only be called in case of an error
+    was detected 
+   */
+  DBUG_ASSERT(i != 0);
   switch (i) {
   case HA_ERR_KEY_NOT_FOUND: return "HA_ERR_KEY_NOT_FOUND";
   case HA_ERR_FOUND_DUPP_KEY: return "HA_ERR_FOUND_DUPP_KEY";
@@ -153,7 +158,7 @@ static const char *HA_ERR(int i)
   case HA_ERR_CORRUPT_EVENT: return "HA_ERR_CORRUPT_EVENT";
   case HA_ERR_ROWS_EVENT_APPLY : return "HA_ERR_ROWS_EVENT_APPLY";
   }
-  return 0;
+  return "No Error!";
 }
 
 /**
@@ -205,7 +210,7 @@ static void inline slave_rows_error_repo
                                            TABLE *table, const char * type,
                                            const char *log_name, ulong pos)
 {
-  const char *handler_error= HA_ERR(ha_error);
+  const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL);
   char buff[MAX_SLAVE_ERRMSG], *slider;
   const char *buff_end= buff + sizeof(buff);
   uint len;
@@ -8214,7 +8219,8 @@ int Rows_log_event::do_apply_event(Relay
 
       error= do_exec_row(rli);
 
-      DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
+      if (error)
+        DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
       DBUG_ASSERT(error != HA_ERR_RECORD_DELETED);
 
       table->in_use = old_thd;
@@ -10226,7 +10232,8 @@ TABLE_SCAN:
   restart_ha_rnd_next:
       error= table->file->ha_rnd_next(table->record[0]);
 
-      DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
+      if (error)
+        DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
       switch (error) {
 
       case 0:

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (luis.soares:3262 to 3263) Luis Soares17 Jul