Commit 31443a6f authored by Narayanan V's avatar Narayanan V

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.
parent 16c0631f
...@@ -4650,10 +4650,14 @@ bool flush_error_log() ...@@ -4650,10 +4650,14 @@ bool flush_error_log()
uchar buf[IO_SIZE]; uchar buf[IO_SIZE];
freopen(err_temp,"a+",stderr); freopen(err_temp,"a+",stderr);
setbuf(stderr, NULL);
(void) my_delete(err_renamed, MYF(0)); (void) my_delete(err_renamed, MYF(0));
my_rename(log_error_file,err_renamed,MYF(0)); my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout)) if (freopen(log_error_file,"a+",stdout))
{
freopen(log_error_file,"a+",stderr); freopen(log_error_file,"a+",stderr);
setbuf(stderr, NULL);
}
if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
{ {
...@@ -4669,7 +4673,10 @@ bool flush_error_log() ...@@ -4669,7 +4673,10 @@ bool flush_error_log()
#else #else
my_rename(log_error_file,err_renamed,MYF(0)); my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout)) if (freopen(log_error_file,"a+",stdout))
{
freopen(log_error_file,"a+",stderr); freopen(log_error_file,"a+",stderr);
setbuf(stderr, NULL);
}
else else
result= 1; result= 1;
#endif #endif
......
...@@ -3703,7 +3703,10 @@ static int init_server_components() ...@@ -3703,7 +3703,10 @@ static int init_server_components()
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (freopen(log_error_file, "a+", stdout)) if (freopen(log_error_file, "a+", stdout))
#endif #endif
{
freopen(log_error_file, "a+", stderr); freopen(log_error_file, "a+", stderr);
setbuf(stderr, NULL);
}
} }
} }
...@@ -4331,6 +4334,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -4331,6 +4334,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
{ {
freopen(log_error_file,"a+",stdout); freopen(log_error_file,"a+",stdout);
freopen(log_error_file,"a+",stderr); freopen(log_error_file,"a+",stderr);
setbuf(stderr, NULL);
FreeConsole(); // Remove window FreeConsole(); // Remove window
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment