List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:July 20 2011 8:57am
Subject:bzr push into mysql-trunk branch (alfranio.correia:3280 to 3281)
View as plain text  
 3281 Alfranio Correia	2011-07-20 [merge]
      merge mysql-trunk (local) --> mysql-trunk

    modified:
      sql/ha_ndbcluster.cc
      sql/log_event.cc
 3280 Tor Didriksen	2011-07-20 [merge]
      merge 5.5 => trunk

    modified:
      mysql-test/t/implicit_commit.test
      sql/sql_class.cc
      sql/sql_profile.cc
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-07-07 11:51:59 +0000
+++ b/sql/ha_ndbcluster.cc	2011-07-18 17:06:31 +0000
@@ -4614,8 +4614,8 @@ void ha_ndbcluster::transaction_checks(T
 
       \Alfranio
     */
-    thd->transaction.all.mark_modified_non_trans_table();
     thd->transaction.stmt.mark_modified_non_trans_table();
+    thd->transaction.merge_unsafe_rollback_flags();
   }
   else if (!thd->transaction.on)
     m_transaction_on= FALSE;

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-07-15 11:48:35 +0000
+++ b/sql/log_event.cc	2011-07-20 08:55:56 +0000
@@ -8139,7 +8139,6 @@ int Rows_log_event::do_apply_event(Relay
 
   if (table)
   {
-    bool transactional_table= table->file->has_transactions();
     /*
       table == NULL means that this table should not be replicated
       (this was set up by Table_map_log_event::do_apply_event()
@@ -8210,6 +8209,7 @@ int Rows_log_event::do_apply_event(Relay
 
     // row processing loop
 
+    const uchar *saved_m_curr_row= m_curr_row;
     while (error == 0)
     {
       /* in_use can have been set to NULL in close_tables_for_reopen */
@@ -8229,7 +8229,7 @@ int Rows_log_event::do_apply_event(Relay
       {
         int actual_error= convert_handler_error(error, thd, table);
         bool idempotent_error= (idempotent_error_code(error) &&
-                               (slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT));
+                                slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT);
         bool ignored_error= (idempotent_error == 0 ?
                              ignored_error_code(actual_error) : 0);
 
@@ -8247,40 +8247,53 @@ int Rows_log_event::do_apply_event(Relay
         }
       }
 
-      /*
-       If m_curr_row_end  was not set during event execution (e.g., because
-       of errors) we can't proceed to the next row. If the error is transient
-       (i.e., error==0 at this point) we must call unpack_current_row() to set 
-       m_curr_row_end.
-      */ 
-   
       DBUG_PRINT("info", ("curr_row: 0x%lu; curr_row_end: 0x%lu; rows_end: 0x%lu",
                           (ulong) m_curr_row, (ulong) m_curr_row_end, (ulong) m_rows_end));
 
-      if (!m_curr_row_end && !error)
-        error= unpack_current_row(rli, &m_cols);
+      if (!error)
+      {
+        /*
+          If m_curr_row_end  was not set during event execution (e.g., because
+          of errors) we can't proceed to the next row. If the error is transient
+          (i.e., error == 0 at this point) we must call unpack_current_row() to
+          set m_curr_row_end.
+        */ 
+        if (!m_curr_row_end)
+          error= unpack_current_row(rli, &m_cols);
   
+        m_curr_row= m_curr_row_end;
+      }
+
       // at this moment m_curr_row_end should be set
       DBUG_ASSERT(error || m_curr_row_end != NULL); 
       DBUG_ASSERT(error || m_curr_row <= m_curr_row_end);
       DBUG_ASSERT(error || m_curr_row_end <= m_rows_end);
-  
-      m_curr_row= m_curr_row_end;
  
-      if (error == 0 && !transactional_table)
-      {
-        /*
-          We rely on trans_commit_stmt() to propagate unsafe_rollback_flags
-          from statement to transaction level. For that reason, only the
-          statement level is set.
-        */
-        thd->transaction.stmt.mark_modified_non_trans_table();
-      }
-
       if (m_curr_row == m_rows_end)
         break;
     } // row processing loop
 
+    if (saved_m_curr_row != m_curr_row && !table->file->has_transactions())
+    {
+      /*
+        Usually, the trans_commit_stmt() propagates unsafe_rollback_flags
+        from statement to transaction level. However, we cannot rely on
+        this when row format is in use as several events can be processed
+        before calling this function. This happens because it is called
+        only when the latest event generated by a statement is processed.
+
+        There are however upper level functions that execute per event
+        and check transaction's status. So if the unsafe_rollback_flags
+        are not propagated here, this can lead to errors.
+
+        For example, a transaction that updates non-transactional tables
+        may be stopped in the middle thus leading to inconsistencies
+        after a restart.
+      */
+      thd->transaction.stmt.mark_modified_non_trans_table();
+      thd->transaction.merge_unsafe_rollback_flags();
+    }
+
     /*
       Restore the sql_mode after the rows event is processed.
     */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alfranio.correia:3280 to 3281) Alfranio Correia20 Jul