List:Commits« Previous MessageNext Message »
From:Luis Soares Date:April 9 2009 12:16am
Subject:bzr commit into mysql-5.0-bugteam branch (luis.soares:2748) Bug#41725
View as plain text  
#At file:///home/lsoares/Workspace/mysql-server/bugfix/41725/5.0-bt/ based on revid:satya.bn@stripped

 2748 Luis Soares	2009-04-09
      BUG#41725: slave crashes when inserting into temporary table after
      stop/start slave
      
      When the slave is replicating many temporary tables and inserts into
      those, running 'stop slave' then 'start slave' can crash the
      server. This seems to be caused due to the fact temporary tables are
      saved between slave threads restart but, regardless of the restart,
      table->in_use still references old thread instead of new one.
      
      This patch addresses this issue by resetting the reference to the new
      slave thread on slave thread restart.

    modified:
      sql/slave.cc
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-02-10 22:47:54 +0000
+++ b/sql/slave.cc	2009-04-09 00:16:28 +0000
@@ -540,6 +540,17 @@ void st_relay_log_info::close_temporary_
   slave_open_temp_tables= 0;
 }
 
+void set_thd_in_use_temporary_tables(RELAY_LOG_INFO *rli)
+{
+  TABLE *table,*next;
+
+  for (table=rli->save_temporary_tables ; table ; table=next)
+  {
+    next=table->next;
+    table->in_use= rli->sql_thd;
+  }
+}
+
 /*
   purge_relay_logs()
 
@@ -3913,6 +3924,7 @@ slave_begin:
   }
   thd->init_for_queries();
   thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
+  set_thd_in_use_temporary_tables(rli);   // (re)set sql_thd in use for saved temp tables
   pthread_mutex_lock(&LOCK_thread_count);
   threads.append(thd);
   pthread_mutex_unlock(&LOCK_thread_count);
@@ -4085,6 +4097,7 @@ the slave SQL thread with \"SLAVE START\
   DBUG_ASSERT(rli->sql_thd == thd);
   THD_CHECK_SENTRY(thd);
   rli->sql_thd= 0;
+  set_thd_in_use_temporary_tables(rli);  // (re)set sql_thd in use for saved temp tables
   pthread_mutex_lock(&LOCK_thread_count);
   THD_CHECK_SENTRY(thd);
   delete thd;


Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20090409001628-irn1s6n9ug58iktr.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (luis.soares:2748) Bug#41725Luis Soares9 Apr
  • Re: bzr commit into mysql-5.0-bugteam branch (luis.soares:2748)Bug#41725Alfranio Correia11 Apr
    • Re: bzr commit into mysql-5.0-bugteam branch (luis.soares:2748)Bug#41725Luís Soares11 Apr