mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge 4.1 to 5.0.
BitKeeper/etc/logging_ok: auto-union client/mysql.cc: Auto merged configure.in: Auto merged client/mysqltest.c: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged mysql-test/r/insert.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/insert.test: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/query_cache.test: Auto merged sql/ha_innodb.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/lex.h: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/romanian/errmsg.txt: Auto merged
This commit is contained in:
36
sql/slave.cc
36
sql/slave.cc
@ -1388,6 +1388,7 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
|
||||
1 /* no auto events */,
|
||||
max_relay_log_size ? max_relay_log_size : max_binlog_size))
|
||||
{
|
||||
pthread_mutex_unlock(&rli->data_lock);
|
||||
sql_print_error("Failed in open_log() called from init_relay_log_info()");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -2351,7 +2352,9 @@ improper_arguments: %d timed_out: %d",
|
||||
static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
||||
{
|
||||
DBUG_ENTER("init_slave_thread");
|
||||
thd->system_thread = thd->bootstrap = 1;
|
||||
thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
|
||||
SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
|
||||
thd->bootstrap= 1;
|
||||
thd->host_or_ip= "";
|
||||
thd->client_capabilities = 0;
|
||||
my_net_init(&thd->net, 0);
|
||||
@ -4034,8 +4037,20 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
|
||||
sizeof(rli->event_relay_log_name)-1);
|
||||
flush_relay_log_info(rli);
|
||||
}
|
||||
|
||||
// next log is hot
|
||||
|
||||
/*
|
||||
Now we want to open this next log. To know if it's a hot log (the one
|
||||
being written by the I/O thread now) or a cold log, we can use
|
||||
is_active(); if it is hot, we use the I/O cache; if it's cold we open
|
||||
the file normally. But if is_active() reports that the log is hot, this
|
||||
may change between the test and the consequence of the test. So we may
|
||||
open the I/O cache whereas the log is now cold, which is nonsense.
|
||||
To guard against this, we need to have LOCK_log.
|
||||
*/
|
||||
|
||||
DBUG_PRINT("info",("hot_log: %d",hot_log));
|
||||
if (!hot_log) /* if hot_log, we already have this mutex */
|
||||
pthread_mutex_lock(log_lock);
|
||||
if (rli->relay_log.is_active(rli->linfo.log_file_name))
|
||||
{
|
||||
#ifdef EXTRA_DEBUG
|
||||
@ -4048,15 +4063,24 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s",
|
||||
|
||||
/*
|
||||
Read pointer has to be at the start since we are the only
|
||||
reader
|
||||
reader.
|
||||
We must keep the LOCK_log to read the 4 first bytes, as this is a hot
|
||||
log (same as when we call read_log_event() above: for a hot log we
|
||||
take the mutex).
|
||||
*/
|
||||
if (check_binlog_magic(cur_log,&errmsg))
|
||||
{
|
||||
if (!hot_log) pthread_mutex_unlock(log_lock);
|
||||
goto err;
|
||||
}
|
||||
if (!hot_log) pthread_mutex_unlock(log_lock);
|
||||
continue;
|
||||
}
|
||||
if (!hot_log) pthread_mutex_unlock(log_lock);
|
||||
/*
|
||||
if we get here, the log was not hot, so we will have to
|
||||
open it ourselves
|
||||
if we get here, the log was not hot, so we will have to open it
|
||||
ourselves. We are sure that the log is still not hot now (a log can get
|
||||
from hot to cold, but not from cold to hot). No need for LOCK_log.
|
||||
*/
|
||||
#ifdef EXTRA_DEBUG
|
||||
sql_print_error("next log '%s' is not active",
|
||||
|
Reference in New Issue
Block a user