diff -u -r sql/log.cc /mysql/tmp/mysql-5.1.50/sql/log.cc --- sql/log.cc 2010-08-03 13:24:19.000000000 -0400 +++ /mysql/tmp/mysql-5.1.50/sql/log.cc 2010-08-26 22:26:29.410806610 -0400 @@ -5081,52 +5081,55 @@ bool flush_error_log() { - bool result=0; - if (opt_error_log) + if (!opt_nofliel) { - char err_renamed[FN_REFLEN], *end; - end= strmake(err_renamed,log_error_file,FN_REFLEN-5); - strmov(end, "-old"); - VOID(pthread_mutex_lock(&LOCK_error_log)); -#ifdef __WIN__ - char err_temp[FN_REFLEN+5]; - /* - On Windows is necessary a temporary file for to rename - the current error file. - */ - strxmov(err_temp, err_renamed,"-tmp",NullS); - (void) my_delete(err_temp, MYF(0)); - if (freopen(err_temp,"a+",stdout)) + bool result=0; + if (opt_error_log) { - int fd; - size_t bytes; - 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)); - redirect_std_streams(log_error_file); - - if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) + char err_renamed[FN_REFLEN], *end; + end= strmake(err_renamed,log_error_file,FN_REFLEN-5); + strmov(end, "-old"); + VOID(pthread_mutex_lock(&LOCK_error_log)); +#ifdef __WIN__ + char err_temp[FN_REFLEN+5]; + /* + On Windows is necessary a temporary file for to rename + the current error file. + */ + strxmov(err_temp, err_renamed,"-tmp",NullS); + (void) my_delete(err_temp, MYF(0)); + if (freopen(err_temp,"a+",stdout)) { - while ((bytes= my_read(fd, buf, IO_SIZE, MYF(0))) && - bytes != MY_FILE_ERROR) - my_fwrite(stderr, buf, bytes, MYF(0)); - my_close(fd, MYF(0)); + int fd; + size_t bytes; + 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)); + redirect_std_streams(log_error_file); + + if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) + { + while ((bytes= my_read(fd, buf, IO_SIZE, MYF(0))) && + bytes != MY_FILE_ERROR) + my_fwrite(stderr, buf, bytes, MYF(0)); + my_close(fd, MYF(0)); + } + (void) my_delete(err_temp, MYF(0)); } - (void) my_delete(err_temp, MYF(0)); - } - else - result= 1; + else + result= 1; #else - my_rename(log_error_file,err_renamed,MYF(0)); - if (redirect_std_streams(log_error_file)) - result= 1; + my_rename(log_error_file,err_renamed,MYF(0)); + if (redirect_std_streams(log_error_file)) + result= 1; #endif - VOID(pthread_mutex_unlock(&LOCK_error_log)); + VOID(pthread_mutex_unlock(&LOCK_error_log)); + } + return result; } - return result; } void MYSQL_BIN_LOG::signal_update() diff -u -r sql/log.h /mysql/tmp/mysql-5.1.50/sql/log.h --- sql/log.h 2010-08-03 13:24:19.000000000 -0400 +++ /mysql/tmp/mysql-5.1.50/sql/log.h 2010-08-26 22:19:04.747314816 -0400 @@ -25,6 +25,7 @@ bool trans_has_no_stmt_committed(const THD* thd, const bool all); bool stmt_has_updated_non_trans_table(const THD* thd); + /* Transaction Coordinator log - a base abstract class for two different implementations diff -u -r sql/mysqld.cc /mysql/tmp/mysql-5.1.50/sql/mysqld.cc --- sql/mysqld.cc 2010-08-03 13:24:30.000000000 -0400 +++ /mysql/tmp/mysql-5.1.50/sql/mysqld.cc 2010-08-27 09:40:11.115314813 -0400 @@ -443,6 +443,7 @@ ulong log_output_options; my_bool opt_log_queries_not_using_indexes= 0; bool opt_error_log= IF_WIN(1,0); +bool opt_nofliel = 0; ///< If set, flush logs doesn't cycle the error log bool opt_disable_networking=0, opt_skip_show_db=0; bool opt_skip_name_resolve=0; my_bool opt_character_set_client_handshake= 1; @@ -5639,7 +5640,7 @@ OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES, OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB, - OPT_BINLOG_FORMAT, + OPT_BINLOG_FORMAT, OPT_FLUSH_LOG_IGNORE_ERROR_LOG, #ifndef DBUG_OFF OPT_BINLOG_SHOW_XID, #endif @@ -6488,6 +6489,10 @@ "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory.", &opt_secure_file_priv, &opt_secure_file_priv, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"flush-log-ignore-error-log", OPT_FLUSH_LOG_IGNORE_ERROR_LOG, + "Doesn't flush error log if set.", + &opt_nofliel, &opt_nofliel, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + 0}, {"server-id", OPT_SERVER_ID, "Uniquely identifies the server instance in the community of replication partners.", &server_id, &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32, diff -u -r sql/mysql_priv.h /mysql/tmp/mysql-5.1.50/sql/mysql_priv.h --- sql/mysql_priv.h 2010-08-03 13:24:30.000000000 -0400 +++ /mysql/tmp/mysql-5.1.50/sql/mysql_priv.h 2010-08-27 09:40:57.358804014 -0400 @@ -1949,7 +1949,7 @@ #endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */ #ifdef MYSQL_SERVER extern bool opt_large_files, server_id_supplied; -extern bool opt_update_log, opt_bin_log, opt_error_log; +extern bool opt_update_log, opt_bin_log, opt_error_log, opt_nofliel; extern my_bool opt_log, opt_slow_log; extern ulong log_output_options; extern my_bool opt_log_queries_not_using_indexes; diff -u -r sql/set_var.cc /mysql/tmp/mysql-5.1.50/sql/set_var.cc --- sql/set_var.cc 2010-08-03 13:24:33.000000000 -0400 +++ /mysql/tmp/mysql-5.1.50/sql/set_var.cc 2010-08-30 14:22:05.011306099 -0400 @@ -257,6 +257,9 @@ &expire_logs_days); static sys_var_bool_ptr sys_flush(&vars, "flush", &myisam_flush); static sys_var_long_ptr sys_flush_time(&vars, "flush_time", &flush_time); +static sys_var_const sys_flush_log_ignore_error_log(&vars, "flush_log_ignore_error_log", + OPT_GLOBAL, SHOW_BOOL, + (uchar*) &opt_nofliel); static sys_var_str sys_ft_boolean_syntax(&vars, "ft_boolean_syntax", sys_check_ftb_syntax, sys_update_ftb_syntax,