mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Ensure that we have LOG_log locked when relay_log.close is called
If open of the relay log failed, we got an assert in MYSQL_BIN_LOG::close This only affected DEBUG systems
This commit is contained in:
parent
228479a28c
commit
f8dadbdf24
1 changed files with 9 additions and 2 deletions
|
@ -122,11 +122,14 @@ int init_relay_log_info(Relay_log_info* rli,
|
|||
int info_fd;
|
||||
const char* msg = 0;
|
||||
int error = 0;
|
||||
mysql_mutex_t *log_lock;
|
||||
DBUG_ENTER("init_relay_log_info");
|
||||
DBUG_ASSERT(!rli->no_storage); // Don't init if there is no storage
|
||||
|
||||
if (rli->inited) // Set if this function called
|
||||
DBUG_RETURN(0);
|
||||
|
||||
log_lock= rli->relay_log.get_log_lock();
|
||||
fn_format(fname, info_fname, mysql_data_home, "", 4+32);
|
||||
mysql_mutex_lock(&rli->data_lock);
|
||||
info_fd = rli->info_fd;
|
||||
|
@ -208,7 +211,6 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
|
|||
Master_info* mi= rli->mi;
|
||||
char buf_relay_logname[FN_REFLEN], buf_relaylog_index_name_buff[FN_REFLEN];
|
||||
char *buf_relaylog_index_name= opt_relaylog_index_name;
|
||||
mysql_mutex_t *log_lock;
|
||||
|
||||
create_logfile_name_with_suffix(buf_relay_logname,
|
||||
sizeof(buf_relay_logname),
|
||||
|
@ -228,7 +230,6 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
|
|||
note, that if open() fails, we'll still have index file open
|
||||
but a destructor will take care of that
|
||||
*/
|
||||
log_lock= rli->relay_log.get_log_lock();
|
||||
mysql_mutex_lock(log_lock);
|
||||
if (rli->relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
|
||||
rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
|
||||
|
@ -306,7 +307,9 @@ Failed to open the existing relay log info file '%s' (errno %d)",
|
|||
if (info_fd >= 0)
|
||||
mysql_file_close(info_fd, MYF(0));
|
||||
rli->info_fd= -1;
|
||||
mysql_mutex_lock(log_lock);
|
||||
rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
|
||||
mysql_mutex_unlock(log_lock);
|
||||
mysql_mutex_unlock(&rli->data_lock);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -437,8 +440,12 @@ err:
|
|||
if (info_fd >= 0)
|
||||
mysql_file_close(info_fd, MYF(0));
|
||||
rli->info_fd= -1;
|
||||
|
||||
mysql_mutex_lock(log_lock);
|
||||
rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
|
||||
mysql_mutex_unlock(log_lock);
|
||||
mysql_mutex_unlock(&rli->data_lock);
|
||||
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue