diff options
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 83 |
1 files changed, 23 insertions, 60 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 96319de5427..1dbe4ee35c6 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -820,56 +820,6 @@ const char *print_slave_db_safe(const char* db) DBUG_RETURN((db ? db : "")); } -int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, - const char *default_val) -{ - uint length; - DBUG_ENTER("init_strvar_from_file"); - - if ((length=my_b_gets(f,var, max_size))) - { - char* last_p = var + length -1; - if (*last_p == '\n') - *last_p = 0; // if we stopped on newline, kill it - else - { - /* - If we truncated a line or stopped on last char, remove all chars - up to and including newline. - */ - int c; - while (((c=my_b_get(f)) != '\n' && c != my_b_EOF)) ; - } - DBUG_RETURN(0); - } - else if (default_val) - { - strmake(var, default_val, max_size-1); - DBUG_RETURN(0); - } - DBUG_RETURN(1); -} - - -int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) -{ - char buf[32]; - DBUG_ENTER("init_intvar_from_file"); - - - if (my_b_gets(f, buf, sizeof(buf))) - { - *var = atoi(buf); - DBUG_RETURN(0); - } - else if (default_val) - { - *var = default_val; - DBUG_RETURN(0); - } - DBUG_RETURN(1); -} - /* Check if the error is caused by network. @@ -1194,18 +1144,27 @@ be equal for the Statement-format replication to work"; goto err; } } - else if (is_network_error(mysql_errno(mysql))) + else if (is_network_error(err_code= mysql_errno(mysql))) { - mi->report(WARNING_LEVEL, mysql_errno(mysql), - "Get master TIME_ZONE failed with error: %s", mysql_error(mysql)); + mi->report(ERROR_LEVEL, err_code, + "Get master TIME_ZONE failed with error: %s", + mysql_error(mysql)); goto network_err; - } + } + else if (err_code == ER_UNKNOWN_SYSTEM_VARIABLE) + { + /* We use ERROR_LEVEL to get the error logged to file */ + mi->report(ERROR_LEVEL, err_code, + + "MySQL master doesn't have a TIME_ZONE variable. Note that" + "if your timezone is not same between master and slave, your " + "slave may get wrong data into timestamp columns"); + } else { /* Fatal error */ errmsg= "The slave I/O thread stops because a fatal error is encountered \ when it try to get the value of TIME_ZONE global variable from master."; - err_code= mysql_errno(mysql); sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql)); goto err; } @@ -1834,6 +1793,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */ thd->slave_thread = 1; thd->enable_slow_log= opt_log_slow_slave_statements; + thd->variables.log_slow_filter= global_system_variables.log_slow_filter; set_slave_thread_options(thd); thd->client_capabilities = CLIENT_LOCAL_FILES; pthread_mutex_lock(&LOCK_thread_count); @@ -2187,7 +2147,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli) if (exec_res == 0) { int error= ev->update_pos(rli); -#ifdef HAVE_purify +#ifdef HAVE_valgrind if (!rli->is_fake) #endif { @@ -2321,7 +2281,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli) if (slave_trans_retries) { - int UNINIT_VAR(temp_err); + int temp_err; + LINT_INIT(temp_err); if (exec_res && (temp_err= has_temporary_error(thd))) { const char *errmsg; @@ -2897,7 +2858,6 @@ pthread_handler_t handle_slave_sql(void *arg) my_off_t UNINIT_VAR(saved_log_pos); my_off_t UNINIT_VAR(saved_master_log_pos); my_off_t saved_skip= 0; - Relay_log_info* rli = &((Master_info*)arg)->rli; const char *errmsg; @@ -2905,6 +2865,8 @@ pthread_handler_t handle_slave_sql(void *arg) my_thread_init(); DBUG_ENTER("handle_slave_sql"); + LINT_INIT(saved_master_log_pos); + LINT_INIT(saved_log_pos); DBUG_ASSERT(rli->inited); pthread_mutex_lock(&rli->run_lock); DBUG_ASSERT(!rli->slave_running); @@ -3906,10 +3868,11 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, suppress_warnings= 0; mi->report(ERROR_LEVEL, last_errno, "error %s to master '%s@%s:%d'" - " - retry-time: %d retries: %lu", + " - retry-time: %d retries: %lu message: %s", (reconnect ? "reconnecting" : "connecting"), mi->user, mi->host, mi->port, - mi->connect_retry, master_retry_count); + mi->connect_retry, master_retry_count, + mysql_error(mysql)); } /* By default we try forever. The reason is that failure will trigger |