List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:January 11 2011 10:54pm
Subject:bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3268) WL#5569
View as plain text  
#At file:///home/andrei/MySQL/BZR/2a-23May/WL/mysql-next-mr-wl5569/ based on revid:alfranio.correia@stripped

 3268 Andrei Elkin	2011-01-12
      wl#5569 MTS
      
      fixing the worker threads start/stop.
     @ sql/rpl_rli.h
        adding RLI::opt_slave_parallel_workers to cache the server's namesake global var.
     @ sql/rpl_slave.cc
        moving rli->recovery_parallel_workers resetting down to the exit point from starting routine.

    modified:
      sql/rpl_rli.h
      sql/rpl_slave.cc
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	2010-12-27 18:54:41 +0000
+++ b/sql/rpl_rli.h	2011-01-11 22:54:12 +0000
@@ -460,7 +460,8 @@ public:
   ulonglong mts_total_groups; // total event groups distributed in current session
  
   bool curr_group_is_parallel; // a mark for Coord to indicate on T-event of the curr group at delete
-  ulong slave_parallel_workers; // one slave session time number of workers
+  ulong opt_slave_parallel_workers; // auxiliary cache for ::opt_slave_parallel_workers
+  ulong slave_parallel_workers;     // the one slave session time number of workers
   ulong recovery_parallel_workers; // number of workers while recovering.
   /* 
      A sorted array of Worker current assignements number to provide

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2010-12-27 18:54:41 +0000
+++ b/sql/rpl_slave.cc	2011-01-11 22:54:12 +0000
@@ -4341,7 +4341,7 @@ int slave_start_workers(Relay_log_info *
   rli->mts_slave_worker_queue_len_max= ::opt_mts_slave_worker_queue_len_max;
   rli->gaq= new Slave_committed_queue(rli->get_group_master_log_name(),
                                       sizeof(Slave_job_group),
-                                      1 + rli->slave_parallel_workers *
+                                      1 + rli->opt_slave_parallel_workers *
                                       rli->mts_slave_worker_queue_len_max, n);
   rli->mts_pending_jobs_size= 0;
   rli->mts_pending_jobs_size_max= ::opt_mts_pending_jobs_size_max;
@@ -4359,11 +4359,6 @@ int slave_start_workers(Relay_log_info *
   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
-  if (rli->mts_recovery_group_cnt == 0)
-    rli->recovery_parallel_workers= rli->slave_parallel_workers;
-
-
   for (i= 0; i < n; i++)
   {
     if ((error= slave_start_single_worker(rli, i)))
@@ -4378,6 +4373,11 @@ int slave_start_workers(Relay_log_info *
   }
 
 err:
+  rli->slave_parallel_workers= rli->workers.elements;
+  // end recovery right now if mts_recovery_groups() did not find any gaps
+  if (rli->mts_recovery_group_cnt == 0)
+    rli->recovery_parallel_workers= rli->slave_parallel_workers;
+
   return error;
 }
 
@@ -4452,6 +4452,7 @@ void slave_stop_workers(Relay_log_info *
   delete_dynamic(&rli->curr_group_assigned_parts); // GCAP
   //my_free(rli->worker_bitmap_buf);
   rli->deinit_workers();
+  rli->slave_parallel_workers= 0;
 }
 
 /**
@@ -4498,7 +4499,7 @@ pthread_handler_t handle_slave_sql(void 
   pthread_detach_this_thread();
 
   /* mts-II: starting the worker pool */
-  if (slave_start_workers(rli, rli->slave_parallel_workers) != 0)
+  if (slave_start_workers(rli, rli->opt_slave_parallel_workers) != 0)
     goto err;
   
   if (init_slave_thread(thd, SLAVE_THD_SQL))
@@ -6558,7 +6559,7 @@ int start_slave(THD* thd , Master_info* 
           To cache the system var value and used it in the following.
           The system var can change but not the cached.
         */
-        mi->rli->slave_parallel_workers= opt_mts_slave_parallel_workers;
+        mi->rli->opt_slave_parallel_workers= opt_mts_slave_parallel_workers;
 
         mysql_mutex_lock(&mi->rli->data_lock);
 
@@ -6612,9 +6613,9 @@ int start_slave(THD* thd , Master_info* 
             push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
                          ER_MISSING_SKIP_SLAVE,
                          ER(ER_MISSING_SKIP_SLAVE));
-          if (mi->rli->slave_parallel_workers != 0)
+          if (mi->rli->opt_slave_parallel_workers != 0)
           {
-            mi->rli->slave_parallel_workers= 0;
+            mi->rli->opt_slave_parallel_workers= 0;
             push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
                                 ER_NO_FEATURE_ON_PARALLEL_SLAVE,
                                 ER(ER_NO_FEATURE_ON_PARALLEL_SLAVE),
@@ -6626,7 +6627,7 @@ int start_slave(THD* thd , Master_info* 
         mysql_mutex_unlock(&mi->rli->data_lock);
 
         /* MTS technical limitation no support of trans retry */
-        if (mi->rli->slave_parallel_workers != 0 && slave_trans_retries != 0)
+        if (mi->rli->opt_slave_parallel_workers != 0 && slave_trans_retries != 0)
         {
           push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
                               ER_NO_FEATURE_ON_PARALLEL_SLAVE,


Attachment: [text/bzr-bundle] bzr/andrei.elkin@oracle.com-20110111225412-58w33wose3n5n2z1.bundle
Thread
bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3268) WL#5569Andrei Elkin11 Jan