diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-07-11 20:59:17 -0600 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-07-11 20:59:17 -0600 |
commit | f93d5f314bace40958d4eaefb8bf4029f67a5b98 (patch) | |
tree | 4d8c47c5bef56082293333f13f5fdc198bc3d8fb /sql/log.cc | |
parent | bc059e42c3ae50e467603c17b761d05539fecfbe (diff) | |
download | mariadb-git-f93d5f314bace40958d4eaefb8bf4029f67a5b98.tar.gz |
fixed uninitialized use of variable in mysqltest
fixed race condition in binary log auto-rotation
get rid of extention in binary log to avoid non-rotatable logs
client/mysqltest.c:
fixed uninitialized use of variable bug
sql/log.cc:
fixed race condition on binary log auto-rotate
sql/mysqld.cc:
get rid of extention on binary log
sql/sql_class.h:
argument to new file (inside_mutex)
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sql/log.cc b/sql/log.cc index 40e5d5673be..b062d56312c 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -514,17 +514,19 @@ bool MYSQL_LOG::is_active(const char* log_file_name) return inited && !strcmp(log_file_name, this->log_file_name); } -void MYSQL_LOG::new_file() +void MYSQL_LOG::new_file(bool inside_mutex) { // only rotate open logs that are marked non-rotatable // (binlog with constant name are non-rotatable) if (is_open() && ! no_rotate) { char new_name[FN_REFLEN], *old_name=name; - VOID(pthread_mutex_lock(&LOCK_log)); + if (!inside_mutex) + VOID(pthread_mutex_lock(&LOCK_log)); if (generate_new_name(new_name, name)) { - VOID(pthread_mutex_unlock(&LOCK_log)); + if (!inside_mutex) + VOID(pthread_mutex_unlock(&LOCK_log)); return; // Something went wrong } if (log_type == LOG_BIN) @@ -551,7 +553,8 @@ void MYSQL_LOG::new_file() my_free(old_name,MYF(0)); last_time=query_start=0; write_error=0; - VOID(pthread_mutex_unlock(&LOCK_log)); + if (!inside_mutex) + VOID(pthread_mutex_unlock(&LOCK_log)); } } @@ -729,9 +732,9 @@ err: if (file == &log_file) VOID(pthread_cond_broadcast(&COND_binlog_update)); } - VOID(pthread_mutex_unlock(&LOCK_log)); if(should_rotate) - new_file(); + new_file(1); // inside mutex + VOID(pthread_mutex_unlock(&LOCK_log)); return error; } @@ -817,12 +820,10 @@ bool MYSQL_LOG::write(Load_log_event* event_info) VOID(pthread_cond_broadcast(&COND_binlog_update)); } } + if(should_rotate) + new_file(1); // inside mutex VOID(pthread_mutex_unlock(&LOCK_log)); } - - if(should_rotate) - new_file(); - return error; } |