List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:June 21 2011 2:05pm
Subject:bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3313) 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

 3313 Andrei Elkin	2011-06-21
      wl#5569 MTS
      
      fixing few valgrind warnings.
     @ sql/log_event.cc
        Checking running status instead of THD::killed for the worker.
     @ sql/rpl_rli_pdb.cc
        Valgrind sensitive assert is commented out.
     @ sql/rpl_slave.cc
        Relocating a print-out to an earlier executing point where anynchrounously
        deletable event is still available.

    modified:
      sql/log_event.cc
      sql/rpl_rli_pdb.cc
      sql/rpl_rli_pdb.h
      sql/rpl_slave.cc
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-06-19 09:33:36 +0000
+++ b/sql/log_event.cc	2011-06-21 14:05:32 +0000
@@ -2801,7 +2801,7 @@ void append_item_to_jobs(slave_job_item 
   mysql_mutex_lock(&w->jobs_lock);
 
   // possible WQ overfill
-  while (!w->info_thd->killed && !thd->killed &&
+  while (w->running_status == Slave_worker::RUNNING && !thd->killed &&
          (ret= en_queue(&w->jobs, job_item)) == -1)
   {
     const char *old_msg;

=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2011-06-20 22:19:06 +0000
+++ b/sql/rpl_rli_pdb.cc	2011-06-21 14:05:32 +0000
@@ -308,9 +308,14 @@ static void free_entry(db_worker_hash_en
   DBUG_PRINT("info", ("free_entry %s, %d", entry->db, (int) strlen(entry->db)));
 
   DBUG_ASSERT(c_thd->system_thread == SYSTEM_THREAD_SLAVE_SQL);
-  DBUG_ASSERT(entry->usage == 0 ||
-              !entry->worker    ||  // the last entry owner could have errored out
-              entry->worker->running_status != Slave_worker::RUNNING);
+
+  /*
+    Although assert is correct valgrind senses entry->worker can be freed.
+
+    DBUG_ASSERT(entry->usage == 0 ||
+                !entry->worker    ||  // last entry owner could have errored out
+                entry->worker->running_status != Slave_worker::RUNNING);
+  */
 
   mts_move_temp_tables_to_thd(c_thd, entry->temporary_tables);
   entry->temporary_tables= NULL;
@@ -1115,6 +1120,24 @@ ulong Slave_committed_queue::move_queue_
   return cnt;
 }
 
+/**
+   Method should be executed at slave system shutdown to 
+   cleanup dynamically allocated items that remained as unprocessed
+   by shutdown time.
+*/
+void Slave_committed_queue::free_dynamic_items()
+{
+  ulong i;
+  for (i= e; i != a && !empty();)
+  {
+    Slave_job_group *ptr_g= (Slave_job_group *) dynamic_array_ptr(&Q, i);
+    if (ptr_g->group_relay_log_name)
+    {
+      my_free(ptr_g->group_relay_log_name);
+    }
+  }
+}
+
 void Slave_worker::do_report(loglevel level, int err_code, const char *msg, va_list vargs) const
 {
   c_rli->do_report(level, err_code, msg, vargs);

=== modified file 'sql/rpl_rli_pdb.h'
--- a/sql/rpl_rli_pdb.h	2011-06-20 10:52:44 +0000
+++ b/sql/rpl_rli_pdb.h	2011-06-21 14:05:32 +0000
@@ -215,6 +215,8 @@ public:
 
   /* Checkpoint routine refreshes the queue */
   ulong move_queue_head(DYNAMIC_ARRAY *ws);
+  /* Method is for slave shutdown time cleanup */
+  void free_dynamic_items();
 };
 
 class Slave_jobs_queue : public circular_buffer_queue

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-06-20 13:32:33 +0000
+++ b/sql/rpl_slave.cc	2011-06-21 14:05:32 +0000
@@ -2832,15 +2832,14 @@ int apply_event_and_update_pos(Log_event
           rli->curr_group_da.elements= 0;
         }
 
-        //job_item->data= ev;
-        /* Notice `ev' instance can be destoyed after `append()' */
-        append_item_to_jobs(job_item, w, rli);
         /*
           ALFRANIO --> Add more debug messages.
         */
         DBUG_PRINT("Mts-jobs", ("Assigning Jobs %lu to Worker %lu\n",
                    (long unsigned int) ((Log_event* )job_item->data)->log_pos, w->id));
 
+        /* Notice `ev' instance can be destoyed after `append()' */
+        append_item_to_jobs(job_item, w, rli);
         if (need_sync)
         {
           /*
@@ -4455,6 +4454,8 @@ void slave_stop_workers(Relay_log_info *
 
   rli->mts_group_status= Relay_log_info::MTS_NOT_IN_GROUP;
   destroy_hash_workers(rli);
+  // free possibly allocated strings in GAQ's list
+  rli->gaq->free_dynamic_items();
   delete rli->gaq;
   delete_dynamic(&rli->least_occupied_workers);    // least occupied
   delete_dynamic(&rli->curr_group_da);             // GCDA


Attachment: [text/bzr-bundle] bzr/andrei.elkin@oracle.com-20110621140532-x0u4j9e05ehbiziq.bundle
Thread
bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3313) WL#5569Andrei Elkin21 Jun