List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:June 21 2011 4:11pm
Subject:bzr push into mysql-next-mr-wl5569 branch (andrei.elkin:3312 to 3314) WL#5569
View as plain text  
 3314 Andrei Elkin	2011-06-21 [merge]
      wl#5569 MTS
      
      Fixing valgrind warnings.
     @ sql/log_event.cc
        w->running_status is verfied to find out the actually sought running
        status of a Worker.
        THD can be unavainlable that's what a valgrind report was about.
     @ sql/rpl_rli_pdb.cc
        commenting out an assert that valgrind does not like.
     @ sql/rpl_rli_pdb.h
        new method is added to be invoked at MTS shutdown.
     @ sql/rpl_slave.cc
        Invoking gaq cleanup at the end of MTS session.

    modified:
      sql/log_event.cc
      sql/rpl_rli_pdb.cc
      sql/rpl_rli_pdb.h
      sql/rpl_slave.cc
 3313 Andrei Elkin	2011-06-21
      wl#5569 MTS
      
      rpl_parallel_start_stop.test could fail sporadicaly with timeout.
     @ mysql-test/include/wait_for_slave_param.inc
        Correcting comments and handling of passed by caller $slave_timeout to make sure
        the unit of 1 second really holds.
        Introduced symbolic default_timeout, sleep_freq(uency) to procude time to sleep in between of
        two polls.
     @ mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
        Since the default time to wait is less than one for innodb's wait for lock,
        the time to wait for error is set explicitly.

    modified:
      mysql-test/include/wait_for_slave_param.inc
      mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
 3312 Alfranio Correia	2011-06-20 [merge]
      merge mysql-next-mr-wl5569 (local) --> mysql-next-mr-wl5569

    modified:
      mysql-test/extra/rpl_tests/rpl_conflicts.test
      mysql-test/extra/rpl_tests/rpl_extra_col_slave.test
      mysql-test/extra/rpl_tests/rpl_loaddata.test
      mysql-test/extra/rpl_tests/rpl_parallel_load.test
      mysql-test/extra/rpl_tests/rpl_relayrotate.test
      mysql-test/extra/rpl_tests/rpl_row_empty_imgs.test
      mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
      mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
      mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
      mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result
      mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result
      mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
      mysql-test/suite/rpl/r/rpl_loaddata.result
      mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
      mysql-test/suite/rpl/r/rpl_parallel.result
      mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
      mysql-test/suite/rpl/r/rpl_row_colSize.result
      mysql-test/suite/rpl/r/rpl_row_conflicts.result
      mysql-test/suite/rpl/r/rpl_row_img_eng_full.result
      mysql-test/suite/rpl/r/rpl_row_img_sanity.result
      mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
      mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
      mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
      mysql-test/suite/rpl/r/rpl_sequential.result
      mysql-test/suite/rpl/r/rpl_show_errors.result
      mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
      mysql-test/suite/rpl/r/rpl_slave_start.result
      mysql-test/suite/rpl/r/rpl_stm_000001.result
      mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
      mysql-test/suite/rpl/r/rpl_stm_conflicts.result
      mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
      mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
      mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
      mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
      mysql-test/suite/rpl/t/rpl_parallel.test
      mysql-test/suite/rpl/t/rpl_parallel_multi_db-master.opt
      mysql-test/suite/rpl/t/rpl_parallel_multi_db-slave.opt
      mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
      mysql-test/suite/rpl/t/rpl_row_colSize.test
      mysql-test/suite/rpl/t/rpl_row_img_sanity.test
      mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test
      mysql-test/suite/rpl/t/rpl_show_errors.test
      mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
      mysql-test/suite/rpl/t/rpl_slave_start.test
      mysql-test/suite/rpl/t/rpl_stm_000001.test
      sql/rpl_reporting.h
      sql/rpl_slave.cc
=== modified file 'mysql-test/include/wait_for_slave_param.inc'
--- a/mysql-test/include/wait_for_slave_param.inc	2010-12-20 14:57:35 +0000
+++ b/mysql-test/include/wait_for_slave_param.inc	2011-06-21 15:15:43 +0000
@@ -29,8 +29,8 @@
 #     --let $slave_param_comparison= !=
 #
 # $slave_timeout
-#   The default timeout is 5 minutes. You can change the timeout by
-#   setting $slave_timeout. The unit is seconds.
+#   The default timeout is $default_timeout seconds. You can change the timeout by
+#   setting $slave_timeout. The unit is one second.
 #
 # $slave_error_param
 #   If set, this script will check if the column of the output from
@@ -45,11 +45,14 @@
 --let $include_filename= wait_for_slave_param.inc [$slave_param]
 --source include/begin_include_file.inc
 
+--let $default_timeout= 30
+--let $sleep_freq= 10
+--let $sleep_time= `select 1.0 / $sleep_freq`
 
 let $_slave_timeout= $slave_timeout;
 if (!$_slave_timeout)
 {
-  let $_slave_timeout= 300;
+  let $_slave_timeout= `select $default_timeout * $sleep_freq`;
 }
 
 if ($slave_error_param == '')
@@ -110,7 +113,7 @@ while ($_slave_continue)
       --source include/show_rpl_debug_info.inc
       --die Timeout in include/wait_for_slave_param.inc
     }
-    --sleep  0.1
+    --sleep  $sleep_time
   }
 }
 

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_start_stop.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	2011-06-20 13:26:35 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	2011-06-21 15:15:43 +0000
@@ -169,6 +169,9 @@ update t1 set a=21 where a=2;
 
 # slave is stopped
 
+# setting timeout to be as twice as greater than innodb's.
+--let $slave_timeout=`select 2*@@global.innodb_lock_wait_timeout`
+
 let $slave_sql_errno= 1213, 1205; 
 source include/wait_for_slave_sql_error.inc;
 

=== 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 16:10:54 +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(); i= (i + 1) % s)
+  {
+    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-20110621161054-8pq5dqskhkh3ezu0.bundle
Thread
bzr push into mysql-next-mr-wl5569 branch (andrei.elkin:3312 to 3314) WL#5569Andrei Elkin21 Jun