List:Commits« Previous MessageNext Message »
From:Narayanan V Date:March 5 2009 9:48am
Subject:bzr commit into mysql-5.1-bugteam branch (v.narayanan:2832) Bug#42790
View as plain text  
#At file:///export/home/log/Narayanan/mysql_checkouts_bazaar/5.1_main_repository/mysql-5.1-bugteam-42790-1/ based on revid:timothy.smith@stripped

 2832 Narayanan V	2009-03-05
      Bug#42790 Test 'main.innodb' fails from "InnoDB: Error: in ALTER TABLE"
            
      The problem here seem to be that when mysql
      is redirecting stderr to a file, stderr becomes 
      buffered, whereas it is unbuffered by definition.
      
      The solution is to unbuffer it by setting buffer
      to null.
     @ sql/log.cc
        use setbuf(stderr, NULL) to set the buffer to null.
     @ sql/mysqld.cc
        use setbuf(stderr, NULL) to set the buffer to null.

    M  sql/log.cc
    M  sql/mysqld.cc
=== modified file 'sql/log.cc'
--- a/sql/log.cc	2009-01-23 12:22:05 +0000
+++ b/sql/log.cc	2009-03-05 09:48:03 +0000
@@ -4650,10 +4650,14 @@ bool flush_error_log()
       uchar buf[IO_SIZE];
 
       freopen(err_temp,"a+",stderr);
+      setbuf(stderr, NULL);
       (void) my_delete(err_renamed, MYF(0));
       my_rename(log_error_file,err_renamed,MYF(0));
       if (freopen(log_error_file,"a+",stdout))
+      {
         freopen(log_error_file,"a+",stderr);
+        setbuf(stderr, NULL);
+      }
 
       if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
       {
@@ -4669,7 +4673,10 @@ bool flush_error_log()
 #else
    my_rename(log_error_file,err_renamed,MYF(0));
    if (freopen(log_error_file,"a+",stdout))
+   {
      freopen(log_error_file,"a+",stderr);
+     setbuf(stderr, NULL);
+   }
    else
      result= 1;
 #endif

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-02-25 08:49:02 +0000
+++ b/sql/mysqld.cc	2009-03-05 09:48:03 +0000
@@ -3703,7 +3703,10 @@ static int init_server_components()
 #ifndef EMBEDDED_LIBRARY
       if (freopen(log_error_file, "a+", stdout))
 #endif
+      {
         freopen(log_error_file, "a+", stderr);
+        setbuf(stderr, NULL);
+      }
     }
   }
 
@@ -4331,6 +4334,7 @@ we force server id to 2, but this MySQL 
   {
     freopen(log_error_file,"a+",stdout);
     freopen(log_error_file,"a+",stderr);
+    setbuf(stderr, NULL);
     FreeConsole();				// Remove window
   }
 #endif


Attachment: [text/bzr-bundle] bzr/v.narayanan@sun.com-20090305094803-ko60m8tjt5gcvqyg.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (v.narayanan:2832) Bug#42790Narayanan V5 Mar
  • Re: bzr commit into mysql-5.1-bugteam branch (v.narayanan:2832)Bug#42790Sergey Vojtovich5 Mar
  • Re: bzr commit into mysql-5.1-bugteam branch (v.narayanan:2832)Bug#42790Davi Arnaut5 Mar