diff options
author | SergeyV@selena. <> | 2005-10-03 20:34:42 +0400 |
---|---|---|
committer | SergeyV@selena. <> | 2005-10-03 20:34:42 +0400 |
commit | 7d0d7826bb8d715f935d954d3bba8ad863a0ebbc (patch) | |
tree | b17d1a566a5575ed3924ecb63801228be96d4018 /sql/sql_repl.cc | |
parent | 78504ac33e1063870aa6cab001229d6aaa74aef7 (diff) | |
download | mariadb-git-7d0d7826bb8d715f935d954d3bba8ad863a0ebbc.tar.gz |
Fixes bug #13377. Added code to close active log files in case
of log reset condition.
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r-- | sql/sql_repl.cc | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 98f47d13eee..b5865fa8816 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -372,6 +372,11 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, goto err; } + /* + Call readers_addref before opening log to track count + of binlog readers + */ + mysql_bin_log.readers_addref(); if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0) { my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; @@ -569,7 +574,8 @@ impossible position"; goto err; if (!(flags & BINLOG_DUMP_NON_BLOCK) && - mysql_bin_log.is_active(log_file_name)) + mysql_bin_log.is_active(log_file_name) && + !mysql_bin_log.is_reset_pending()) { /* Block until there is more data in the log @@ -683,6 +689,13 @@ impossible position"; { bool loop_breaker = 0; // need this to break out of the for loop from switch + + // if we are going to switch log file anyway, close current log first + end_io_cache(&log); + (void) my_close(file, MYF(MY_WME)); + // decrease reference count of binlog readers + mysql_bin_log.readers_release(); + thd->proc_info = "Finished reading one binlog; switching to next binlog"; switch (mysql_bin_log.find_next_log(&linfo, 1)) { case LOG_INFO_EOF: @@ -691,16 +704,25 @@ impossible position"; case 0: break; default: + // need following call to do release on err label + mysql_bin_log.readers_addref(); errmsg = "could not find next log"; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; goto err; } - if (loop_breaker) - break; + if (loop_breaker) + { + // need following call to do release on end label + mysql_bin_log.readers_addref(); + break; + } - end_io_cache(&log); - (void) my_close(file, MYF(MY_WME)); + /* + Call readers_addref before opening log to track count + of binlog readers + */ + mysql_bin_log.readers_addref(); /* Call fake_rotate_event() in case the previous log (the one which @@ -733,6 +755,8 @@ end: end_io_cache(&log); (void)my_close(file, MYF(MY_WME)); + // decrease reference count of binlog readers + mysql_bin_log.readers_release(); send_eof(thd); thd->proc_info = "Waiting to finalize termination"; @@ -759,6 +783,9 @@ err: pthread_mutex_unlock(&LOCK_thread_count); if (file >= 0) (void) my_close(file, MYF(MY_WME)); + // decrease reference count of binlog readers + mysql_bin_log.readers_release(); + my_message(my_errno, errmsg, MYF(0)); DBUG_VOID_RETURN; } |