List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:May 11 2012 10:44am
Subject:bzr push into mysql-trunk branch (magnus.blaudd:3813 to 3814)
View as plain text  
 3814 magnus.blaudd@stripped	2012-05-11 [merge]
      Merge

    modified:
      sql/log_event.cc
      sql/rpl_reporting.cc
      sql/rpl_reporting.h
      sql/rpl_slave.cc
      sql/share/errmsg-utf8.txt
 3813 Vasil Dimov	2012-05-11
      Change RENAME TABLE where it renames the table stats to use UPDATE
      insead of delete and save because at the time dict_stats_save() is
      called the table be closed and in-memory stats cleared.
      
      UPDATE was not used before because of the foreign key which existed
      between the stats tables. The foreign key is now removed.
      
      As a side effect, the result in the exceptional case where rows exist
      for the new table name is changed. Instead of overwriting existing rows
      (which was the case with delete and save()) now the existing rows are
      left and RENAME TABLE emits a warning that it failed to rename the table
      stats.

    modified:
      mysql-test/suite/innodb/r/innodb_stats_rename_table_if_exists.result
      mysql-test/suite/innodb/t/innodb_stats_rename_table_if_exists.test
      storage/innobase/dict/dict0stats.cc
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2012-05-09 16:53:03 +0000
+++ b/sql/log_event.cc	2012-05-11 10:15:28 +0000
@@ -4328,6 +4328,35 @@ int Query_log_event::do_apply_event(Rela
   return do_apply_event(rli, query, q_len);
 }
 
+/*
+  is_silent_error
+
+  Return true if the thread has an error which should be
+  handled silently
+*/
+  
+static bool is_silent_error(THD* thd)
+{
+  DBUG_ENTER("is_silent_error");
+  Diagnostics_area::Sql_condition_iterator it=
+    thd->get_stmt_da()->sql_conditions();
+  const Sql_condition *err;
+  while ((err= it++))
+  {
+    DBUG_PRINT("info", ("has condition %d %s", err->get_sql_errno(),
+                        err->get_message_text()));
+    switch (err->get_sql_errno())
+    {
+    case ER_SLAVE_SILENT_RETRY_TRANSACTION:
+    {
+      DBUG_RETURN(true);
+    }
+    default:
+      break;
+    }
+  }
+  DBUG_RETURN(false);
+}
 
 /**
   @todo
@@ -4677,11 +4706,14 @@ Default database: '%s'. Query: '%s'",
     */
     else if (thd->is_slave_error || thd->is_fatal_error)
     {
-      rli->report(ERROR_LEVEL, actual_error,
-                      "Error '%s' on query. Default database: '%s'. Query: '%s'",
-                      (actual_error ? thd->get_stmt_da()->message() :
-                       "unexpected success or fatal error"),
-                      print_slave_db_safe(thd->db), query_arg);
+      if (!is_silent_error(thd))
+      {
+        rli->report(ERROR_LEVEL, actual_error,
+                    "Error '%s' on query. Default database: '%s'. Query: '%s'",
+                    (actual_error ? thd->get_stmt_da()->message() :
+                     "unexpected success or fatal error"),
+                    print_slave_db_safe(thd->db), query_arg);
+      }
       thd->is_slave_error= 1;
     }
 

=== modified file 'sql/rpl_reporting.cc'
--- a/sql/rpl_reporting.cc	2012-05-03 08:11:43 +0000
+++ b/sql/rpl_reporting.cc	2012-05-11 10:15:28 +0000
@@ -38,10 +38,12 @@ Slave_reporting_capability::Slave_report
   @error_arg  the error code for assessment. 
               defaults to zero which makes the function check the top
               of the reported errors stack.
+  @silent     bool indicating whether the error should be silently handled.
 
   @return 1 as the positive and 0 as the negative verdict
 */
-int Slave_reporting_capability::has_temporary_error(THD *thd, uint error_arg) const
+int Slave_reporting_capability::has_temporary_error(THD *thd, 
+                                                    uint error_arg, bool* silent) const
 {
   uint error;
   DBUG_ENTER("has_temporary_error");
@@ -75,7 +77,6 @@ int Slave_reporting_capability::has_temp
       (error == ER_LOCK_DEADLOCK || error == ER_LOCK_WAIT_TIMEOUT))
     DBUG_RETURN(1);
 
-#ifdef HAVE_NDB_BINLOG
   /*
     currently temporary error set in ndbcluster
   */
@@ -90,11 +91,16 @@ int Slave_reporting_capability::has_temp
     {
     case ER_GET_TEMPORARY_ERRMSG:
       DBUG_RETURN(1);
+    case ER_SLAVE_SILENT_RETRY_TRANSACTION:
+    {
+      if (silent != NULL)
+        *silent= true;
+      DBUG_RETURN(1);
+    }
     default:
       break;
     }
   }
-#endif
   DBUG_RETURN(0);
 }
 #endif // EMBEDDED_LIBRARY

=== modified file 'sql/rpl_reporting.h'
--- a/sql/rpl_reporting.h	2012-05-03 08:11:43 +0000
+++ b/sql/rpl_reporting.h	2012-05-11 10:15:28 +0000
@@ -76,7 +76,7 @@ public:
   /**
      Check if the current error is of temporary nature or not.
   */
-  int has_temporary_error(THD *thd, uint error_arg= 0) const;
+  int has_temporary_error(THD *thd, uint error_arg= 0, bool* silent= 0) const;
 #endif // EMBEDDED_LIBRARY
   
   /**

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2012-05-08 17:11:38 +0000
+++ b/sql/rpl_slave.cc	2012-05-11 10:15:28 +0000
@@ -3623,8 +3623,9 @@ static int exec_relay_log_event(THD* thd
     if (slave_trans_retries)
     {
       int UNINIT_VAR(temp_err);
+      bool silent= false;
       if (exec_res && !is_mts_worker(thd) /* no reexecution in MTS mode */ &&
-          (temp_err= rli->has_temporary_error(thd)) &&
+          (temp_err= rli->has_temporary_error(thd, 0, &silent)) &&
           !thd->transaction.all.cannot_safely_rollback())
       {
         const char *errmsg;
@@ -3663,7 +3664,9 @@ static int exec_relay_log_event(THD* thd
             slave_sleep(thd, min<ulong>(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE),
                         sql_slave_killed, rli);
             mysql_mutex_lock(&rli->data_lock); // because of SHOW STATUS
-            rli->trans_retries++;
+            if (!silent)
+              rli->trans_retries++;
+            
             rli->retried_trans++;
             mysql_mutex_unlock(&rli->data_lock);
             DBUG_PRINT("info", ("Slave retries transaction "

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2012-05-10 08:12:13 +0000
+++ b/sql/share/errmsg-utf8.txt	2012-05-11 10:15:28 +0000
@@ -6760,6 +6760,9 @@ ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
   eng "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted"
   ger "Spaltenanzahl von %s.%s falsch. %d erwartet, aber %d gefunden. Tabelle ist wahrscheinlich beschädigt"
 
+ER_SLAVE_SILENT_RETRY_TRANSACTION
+  eng "Slave must silently retry current transaction"
+
 #
 #  End of 5.6 error messages.
 #

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (magnus.blaudd:3813 to 3814) magnus.blaudd11 May