[Commits] Rev 3948: logging in file:///home/bell/maria/bzr/work-maria-5.5-MDEV-5095/

sanja at askmonty.org sanja at askmonty.org
Mon Dec 2 15:51:00 EET 2013


At file:///home/bell/maria/bzr/work-maria-5.5-MDEV-5095/

------------------------------------------------------------
revno: 3948
revision-id: sanja at askmonty.org-20131202135028-h476cfe06kvhor53
parent: sanja at askmonty.org-20131127080832-zhha1ma1gdkcx2oa
committer: sanja at askmonty.org
branch nick: work-maria-5.5-MDEV-5095
timestamp: Mon 2013-12-02 15:50:28 +0200
message:
  logging
-------------- next part --------------
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2013-11-27 08:08:32 +0000
+++ b/sql/log_event.cc	2013-12-02 13:50:28 +0000
@@ -9133,6 +9133,7 @@ Table_map_log_event::Table_map_log_event
 {
   uchar cbuf[sizeof(m_colcnt) + 1];
   uchar *cbuf_end;
+  DBUG_ENTER("Table_map_log_event::Table_map_log_event(TABLE)");
   DBUG_ASSERT(m_table_id != ~0UL);
   /*
     In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
@@ -9200,6 +9201,7 @@ Table_map_log_event::Table_map_log_event
     if (m_table->field[i]->maybe_null())
       m_null_bits[(i / 8)]+= 1 << (i % 8);
 
+  DBUG_VOID_RETURN;
 }
 #endif /* !defined(MYSQL_CLIENT) */
 
@@ -9914,6 +9916,25 @@ Write_rows_log_event::do_after_row_opera
 
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
 
+bool Rows_log_event::process_triggers(trg_event_type event,
+                                      trg_action_time_type time_type,
+                                      bool old_row_is_record1)
+{
+  bool result;
+  DBUG_ENTER("Rows_log_event::process_triggers");
+  if (slave_run_triggers_for_rbr == SLAVE_RUN_TRIGGERS_FOR_RBR_YES)
+  {
+    tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
+    result= m_table->triggers->process_triggers(thd, event,
+                                              time_type, old_row_is_record1);
+    reenable_binlog(thd);
+  }
+  else
+    result= m_table->triggers->process_triggers(thd, event,
+                                              time_type, old_row_is_record1);
+
+  DBUG_RETURN(result);
+}
 /*
   Check if there are more UNIQUE keys after the given key.
 */
@@ -10027,9 +10048,8 @@ Rows_log_event::write_row(const Relay_lo
   DBUG_PRINT_BITSET("debug", "read_set = %s", table->read_set);
 #endif
 
-  if(invoke_triggers &&
-     table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
-                                       TRG_ACTION_BEFORE, TRUE))
+  if (invoke_triggers &&
+      process_triggers(TRG_EVENT_INSERT, TRG_ACTION_BEFORE, TRUE))
   {
       DBUG_RETURN(HA_ERR_GENERIC); // in case if error is not set yet
   }
@@ -10160,9 +10180,8 @@ Rows_log_event::write_row(const Relay_lo
         !table->file->referenced_by_foreign_key())
     {
       DBUG_PRINT("info",("Updating row using ha_update_row()"));
-      if(invoke_triggers &&
-         table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
-                                           TRG_ACTION_BEFORE, FALSE))
+      if (invoke_triggers &&
+          process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_BEFORE, FALSE))
         error= HA_ERR_GENERIC; // in case if error is not set yet
       else
       {
@@ -10183,10 +10202,8 @@ Rows_log_event::write_row(const Relay_lo
           table->file->print_error(error, MYF(0));
         }
         if (invoke_triggers && !error &&
-            (table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
-                                               TRG_ACTION_AFTER, TRUE) ||
-             table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
-                                                 TRG_ACTION_AFTER, TRUE)))
+            (process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE) ||
+             process_triggers(TRG_EVENT_INSERT, TRG_ACTION_AFTER, TRUE)))
           error= HA_ERR_GENERIC; // in case if error is not set yet
       }
 
@@ -10195,9 +10212,8 @@ Rows_log_event::write_row(const Relay_lo
     else
     {
       DBUG_PRINT("info",("Deleting offending row and trying to write new one again"));
-      if(invoke_triggers &&
-         table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
-                                           TRG_ACTION_BEFORE, TRUE))
+      if (invoke_triggers &&
+          process_triggers(TRG_EVENT_DELETE, TRG_ACTION_BEFORE, TRUE))
         error= HA_ERR_GENERIC; // in case if error is not set yet
       else
       {
@@ -10207,18 +10223,16 @@ Rows_log_event::write_row(const Relay_lo
           table->file->print_error(error, MYF(0));
           DBUG_RETURN(error);
         }
-        if(invoke_triggers &&
-           table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
-                                             TRG_ACTION_AFTER, TRUE))
+        if (invoke_triggers &&
+            process_triggers(TRG_EVENT_DELETE, TRG_ACTION_AFTER, TRUE))
           DBUG_RETURN(HA_ERR_GENERIC); // in case if error is not set yet
       }
       /* Will retry ha_write_row() with the offending row removed. */
     }
   }
 
-  if(invoke_triggers &&
-     table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
-                                       TRG_ACTION_AFTER, TRUE))
+  if (invoke_triggers &&
+      process_triggers(TRG_EVENT_INSERT, TRG_ACTION_AFTER, TRUE))
     error= HA_ERR_GENERIC; // in case if error is not set yet
 
   DBUG_RETURN(error);
@@ -10920,15 +10934,13 @@ int Delete_rows_log_event::do_exec_row(c
     /*
       Delete the record found, located in record[0]
     */
-    if(invoke_triggers &&
-       m_table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
-                                           TRG_ACTION_BEFORE, FALSE))
+    if (invoke_triggers &&
+        process_triggers(TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE))
       error= HA_ERR_GENERIC; // in case if error is not set yet
     if (!error)
       error= m_table->file->ha_delete_row(m_table->record[0]);
     if (invoke_triggers && !error &&
-        m_table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
-                                                    TRG_ACTION_AFTER, FALSE))
+        process_triggers(TRG_EVENT_DELETE, TRG_ACTION_AFTER, FALSE))
       error= HA_ERR_GENERIC; // in case if error is not set yet
     m_table->file->ha_index_or_rnd_end();
   }
@@ -11117,8 +11129,7 @@ Update_rows_log_event::do_exec_row(const
 #endif
 
   if (invoke_triggers &&
-      m_table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
-                                          TRG_ACTION_BEFORE, TRUE))
+      process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_BEFORE, TRUE))
   {
     error= HA_ERR_GENERIC; // in case if error is not set yet
     goto err;
@@ -11129,8 +11140,7 @@ Update_rows_log_event::do_exec_row(const
     error= 0;
 
   if (invoke_triggers && !error &&
-      m_table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
-                                               TRG_ACTION_AFTER, TRUE))
+      process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE))
     error= HA_ERR_GENERIC; // in case if error is not set yet
 
 err:

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	2013-11-27 08:08:32 +0000
+++ b/sql/log_event.h	2013-12-02 13:50:28 +0000
@@ -3923,6 +3923,9 @@ protected:
     ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT);
     return result;
   }
+  bool process_triggers(trg_event_type event,
+                        trg_action_time_type time_type,
+                        bool old_row_is_record1);
 #endif
 
 private:



More information about the commits mailing list