List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:July 19 2011 7:27pm
Subject:bzr push into mysql-next-mr-wl5569 branch (andrei.elkin:3353 to 3354) WL#5569
View as plain text  
 3354 Andrei Elkin	2011-07-19
      wl#5569 MTS
      
      valgrind reported a stack on rpl_savepoint.
      The problem appears to be in that at computing slave_sql_running_state in show_mater_info()
      the sql thread proc_info pointer could refer to a value in a stack that has already gone.
      
      Fixed with making proc_info to point to a string literal.

    modified:
      sql/rpl_rli_pdb.cc
 3353 Alfranio Correia	2011-07-19
      Suppressed warning messages that could potentially cause problems while
      running mts crash safe test cases.

    modified:
      mysql-test/suite/rpl/r/rpl_mixed_mts_crash_safe.result
      mysql-test/suite/rpl/r/rpl_mixed_mts_rec_crash_safe.result
      mysql-test/suite/rpl/r/rpl_row_mts_crash_safe.result
      mysql-test/suite/rpl/r/rpl_row_mts_rec_crash_safe.result
      mysql-test/suite/rpl/r/rpl_stm_mts_crash_safe.result
      mysql-test/suite/rpl/r/rpl_stm_mts_rec_crash_safe.result
      mysql-test/suite/rpl/t/rpl_mixed_mts_crash_safe.test
      mysql-test/suite/rpl/t/rpl_mixed_mts_rec_crash_safe.test
      mysql-test/suite/rpl/t/rpl_row_mts_crash_safe.test
      mysql-test/suite/rpl/t/rpl_row_mts_rec_crash_safe.test
      mysql-test/suite/rpl/t/rpl_stm_mts_crash_safe.test
      mysql-test/suite/rpl/t/rpl_stm_mts_rec_crash_safe.test
=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2011-07-18 11:52:44 +0000
+++ b/sql/rpl_rli_pdb.cc	2011-07-19 19:26:30 +0000
@@ -1343,8 +1343,6 @@ int wait_for_workers_to_finish(Relay_log
   uint ret= 0;
   HASH *hash= &mapping_db_to_worker;
   THD *thd= rli->info_thd;
-  const char info_format[]=
-    "Waiting for Slave Worker %d to release partition `%s`";
   bool cant_sync= FALSE;
   char llbuf[22];
 
@@ -1356,9 +1354,7 @@ int wait_for_workers_to_finish(Relay_log
   for (uint i= 0, ret= 0; i < hash->records; i++)
   {
     db_worker_hash_entry *entry;
-    const char *proc_info;
-    char wait_info[sizeof(info_format) + 4*sizeof(entry->worker->id) +
-                   NAME_LEN + 1];
+    const char *save_proc_info= thd->proc_info;
    
     mysql_mutex_lock(&slave_worker_hash_lock);
   
@@ -1376,13 +1372,12 @@ int wait_for_workers_to_finish(Relay_log
     if (entry->usage > 0 && !thd->killed)
     {
       Slave_worker * w_entry= entry->worker;
-      sprintf(wait_info, info_format, w_entry->id, entry->db);
       entry->worker= NULL; // mark Worker to signal when  usage drops to 0
       do
       {
-        proc_info= thd->enter_cond(&slave_worker_hash_cond,
-                                   &slave_worker_hash_lock,
-                                   wait_info);
+        thd->enter_cond(&slave_worker_hash_cond,
+                       &slave_worker_hash_lock,
+                       "Waiting for Slave Worker to release partition");
         mysql_cond_wait(&slave_worker_hash_cond, &slave_worker_hash_lock);
         DBUG_PRINT("info",
                    ("Either got awakened of notified: "
@@ -1390,7 +1385,7 @@ int wait_for_workers_to_finish(Relay_log
                     entry, entry->usage, w_entry->id));
       } while (entry->usage != 0 && !thd->killed);
       entry->worker= w_entry; // restoring last association, needed only for assert
-      thd->exit_cond(proc_info);
+      thd->exit_cond(save_proc_info);
       ret++;
     }
     else
@@ -1507,27 +1502,22 @@ void append_item_to_jobs(slave_job_item 
   int ret;
   ulong ev_size= ((Log_event*) (job_item->data))->data_written;
   ulonglong new_pend_size;
+  const char *save_proc_info= NULL;
 
   DBUG_ASSERT(thd == current_thd);
-  thd_proc_info(thd, "Feeding an event to a worker thread");
 
   mysql_mutex_lock(&rli->pending_jobs_lock);
   new_pend_size= rli->mts_pending_jobs_size + ev_size;
   // C waits basing on *data* sizes in the queues
   while (new_pend_size > rli->mts_pending_jobs_size_max)
   {
-    const char *old_msg;
-    const char info_format[]=
-      "Waiting for Slave Workers to free pending events, requested size %lu";
-    char wait_info[sizeof(info_format) + 4*sizeof(new_pend_size)];
-
-    sprintf(wait_info, info_format, new_pend_size);
     rli->mts_wq_oversize= TRUE;
     rli->wq_size_waits_cnt++; // waiting due to the total size
-    old_msg= thd->enter_cond(&rli->pending_jobs_cond, &rli->pending_jobs_lock,
-                             wait_info);
+    save_proc_info=
+      thd->enter_cond(&rli->pending_jobs_cond, &rli->pending_jobs_lock,
+                      "Waiting for Slave Workers to free pending events");
     mysql_cond_wait(&rli->pending_jobs_cond, &rli->pending_jobs_lock);
-    thd->exit_cond(old_msg);
+    thd->exit_cond(save_proc_info);
     if (thd->killed)
       return;
 
@@ -1561,19 +1551,13 @@ void append_item_to_jobs(slave_job_item 
   while (worker->running_status == Slave_worker::RUNNING && !thd->killed &&
          (ret= en_queue(&worker->jobs, job_item)) == -1)
   {
-    const char *old_msg;
-    const char info_format[]=
-      "Waiting for Slave Worker %d queue: max len %lu, actual len %lu";
-    char wait_info[sizeof(info_format) + 4*sizeof(worker->id) +
-                   4*sizeof(worker->jobs.size) + 4*sizeof(worker->jobs.len)];
-    
-    sprintf(wait_info, info_format, worker->id, worker->jobs.size, worker->jobs.len);
-    old_msg= thd->enter_cond(&worker->jobs_cond, &worker->jobs_lock, wait_info);
+    save_proc_info= thd->enter_cond(&worker->jobs_cond, &worker->jobs_lock, 
+                                    "Waiting for Slave Worker queue");
     worker->jobs.overfill= TRUE;
     worker->jobs.waited_overfill++;
     rli->mts_wq_overfill_cnt++;
     mysql_cond_wait(&worker->jobs_cond, &worker->jobs_lock);
-    thd->exit_cond(old_msg);
+    thd->exit_cond(save_proc_info);
     
     mysql_mutex_lock(&worker->jobs_lock);
   }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-next-mr-wl5569 branch (andrei.elkin:3353 to 3354) WL#5569Andrei Elkin20 Jul