Commit c862c15b authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: [partial] removal of llstr()

now when my_vsnprintf() supports %llu for a few years already.
parent fff6f427
...@@ -4281,12 +4281,9 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) ...@@ -4281,12 +4281,9 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) || if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) ||
(error=find_next_log(&rli->linfo, 0))) (error=find_next_log(&rli->linfo, 0)))
{ {
char buff[22]; sql_print_error("next log error: %d offset: %llu log: %s included: %d",
sql_print_error("next log error: %d offset: %s log: %s included: %d", error, rli->linfo.index_file_offset,
error, rli->event_relay_log_name, included);
llstr(rli->linfo.index_file_offset,buff),
rli->event_relay_log_name,
included);
goto err; goto err;
} }
...@@ -4327,12 +4324,9 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) ...@@ -4327,12 +4324,9 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
*/ */
if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0))) if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)))
{ {
char buff[22]; sql_print_error("next log error: %d offset: %llu log: %s included: %d",
sql_print_error("next log error: %d offset: %s log: %s included: %d", error, rli->linfo.index_file_offset,
error, rli->group_relay_log_name, included);
llstr(rli->linfo.index_file_offset,buff),
rli->group_relay_log_name,
included);
goto err; goto err;
} }
......
...@@ -3388,14 +3388,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, ...@@ -3388,14 +3388,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
break; break;
case Q_SQL_MODE_CODE: case Q_SQL_MODE_CODE:
{ {
#ifndef DBUG_OFF
char buff[22];
#endif
CHECK_SPACE(pos, end, 8); CHECK_SPACE(pos, end, 8);
sql_mode_inited= 1; sql_mode_inited= 1;
sql_mode= (ulong) uint8korr(pos); // QQ: Fix when sql_mode is ulonglong sql_mode= (ulong) uint8korr(pos); // QQ: Fix when sql_mode is ulonglong
DBUG_PRINT("info",("In Query_log_event, read sql_mode: %s", DBUG_PRINT("info",("In Query_log_event, read sql_mode: %llu", sql_mode));
llstr(sql_mode, buff)));
pos+= 8; pos+= 8;
break; break;
} }
...@@ -5787,7 +5783,6 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi, ...@@ -5787,7 +5783,6 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
} }
else else
{ {
char llbuff[22];
enum enum_duplicates handle_dup; enum enum_duplicates handle_dup;
bool ignore= 0; bool ignore= 0;
char query_buffer[1024]; char query_buffer[1024];
...@@ -5888,10 +5883,9 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi, ...@@ -5888,10 +5883,9 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
{ {
/* log_pos is the position of the LOAD event in the master log */ /* log_pos is the position of the LOAD event in the master log */
sql_print_warning("Slave: load data infile on table '%s' at " sql_print_warning("Slave: load data infile on table '%s' at "
"log position %s in log '%s' produced %ld " "log position %llu in log '%s' produced %ld "
"warning(s). Default database: '%s'", "warning(s). Default database: '%s'",
(char*) table_name, (char*) table_name, log_pos, RPL_LOG_NAME,
llstr(log_pos,llbuff), RPL_LOG_NAME,
(ulong) thd->cuted_fields, (ulong) thd->cuted_fields,
print_slave_db_safe(thd->db)); print_slave_db_safe(thd->db));
} }
...@@ -5999,12 +5993,11 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'", ...@@ -5999,12 +5993,11 @@ Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Rotate_log_event::pack_info(THD *thd, Protocol *protocol) void Rotate_log_event::pack_info(THD *thd, Protocol *protocol)
{ {
char buf1[256], buf[22]; StringBuffer<256> tmp(log_cs);
String tmp(buf1, sizeof(buf1), log_cs);
tmp.length(0); tmp.length(0);
tmp.append(new_log_ident, ident_len); tmp.append(new_log_ident, ident_len);
tmp.append(STRING_WITH_LEN(";pos=")); tmp.append(STRING_WITH_LEN(";pos="));
tmp.append(llstr(pos,buf)); tmp.append_ulonglong(pos);
protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin); protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
} }
#endif #endif
......
...@@ -395,24 +395,16 @@ Failed to open the existing relay log info file '%s' (errno %d)", ...@@ -395,24 +395,16 @@ Failed to open the existing relay log info file '%s' (errno %d)",
0 /* no data lock*/, 0 /* no data lock*/,
&msg, 0)) &msg, 0))
{ {
char llbuf[22]; sql_print_error("Failed to open the relay log '%s' (relay_log_pos %llu)",
sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)", rli->group_relay_log_name, rli->group_relay_log_pos);
rli->group_relay_log_name,
llstr(rli->group_relay_log_pos, llbuf));
goto err; goto err;
} }
} }
#ifndef DBUG_OFF DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu rli->event_relay_log_pos=%llu",
{ my_b_tell(rli->cur_log), rli->event_relay_log_pos));
char llbuf1[22], llbuf2[22]; DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE);
DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s", DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->event_relay_log_pos);
llstr(my_b_tell(rli->cur_log),llbuf1),
llstr(rli->event_relay_log_pos,llbuf2)));
DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE);
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->event_relay_log_pos);
}
#endif
/* /*
Now change the cache from READ to WRITE - must do this Now change the cache from READ to WRITE - must do this
...@@ -457,10 +449,7 @@ static inline int add_relay_log(Relay_log_info* rli,LOG_INFO* linfo) ...@@ -457,10 +449,7 @@ static inline int add_relay_log(Relay_log_info* rli,LOG_INFO* linfo)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
rli->log_space_total += s.st_size; rli->log_space_total += s.st_size;
#ifndef DBUG_OFF DBUG_PRINT("info",("log_space_total: %llu", rli->log_space_total));
char buf[22];
DBUG_PRINT("info",("log_space_total: %s", llstr(rli->log_space_total,buf)));
#endif
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -725,14 +714,8 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log, ...@@ -725,14 +714,8 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log,
rli->relay_log.description_event_for_exec= fdev; rli->relay_log.description_event_for_exec= fdev;
} }
my_b_seek(rli->cur_log,(off_t)pos); my_b_seek(rli->cur_log,(off_t)pos);
#ifndef DBUG_OFF DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu rli->event_relay_log_pos=%llu",
{ my_b_tell(rli->cur_log), rli->event_relay_log_pos));
char llbuf1[22], llbuf2[22];
DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s",
llstr(my_b_tell(rli->cur_log),llbuf1),
llstr(rli->event_relay_log_pos,llbuf2)));
}
#endif
} }
...@@ -1165,10 +1148,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset, ...@@ -1165,10 +1148,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
} }
err: err:
#ifndef DBUG_OFF DBUG_PRINT("info",("log_space_total: %llu",rli->log_space_total));
char buf[22];
#endif
DBUG_PRINT("info",("log_space_total: %s",llstr(rli->log_space_total,buf)));
mysql_mutex_unlock(&rli->data_lock); mysql_mutex_unlock(&rli->data_lock);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -1225,21 +1205,16 @@ bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos) ...@@ -1225,21 +1205,16 @@ bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos)
log_pos= group_relay_log_pos; log_pos= group_relay_log_pos;
} }
#ifndef DBUG_OFF DBUG_PRINT("info", ("group_master_log_name='%s', group_master_log_pos=%llu",
{ group_master_log_name, group_master_log_pos));
char buf[32]; DBUG_PRINT("info", ("group_relay_log_name='%s', group_relay_log_pos=%llu",
DBUG_PRINT("info", ("group_master_log_name='%s', group_master_log_pos=%s", group_relay_log_name, group_relay_log_pos));
group_master_log_name, llstr(group_master_log_pos, buf))); DBUG_PRINT("info", ("(%s) log_name='%s', log_pos=%llu",
DBUG_PRINT("info", ("group_relay_log_name='%s', group_relay_log_pos=%s", until_condition == UNTIL_MASTER_POS ? "master" : "relay",
group_relay_log_name, llstr(group_relay_log_pos, buf))); log_name, log_pos));
DBUG_PRINT("info", ("(%s) log_name='%s', log_pos=%s", DBUG_PRINT("info", ("(%s) until_log_name='%s', until_log_pos=%llu",
until_condition == UNTIL_MASTER_POS ? "master" : "relay", until_condition == UNTIL_MASTER_POS ? "master" : "relay",
log_name, llstr(log_pos, buf))); until_log_name, until_log_pos));
DBUG_PRINT("info", ("(%s) until_log_name='%s', until_log_pos=%s",
until_condition == UNTIL_MASTER_POS ? "master" : "relay",
until_log_name, llstr(until_log_pos, buf)));
}
#endif
if (until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_UNKNOWN) if (until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_UNKNOWN)
{ {
......
...@@ -121,7 +121,7 @@ static const char *reconnect_messages[SLAVE_RECON_ACT_MAX][SLAVE_RECON_MSG_MAX]= ...@@ -121,7 +121,7 @@ static const char *reconnect_messages[SLAVE_RECON_ACT_MAX][SLAVE_RECON_MSG_MAX]=
registration on master", registration on master",
"Reconnecting after a failed registration on master", "Reconnecting after a failed registration on master",
"failed registering on master, reconnecting to try again, \ "failed registering on master, reconnecting to try again, \
log '%s' at position %s%s", log '%s' at position %llu%s",
"COM_REGISTER_SLAVE", "COM_REGISTER_SLAVE",
"Slave I/O thread killed during or after reconnect" "Slave I/O thread killed during or after reconnect"
}, },
...@@ -129,7 +129,7 @@ log '%s' at position %s%s", ...@@ -129,7 +129,7 @@ log '%s' at position %s%s",
"Waiting to reconnect after a failed binlog dump request", "Waiting to reconnect after a failed binlog dump request",
"Slave I/O thread killed while retrying master dump", "Slave I/O thread killed while retrying master dump",
"Reconnecting after a failed binlog dump request", "Reconnecting after a failed binlog dump request",
"failed dump request, reconnecting to try again, log '%s' at position %s%s", "failed dump request, reconnecting to try again, log '%s' at position %llu%s",
"COM_BINLOG_DUMP", "COM_BINLOG_DUMP",
"Slave I/O thread killed during or after reconnect" "Slave I/O thread killed during or after reconnect"
}, },
...@@ -138,7 +138,7 @@ log '%s' at position %s%s", ...@@ -138,7 +138,7 @@ log '%s' at position %s%s",
"Slave I/O thread killed while waiting to reconnect after a failed read", "Slave I/O thread killed while waiting to reconnect after a failed read",
"Reconnecting after a failed master event read", "Reconnecting after a failed master event read",
"Slave I/O thread: Failed reading log event, reconnecting to retry, \ "Slave I/O thread: Failed reading log event, reconnecting to retry, \
log '%s' at position %s%s", log '%s' at position %llu%s",
"", "",
"Slave I/O thread killed during or after a reconnect done to recover from \ "Slave I/O thread killed during or after a reconnect done to recover from \
failed read" failed read"
...@@ -1772,14 +1772,13 @@ when it try to get the value of TIME_ZONE global variable from master."; ...@@ -1772,14 +1772,13 @@ when it try to get the value of TIME_ZONE global variable from master.";
if (mi->heartbeat_period != 0.0) if (mi->heartbeat_period != 0.0)
{ {
char llbuf[22]; const char query_format[]= "SET @master_heartbeat_period= %llu";
const char query_format[]= "SET @master_heartbeat_period= %s"; char query[sizeof(query_format) + 32];
char query[sizeof(query_format) - 2 + sizeof(llbuf)];
/* /*
the period is an ulonglong of nano-secs. the period is an ulonglong of nano-secs.
*/ */
llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf); my_snprintf(query, sizeof(query), query_format,
sprintf(query, query_format, llbuf); (ulonglong) (mi->heartbeat_period*1000000000UL));
DBUG_EXECUTE_IF("simulate_slave_heartbeat_network_error", DBUG_EXECUTE_IF("simulate_slave_heartbeat_network_error",
{ static ulong dbug_count= 0; { static ulong dbug_count= 0;
...@@ -2298,13 +2297,10 @@ static bool wait_for_relay_log_space(Relay_log_info* rli) ...@@ -2298,13 +2297,10 @@ static bool wait_for_relay_log_space(Relay_log_info* rli)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
{ {
char llbuf1[22], llbuf2[22]; DBUG_PRINT("info", ("log_space_limit=%llu log_space_total=%llu "
DBUG_PRINT("info", ("log_space_limit=%s "
"log_space_total=%s "
"ignore_log_space_limit=%d " "ignore_log_space_limit=%d "
"sql_force_rotate_relay=%d", "sql_force_rotate_relay=%d",
llstr(rli->log_space_limit,llbuf1), rli->log_space_limit, rli->log_space_total,
llstr(rli->log_space_total,llbuf2),
(int) rli->ignore_log_space_limit, (int) rli->ignore_log_space_limit,
(int) rli->sql_force_rotate_relay)); (int) rli->sql_force_rotate_relay));
} }
...@@ -2744,8 +2740,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, ...@@ -2744,8 +2740,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
String *packet= &thd->packet; String *packet= &thd->packet;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
Rpl_filter *rpl_filter= mi->rpl_filter; Rpl_filter *rpl_filter= mi->rpl_filter;
char buf[256]; StringBuffer<256> tmp;
String tmp(buf, sizeof(buf), &my_charset_bin);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
...@@ -2901,9 +2896,8 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, ...@@ -2901,9 +2896,8 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
protocol->store(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin); protocol->store(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin);
// Gtid_IO_Pos // Gtid_IO_Pos
{ {
String tmp2(buf, sizeof(buf), system_charset_info); mi->gtid_current_pos.to_string(&tmp);
mi->gtid_current_pos.to_string(&tmp2); protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
protocol->store(tmp2.ptr(), tmp2.length(), &my_charset_bin);
} }
// Replicate_Do_Domain_Ids & Replicate_Ignore_Domain_Ids // Replicate_Do_Domain_Ids & Replicate_Ignore_Domain_Ids
...@@ -3410,15 +3404,10 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, ...@@ -3410,15 +3404,10 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd,
if (!rli->is_fake) if (!rli->is_fake)
#endif #endif
{ {
#ifndef DBUG_OFF
char buf[22];
#endif
DBUG_PRINT("info", ("update_pos error = %d", error)); DBUG_PRINT("info", ("update_pos error = %d", error));
DBUG_PRINT("info", ("group %s %s", DBUG_PRINT("info", ("group %llu %s", rli->group_relay_log_pos,
llstr(rli->group_relay_log_pos, buf),
rli->group_relay_log_name)); rli->group_relay_log_name));
DBUG_PRINT("info", ("event %s %s", DBUG_PRINT("info", ("event %llu %s", rli->event_relay_log_pos,
llstr(rli->event_relay_log_pos, buf),
rli->event_relay_log_name)); rli->event_relay_log_name));
} }
/* /*
...@@ -3430,14 +3419,12 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, ...@@ -3430,14 +3419,12 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd,
*/ */
if (error) if (error)
{ {
char buf[22];
rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR, rgi->gtid_info(), rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR, rgi->gtid_info(),
"It was not possible to update the positions" "It was not possible to update the positions"
" of the relay log information: the slave may" " of the relay log information: the slave may"
" be in an inconsistent state." " be in an inconsistent state."
" Stopped in %s position %s", " Stopped in %s position %llu",
rli->group_relay_log_name, rli->group_relay_log_name, rli->group_relay_log_pos);
llstr(rli->group_relay_log_pos, buf));
DBUG_RETURN(2); DBUG_RETURN(2);
} }
} }
...@@ -3610,9 +3597,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, ...@@ -3610,9 +3597,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
? rli->group_master_log_pos ? rli->group_master_log_pos
: ev->log_pos - ev->data_written)) : ev->log_pos - ev->data_written))
{ {
char buf[22];
sql_print_information("Slave SQL thread stopped because it reached its" sql_print_information("Slave SQL thread stopped because it reached its"
" UNTIL position %s", llstr(rli->until_pos(), buf)); " UNTIL position %llu", rli->until_pos());
/* /*
Setting abort_slave flag because we do not want additional Setting abort_slave flag because we do not want additional
message about error in query execution to be printed. message about error in query execution to be printed.
...@@ -3859,8 +3845,8 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, ...@@ -3859,8 +3845,8 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi,
thd->proc_info = messages[SLAVE_RECON_MSG_AFTER]; thd->proc_info = messages[SLAVE_RECON_MSG_AFTER];
if (!suppress_warnings) if (!suppress_warnings)
{ {
char buf[256], llbuff[22]; char buf[256];
String tmp; StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO) if (mi->using_gtid != Master_info::USE_GTID_NO)
{ {
tmp.append(STRING_WITH_LEN("; GTID position '")); tmp.append(STRING_WITH_LEN("; GTID position '"));
...@@ -3874,7 +3860,7 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, ...@@ -3874,7 +3860,7 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi,
} }
} }
my_snprintf(buf, sizeof(buf), messages[SLAVE_RECON_MSG_FAILED], my_snprintf(buf, sizeof(buf), messages[SLAVE_RECON_MSG_FAILED],
IO_RPL_LOG_NAME, llstr(mi->master_log_pos, llbuff), IO_RPL_LOG_NAME, mi->master_log_pos,
tmp.c_ptr_safe()); tmp.c_ptr_safe());
/* /*
Raise a warining during registering on master/requesting dump. Raise a warining during registering on master/requesting dump.
...@@ -3915,7 +3901,6 @@ pthread_handler_t handle_slave_io(void *arg) ...@@ -3915,7 +3901,6 @@ pthread_handler_t handle_slave_io(void *arg)
MYSQL *mysql; MYSQL *mysql;
Master_info *mi = (Master_info*)arg; Master_info *mi = (Master_info*)arg;
Relay_log_info *rli= &mi->rli; Relay_log_info *rli= &mi->rli;
char llbuff[22];
uint retry_count; uint retry_count;
bool suppress_warnings; bool suppress_warnings;
int ret; int ret;
...@@ -3962,9 +3947,8 @@ pthread_handler_t handle_slave_io(void *arg) ...@@ -3962,9 +3947,8 @@ pthread_handler_t handle_slave_io(void *arg)
mysql_mutex_unlock(&mi->run_lock); mysql_mutex_unlock(&mi->run_lock);
mysql_cond_broadcast(&mi->start_cond); mysql_cond_broadcast(&mi->start_cond);
DBUG_PRINT("master_info",("log_file_name: '%s' position: %s", DBUG_PRINT("master_info",("log_file_name: '%s' position: %llu",
mi->master_log_name, mi->master_log_name, mi->master_log_pos));
llstr(mi->master_log_pos,llbuff)));
/* This must be called before run any binlog_relay_io hooks */ /* This must be called before run any binlog_relay_io hooks */
my_pthread_setspecific_ptr(RPL_MASTER_INFO, mi); my_pthread_setspecific_ptr(RPL_MASTER_INFO, mi);
...@@ -4007,13 +3991,12 @@ pthread_handler_t handle_slave_io(void *arg) ...@@ -4007,13 +3991,12 @@ pthread_handler_t handle_slave_io(void *arg)
{ {
if (mi->using_gtid == Master_info::USE_GTID_NO) if (mi->using_gtid == Master_info::USE_GTID_NO)
sql_print_information("Slave I/O thread: connected to master '%s@%s:%d'," sql_print_information("Slave I/O thread: connected to master '%s@%s:%d',"
"replication started in log '%s' at position %s", "replication started in log '%s' at position %llu",
mi->user, mi->host, mi->port, mi->user, mi->host, mi->port,
IO_RPL_LOG_NAME, IO_RPL_LOG_NAME, mi->master_log_pos);
llstr(mi->master_log_pos,llbuff));
else else
{ {
String tmp; StringBuffer<100> tmp;
mi->gtid_current_pos.to_string(&tmp); mi->gtid_current_pos.to_string(&tmp);
sql_print_information("Slave I/O thread: connected to master '%s@%s:%d'," sql_print_information("Slave I/O thread: connected to master '%s@%s:%d',"
"replication starts at GTID position '%s'", "replication starts at GTID position '%s'",
...@@ -4070,7 +4053,7 @@ pthread_handler_t handle_slave_io(void *arg) ...@@ -4070,7 +4053,7 @@ pthread_handler_t handle_slave_io(void *arg)
if (ret == 2) if (ret == 2)
{ {
if (check_io_slave_killed(mi, "Slave I/O thread killed" if (check_io_slave_killed(mi, "Slave I/O thread killed "
"while calling get_master_version_and_clock(...)")) "while calling get_master_version_and_clock(...)"))
goto err; goto err;
suppress_warnings= FALSE; suppress_warnings= FALSE;
...@@ -4224,11 +4207,9 @@ Stopping slave I/O thread due to out-of-memory error from master"); ...@@ -4224,11 +4207,9 @@ Stopping slave I/O thread due to out-of-memory error from master");
*/ */
#ifndef DBUG_OFF #ifndef DBUG_OFF
{ {
char llbuf1[22], llbuf2[22]; DBUG_PRINT("info", ("log_space_limit=%llu log_space_total=%llu "
DBUG_PRINT("info", ("log_space_limit=%s log_space_total=%s \ "ignore_log_space_limit=%d",
ignore_log_space_limit=%d", rli->log_space_limit, rli->log_space_total,
llstr(rli->log_space_limit,llbuf1),
llstr(rli->log_space_total,llbuf2),
(int) rli->ignore_log_space_limit)); (int) rli->ignore_log_space_limit));
} }
#endif #endif
...@@ -4250,15 +4231,14 @@ log space"); ...@@ -4250,15 +4231,14 @@ log space");
// print the current replication position // print the current replication position
if (mi->using_gtid == Master_info::USE_GTID_NO) if (mi->using_gtid == Master_info::USE_GTID_NO)
sql_print_information("Slave I/O thread exiting, read up to log '%s', " sql_print_information("Slave I/O thread exiting, read up to log '%s', "
"position %s", "position %llu", IO_RPL_LOG_NAME, mi->master_log_pos);
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
else else
{ {
String tmp; StringBuffer<100> tmp;
mi->gtid_current_pos.to_string(&tmp); mi->gtid_current_pos.to_string(&tmp);
sql_print_information("Slave I/O thread exiting, read up to log '%s', " sql_print_information("Slave I/O thread exiting, read up to log '%s', "
"position %s; GTID position %s", "position %llu; GTID position %s",
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff), IO_RPL_LOG_NAME, mi->master_log_pos,
tmp.c_ptr_safe()); tmp.c_ptr_safe());
} }
RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi)); RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi));
...@@ -4398,7 +4378,6 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd) ...@@ -4398,7 +4378,6 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd)
*/ */
Relay_log_info *rli= rgi->rli; Relay_log_info *rli= rgi->rli;
uint32 const last_errno= rli->last_error().number; uint32 const last_errno= rli->last_error().number;
char llbuff[22];
if (thd->is_error()) if (thd->is_error())
{ {
...@@ -4446,7 +4425,7 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd) ...@@ -4446,7 +4425,7 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd)
} }
if (udf_error) if (udf_error)
{ {
String tmp; StringBuffer<100> tmp;
if (rli->mi->using_gtid != Master_info::USE_GTID_NO) if (rli->mi->using_gtid != Master_info::USE_GTID_NO)
{ {
tmp.append(STRING_WITH_LEN("; GTID position '")); tmp.append(STRING_WITH_LEN("; GTID position '"));
...@@ -4456,22 +4435,22 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd) ...@@ -4456,22 +4435,22 @@ slave_output_error_info(rpl_group_info *rgi, THD *thd)
sql_print_error("Error loading user-defined library, slave SQL " sql_print_error("Error loading user-defined library, slave SQL "
"thread aborted. Install the missing library, and restart the " "thread aborted. Install the missing library, and restart the "
"slave SQL thread with \"SLAVE START\". We stopped at log '%s' " "slave SQL thread with \"SLAVE START\". We stopped at log '%s' "
"position %s%s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, "position %llu%s", RPL_LOG_NAME, rli->group_master_log_pos,
llbuff), tmp.c_ptr_safe()); tmp.c_ptr_safe());
} }
else else
{ {
String tmp; StringBuffer<100> tmp;
if (rli->mi->using_gtid != Master_info::USE_GTID_NO) if (rli->mi->using_gtid != Master_info::USE_GTID_NO)
{ {
tmp.append(STRING_WITH_LEN("; GTID position '")); tmp.append(STRING_WITH_LEN("; GTID position '"));
rpl_append_gtid_state(&tmp, false); rpl_append_gtid_state(&tmp, false);
tmp.append(STRING_WITH_LEN("'")); tmp.append(STRING_WITH_LEN("'"));
} }
sql_print_error("\ sql_print_error("Error running query, slave SQL thread aborted. "
Error running query, slave SQL thread aborted. Fix the problem, and restart \ "Fix the problem, and restart the slave SQL thread "
the slave SQL thread with \"SLAVE START\". We stopped at log \ "with \"SLAVE START\". We stopped at log '%s' position "
'%s' position %s%s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, llbuff), "%llu%s", RPL_LOG_NAME, rli->group_master_log_pos,
tmp.c_ptr_safe()); tmp.c_ptr_safe());
} }
} }
...@@ -4488,7 +4467,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ ...@@ -4488,7 +4467,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
pthread_handler_t handle_slave_sql(void *arg) pthread_handler_t handle_slave_sql(void *arg)
{ {
THD *thd; /* needs to be first for thread_stack */ THD *thd; /* needs to be first for thread_stack */
char llbuff[22],llbuff1[22];
char saved_log_name[FN_REFLEN]; char saved_log_name[FN_REFLEN];
char saved_master_log_name[FN_REFLEN]; char saved_master_log_name[FN_REFLEN];
my_off_t UNINIT_VAR(saved_log_pos); my_off_t UNINIT_VAR(saved_log_pos);
...@@ -4625,10 +4603,9 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -4625,10 +4603,9 @@ pthread_handler_t handle_slave_sql(void *arg)
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
#ifndef DBUG_OFF #ifndef DBUG_OFF
{ {
char llbuf1[22], llbuf2[22]; DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu "
DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s", "rli->event_relay_log_pos=%llu",
llstr(my_b_tell(rli->cur_log),llbuf1), my_b_tell(rli->cur_log), rli->event_relay_log_pos));
llstr(rli->event_relay_log_pos,llbuf2)));
DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE); DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE);
/* /*
Wonder if this is correct. I (Guilhem) wonder if my_b_tell() returns the Wonder if this is correct. I (Guilhem) wonder if my_b_tell() returns the
...@@ -4654,12 +4631,12 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -4654,12 +4631,12 @@ pthread_handler_t handle_slave_sql(void *arg)
if (WSREP_ON) if (WSREP_ON)
wsrep_ready_wait(); wsrep_ready_wait();
#endif #endif
DBUG_PRINT("master_info",("log_file_name: %s position: %s", DBUG_PRINT("master_info",("log_file_name: %s position: %llu",
rli->group_master_log_name, rli->group_master_log_name,
llstr(rli->group_master_log_pos,llbuff))); rli->group_master_log_pos));
if (global_system_variables.log_warnings) if (global_system_variables.log_warnings)
{ {
String tmp; StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO) if (mi->using_gtid != Master_info::USE_GTID_NO)
{ {
tmp.append(STRING_WITH_LEN("; GTID position '")); tmp.append(STRING_WITH_LEN("; GTID position '"));
...@@ -4667,10 +4644,11 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -4667,10 +4644,11 @@ pthread_handler_t handle_slave_sql(void *arg)
mi->using_gtid==Master_info::USE_GTID_CURRENT_POS); mi->using_gtid==Master_info::USE_GTID_CURRENT_POS);
tmp.append(STRING_WITH_LEN("'")); tmp.append(STRING_WITH_LEN("'"));
} }
sql_print_information("Slave SQL thread initialized, starting replication in \ sql_print_information("Slave SQL thread initialized, starting replication "
log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, "in log '%s' at position %llu, relay log '%s' "
llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name, "position: %llu%s", RPL_LOG_NAME,
llstr(rli->group_relay_log_pos,llbuff1), tmp.c_ptr_safe()); rli->group_master_log_pos, rli->group_relay_log_name,
rli->group_relay_log_pos, tmp.c_ptr_safe());
} }
if (check_temp_dir(rli->slave_patternload_file)) if (check_temp_dir(rli->slave_patternload_file))
...@@ -4732,9 +4710,8 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ...@@ -4732,9 +4710,8 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) && rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) &&
rli->is_until_satisfied(rli->group_master_log_pos)) rli->is_until_satisfied(rli->group_master_log_pos))
{ {
char buf[22];
sql_print_information("Slave SQL thread stopped because it reached its" sql_print_information("Slave SQL thread stopped because it reached its"
" UNTIL position %s", llstr(rli->until_pos(), buf)); " UNTIL position %llu", rli->until_pos());
mysql_mutex_unlock(&rli->data_lock); mysql_mutex_unlock(&rli->data_lock);
goto err; goto err;
} }
...@@ -4749,7 +4726,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ...@@ -4749,7 +4726,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
if (saved_skip && rli->slave_skip_counter == 0) if (saved_skip && rli->slave_skip_counter == 0)
{ {
String tmp; StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO) if (mi->using_gtid != Master_info::USE_GTID_NO)
{ {
tmp.append(STRING_WITH_LEN(", GTID '")); tmp.append(STRING_WITH_LEN(", GTID '"));
...@@ -4793,7 +4770,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ...@@ -4793,7 +4770,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
/* Thread stopped. Print the current replication position to the log */ /* Thread stopped. Print the current replication position to the log */
{ {
String tmp; StringBuffer<100> tmp;
if (mi->using_gtid != Master_info::USE_GTID_NO) if (mi->using_gtid != Master_info::USE_GTID_NO)
{ {
tmp.append(STRING_WITH_LEN("; GTID position '")); tmp.append(STRING_WITH_LEN("; GTID position '"));
...@@ -4801,10 +4778,8 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ...@@ -4801,10 +4778,8 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
tmp.append(STRING_WITH_LEN("'")); tmp.append(STRING_WITH_LEN("'"));
} }
sql_print_information("Slave SQL thread exiting, replication stopped in " sql_print_information("Slave SQL thread exiting, replication stopped in "
"log '%s' at position %s%s", "log '%s' at position %llu%s", RPL_LOG_NAME,
RPL_LOG_NAME, rli->group_master_log_pos, tmp.c_ptr_safe());
llstr(rli->group_master_log_pos,llbuff),
tmp.c_ptr_safe());
} }
err: err:
...@@ -5365,7 +5340,7 @@ static int queue_old_event(Master_info *mi, const char *buf, ...@@ -5365,7 +5340,7 @@ static int queue_old_event(Master_info *mi, const char *buf,
static int queue_event(Master_info* mi,const char* buf, ulong event_len) static int queue_event(Master_info* mi,const char* buf, ulong event_len)
{ {
int error= 0; int error= 0;
String error_msg; StringBuffer<1024> error_msg;
ulonglong inc_pos; ulonglong inc_pos;
ulonglong event_pos; ulonglong event_pos;
Relay_log_info *rli= &mi->rli; Relay_log_info *rli= &mi->rli;
...@@ -5673,7 +5648,6 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) ...@@ -5673,7 +5648,6 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
/* /*
HB (heartbeat) cannot come before RL (Relay) HB (heartbeat) cannot come before RL (Relay)
*/ */
char llbuf[22];
Heartbeat_log_event hb(buf, Heartbeat_log_event hb(buf,
mi->rli.relay_log.relay_log_checksum_alg mi->rli.relay_log.relay_log_checksum_alg
!= BINLOG_CHECKSUM_ALG_OFF ? != BINLOG_CHECKSUM_ALG_OFF ?
...@@ -5686,8 +5660,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) ...@@ -5686,8 +5660,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
error_msg.append(STRING_WITH_LEN("the event's data: log_file_name ")); error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident())); error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
error_msg.append(STRING_WITH_LEN(" log_pos ")); error_msg.append(STRING_WITH_LEN(" log_pos "));
llstr(hb.log_pos, llbuf); error_msg.append_ulonglong(hb.log_pos);
error_msg.append(llbuf, strlen(llbuf));
goto err; goto err;
} }
mi->received_heartbeats++; mi->received_heartbeats++;
...@@ -5715,8 +5688,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) ...@@ -5715,8 +5688,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
error_msg.append(STRING_WITH_LEN("the event's data: log_file_name ")); error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident())); error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
error_msg.append(STRING_WITH_LEN(" log_pos ")); error_msg.append(STRING_WITH_LEN(" log_pos "));
llstr(hb.log_pos, llbuf); error_msg.append_ulonglong(hb.log_pos);
error_msg.append(llbuf, strlen(llbuf));
goto err; goto err;
} }
goto skip_relay_logging; goto skip_relay_logging;
...@@ -6205,7 +6177,6 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, ...@@ -6205,7 +6177,6 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
int slave_was_killed; int slave_was_killed;
int last_errno= -2; // impossible error int last_errno= -2; // impossible error
ulong err_count=0; ulong err_count=0;
char llbuff[22];
my_bool my_true= 1; my_bool my_true= 1;
DBUG_ENTER("connect_to_master"); DBUG_ENTER("connect_to_master");
set_slave_max_allowed_packet(thd, mysql); set_slave_max_allowed_packet(thd, mysql);
...@@ -6313,11 +6284,10 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, ...@@ -6313,11 +6284,10 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
if (reconnect) if (reconnect)
{ {
if (!suppress_warnings && global_system_variables.log_warnings) if (!suppress_warnings && global_system_variables.log_warnings)
sql_print_information("Slave: connected to master '%s@%s:%d',\ sql_print_information("Slave: connected to master '%s@%s:%d',"
replication resumed in log '%s' at position %s", mi->user, "replication resumed in log '%s' at "
mi->host, mi->port, "position %llu", mi->user, mi->host, mi->port,
IO_RPL_LOG_NAME, IO_RPL_LOG_NAME, mi->master_log_pos);
llstr(mi->master_log_pos,llbuff));
} }
else else
{ {
...@@ -6600,10 +6570,8 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) ...@@ -6600,10 +6570,8 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
#ifndef DBUG_OFF #ifndef DBUG_OFF
{ {
/* This is an assertion which sometimes fails, let's try to track it */ /* This is an assertion which sometimes fails, let's try to track it */
char llbuf1[22], llbuf2[22]; DBUG_PRINT("info", ("my_b_tell(cur_log)=%llu rli->event_relay_log_pos=%llu",
DBUG_PRINT("info", ("my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s", my_b_tell(cur_log), rli->event_relay_log_pos));
llstr(my_b_tell(cur_log),llbuf1),
llstr(rli->event_relay_log_pos,llbuf2)));
DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE); DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE);
DBUG_ASSERT(rli->mi->using_parallel() || DBUG_ASSERT(rli->mi->using_parallel() ||
my_b_tell(cur_log) == rli->event_relay_log_pos); my_b_tell(cur_log) == rli->event_relay_log_pos);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment