List:Commits« Previous MessageNext Message »
From:Luis Soares Date:December 11 2008 3:45pm
Subject:bzr commit into mysql-6.0-bugteam branch (luis.soares:2802) Bug#38826
View as plain text  
#At file:///stuff/workspace/mysql-server/bugfix/6.0-bugteam-fix-be-pushed/

 2802 Luis Soares	2008-12-11 [merge]
      BUG#38826: Race in MYSQL_LOG::purge_logs is impossible to debug in production
      
      Merge from 5.1 bugteam (fixes parentheses and unused variables warnings, removes 
      rpl_crash_before_purge_logs test - needs further discussion on how to do it
      deterministically.).
removed:
  mysql-test/suite/rpl/r/rpl_crash_before_purge_logs.result
  mysql-test/suite/rpl/t/rpl_crash_before_purge_logs.test
modified:
  sql/log.cc

=== removed file 'mysql-test/suite/rpl/r/rpl_crash_before_purge_logs.result'
--- a/mysql-test/suite/rpl/r/rpl_crash_before_purge_logs.result	2008-12-04 14:07:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_crash_before_purge_logs.result	1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (id INT);
-start slave;
-SET GLOBAL debug= "+d,crash_before_purge_logs";
-FLUSH LOGS;
-ERROR HY000: Lost connection to MySQL server during query
-start slave;

=== removed file 'mysql-test/suite/rpl/t/rpl_crash_before_purge_logs.test'
--- a/mysql-test/suite/rpl/t/rpl_crash_before_purge_logs.test	2008-12-04 14:07:56 +0000
+++ b/mysql-test/suite/rpl/t/rpl_crash_before_purge_logs.test	1970-01-01 00:00:00 +0000
@@ -1,57 +0,0 @@
---source include/master-slave.inc
---source include/have_debug.inc
---disable_reconnect
-
-# We have to sync with master, to ensure slave had time to start properly
-# # before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the
-# log.
-sync_slave_with_master;
-stop slave;
---source include/wait_for_slave_to_stop.inc
-
-# ON MASTER 
-
-connection master;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (id INT);
-
-let $1=100;
-disable_query_log;
-begin;
-while ($1)
-{
-  eval INSERT INTO t1 VALUES( $1 );
-  dec $1;
-}
-DROP TABLE t1;
-save_master_pos;
-
-enable_query_log;
-
-## ON SLAVE
-
-connection slave;
-start slave;
---source include/wait_for_slave_to_start.inc
-sync_with_master 0;
-connection master;
-save_master_pos;
-connection slave;
-
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/slave0.expect
-SET GLOBAL debug= "+d,crash_before_purge_logs";
-
---error 2013
-# try to rotate logs
-FLUSH LOGS;
-
---enable_reconnect
---source include/wait_until_connected_again.inc
-start slave;
---source include/wait_for_slave_to_start.inc
-
-sync_with_master 0;

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2008-12-10 15:59:12 +0000
+++ b/sql/log.cc	2008-12-11 15:44:42 +0000
@@ -4801,7 +4801,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay
    * Need to update the log pos because purge logs has been called 
    * after fetching initially the log pos at the begining of the method.
    */
-  if(error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0))
+  if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
   {
     char buff[22];
     sql_print_error("next log error: %d  offset: %s  log: %s included: %d",
@@ -4867,7 +4867,6 @@ int MYSQL_BIN_LOG::purge_logs(const char
                           ulonglong *decrease_log_space)
 {
   int error;
-  int ret = 0;
   bool exit_loop= 0;
   LOG_INFO log_info;
   THD *thd= current_thd;
@@ -4890,8 +4889,8 @@ int MYSQL_BIN_LOG::purge_logs(const char
   */
   if (!my_b_inited(&purge_temp))
   {
-    if (error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX,
-                               DISK_BUFFER_SIZE, MYF(MY_WME)))
+    if ((error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX,
+                                DISK_BUFFER_SIZE, MYF(MY_WME))))
     {
       sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp");
       goto err;
@@ -4899,7 +4898,7 @@ int MYSQL_BIN_LOG::purge_logs(const char
   }
   else
   {
-    if (error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1))
+    if ((error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1)))
     {
       sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp "
                       "for write");
@@ -4930,7 +4929,7 @@ int MYSQL_BIN_LOG::purge_logs(const char
  }
 
   /* We know how many files to delete. Update index file. */
-  if (error=update_log_index(&log_info, need_update_threads))
+  if ((error=update_log_index(&log_info, need_update_threads)))
   {
     sql_print_error("MSYQL_LOG::purge_logs failed to update the index file");
     goto err;
@@ -4939,7 +4938,7 @@ int MYSQL_BIN_LOG::purge_logs(const char
   DBUG_EXECUTE_IF("crash_after_update_index", abort(););
 
   /* Switch purge_temp for read. */
-  if (error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0))
+  if ((error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)))
   {
     sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp "
                     "for read");
@@ -5074,6 +5073,7 @@ int MYSQL_BIN_LOG::purge_logs(const char
   }
 
 err:
+  close_cached_file(&purge_temp);
   if (need_mutex)
     pthread_mutex_unlock(&LOCK_index);
   DBUG_RETURN(error);

Thread
bzr commit into mysql-6.0-bugteam branch (luis.soares:2802) Bug#38826Luis Soares11 Dec