#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-03
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-03 12:40:36 +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-03 12:40:36 +0000
@@ -3704,6 +3704,7 @@ static int init_server_components()
if (freopen(log_error_file, "a+", stdout))
#endif
freopen(log_error_file, "a+", stderr);
+ setbuf(stderr, NULL);
}
}
@@ -4331,6 +4332,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-20090303124036-dpmhr4rraic3hnpy.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (v.narayanan:2832) Bug#42790 | Narayanan V | 3 Mar |