diff options
author | Narayanan V <v.narayanan@sun.com> | 2009-03-05 15:18:03 +0530 |
---|---|---|
committer | Narayanan V <v.narayanan@sun.com> | 2009-03-05 15:18:03 +0530 |
commit | 31443a6f73076374790ae359c1e0f00ddc0bfd4a (patch) | |
tree | 4a6a6bb991ded38bc6af8795dc921b611f02363f /sql | |
parent | 16c0631f0b785e82aef63429b5a4e7179b8aa52e (diff) | |
download | mariadb-git-31443a6f73076374790ae359c1e0f00ddc0bfd4a.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log.cc | 7 | ||||
-rw-r--r-- | sql/mysqld.cc | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/sql/log.cc b/sql/log.cc index 74dc75702ae..44296daa939 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -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 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bd1afc7f0ca..1391b87e8e3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -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 server will not act as a slave."); { freopen(log_error_file,"a+",stdout); freopen(log_error_file,"a+",stderr); + setbuf(stderr, NULL); FreeConsole(); // Remove window } #endif |