List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:December 22 2010 6:31pm
Subject:bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3258) WL#5569
View as plain text  
#At file:///home/andrei/MySQL/BZR/2a-23May/WL/mysql-next-mr-wl5569/ based on revid:andrei.elkin@stripped

 3258 Andrei Elkin	2010-12-22
      wl#5569 MTS
      
      fixing tests failure when mtr runs --mts_slave_parallel_workers != 0.
      
      rpl000010 is a representative.
      Fixed with identifying, marking, running carefully ev->update_pos() and destroying
      an event that can split a group of events to force part to be in different relay logs.
     @ sql/log_event.cc
        Identifying and marking an event that can split a group of events to force part to be
        in different relay logs.
     @ sql/log_event.h
        FD and Rotate both can be the group splitter but only if they are "artificial".
     @ sql/rpl_rli.h
        a marker flag to be set when the group splitter such as FD is spotted.
     @ sql/rpl_slave.cc
        identifying, marking, running carefully ev->update_pos() and destroying
        an event that can split a group of events.

    modified:
      sql/log_event.cc
      sql/log_event.h
      sql/rpl_rli.h
      sql/rpl_slave.cc
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-12-22 11:57:18 +0000
+++ b/sql/log_event.cc	2010-12-22 18:31:13 +0000
@@ -2772,18 +2772,26 @@ int Log_event::apply_event(Relay_log_inf
         only_sequential_exec(rli->run_query_in_parallel,
                              rli->curr_group_seen_begin /* todo: obs 2nd arg */))
        // rli->curr_group_seen_begin && ends_group() => rli->last_assigned_worker
-       && !rli->curr_group_seen_begin))
+       && (!rli->curr_group_seen_begin || parallel_exec_by_coordinator(::server_id))))
   {
     if (parallel)
     {
       // This `only-sequential' case relates to a DDL Query case
-
-      DBUG_ASSERT(rli->curr_group_da.elements == 0);
-      DBUG_ASSERT(!rli->curr_group_seen_begin);
+      // or a group split apart by FD event
+      DBUG_ASSERT(seq_event &&
+                  (rli->curr_group_da.elements == 0 || rli->curr_group_seen_begin));
       
-      c_rli->curr_group_is_parallel= FALSE;   // Coord will destruct events
       if (!parallel_exec_by_coordinator(::server_id))
+      {
+        DBUG_ASSERT(!rli->curr_group_seen_begin);
+
+        c_rli->curr_group_is_parallel= FALSE;   // Coord will destruct events
         (void) wait_for_workers_to_finish(rli);
+      }
+      else
+      {
+        c_rli->curr_event_is_not_in_group= TRUE;
+      }
     }
     else if (rli->is_mts_recovery())
     {

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	2010-12-21 19:31:29 +0000
+++ b/sql/log_event.h	2010-12-22 18:31:13 +0000
@@ -1246,8 +1246,9 @@ public:
   bool parallel_exec_by_coordinator(ulong slave_server_id)
   {
     return
-      get_type_code() == FORMAT_DESCRIPTION_EVENT &&
-      (server_id == (uint32) ::server_id);
+      (get_type_code() == FORMAT_DESCRIPTION_EVENT ||
+       get_type_code() == ROTATE_EVENT) &&
+      ((server_id == (uint32) ::server_id) || (log_pos == 0));
   }
 
   /**

=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	2010-12-22 11:57:18 +0000
+++ b/sql/rpl_rli.h	2010-12-22 18:31:13 +0000
@@ -474,6 +474,7 @@ public:
   MY_BITMAP recovery_groups;  // bitmap used during recovery.
   ulong mts_recovery_group_cnt; // number of groups to execute at recovery
   ulong mts_recovery_index;     // running index of recoverable groups
+  bool curr_event_is_not_in_group; // a special case of group split apart by FD
   /* most of allocation in the coordinator rli is there */
   void init_workers(ulong);
 

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2010-12-22 11:57:18 +0000
+++ b/sql/rpl_slave.cc	2010-12-22 18:31:13 +0000
@@ -2827,10 +2827,11 @@ int apply_event_and_update_pos(Log_event
     int error= 0;
     if (skip_event || 
         (!rli->is_parallel_exec() ||
-         !rli->curr_group_is_parallel))
+         (!rli->curr_group_is_parallel || rli->curr_event_is_not_in_group)))
     {
       DBUG_ASSERT(skip_event || !rli->is_parallel_exec() ||
-                  !rli->curr_group_is_parallel ||
+                  (!rli->curr_group_is_parallel ||
+                   rli->curr_event_is_not_in_group) ||
                   (ev->only_sequential_exec(rli->run_query_in_parallel,
                                             (rli->curr_group_seen_begin ||
                                              rli->last_assigned_worker != NULL))
@@ -3034,7 +3035,7 @@ static int exec_relay_log_event(THD* thd
     // if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
     {
       if ((!rli->is_parallel_exec() ||
-           !rli->curr_group_is_parallel)
+           !rli->curr_group_is_parallel || rli->curr_event_is_not_in_group)
           && ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
       {
         DBUG_ASSERT(!rli->is_parallel_exec() ||
@@ -3042,7 +3043,8 @@ static int exec_relay_log_event(THD* thd
                                               // rli->curr_group_is_parallel
                                               (rli->curr_group_seen_begin ||
                                                rli->last_assigned_worker != NULL))
-                     && !rli->curr_group_seen_begin));
+                     && (!rli->curr_group_seen_begin ||
+                         ev->parallel_exec_by_coordinator(::server_id))));
       /* MTS:  Observation/todo.
 
          ROWS_QUERY_LOG_EVENT could be supported easier if
@@ -3062,6 +3064,8 @@ static int exec_relay_log_event(THD* thd
           ev= NULL;
         }
       }
+      if (rli->curr_event_is_not_in_group)
+        rli->curr_event_is_not_in_group= FALSE;
     }
 
     /*
@@ -4327,6 +4331,7 @@ int slave_start_workers(Relay_log_info *
   rli->curr_group_isolated= FALSE;
   rli->run_query_in_parallel= opt_mts_slave_run_query_in_parallel;
   rli->checkpoint_seqno= 0;
+  rli->curr_event_is_not_in_group= FALSE;
   //rli->worker_bitmap_buf= my_malloc(n/8 + 1,MYF(MY_WME));
 
   // end recovery right now if mts_recovery_groups() did not find any gaps


Attachment: [text/bzr-bundle] bzr/andrei.elkin@oracle.com-20101222183113-n4sxokbha5xplpld.bundle
Thread
bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3258) WL#5569Andrei Elkin22 Dec