17 #include "rpl_reporting.h"
23 : m_thread_name(thread_name)
29 #if !defined(EMBEDDED_LIBRARY)
46 uint error_arg,
bool* silent)
const
49 DBUG_ENTER(
"has_temporary_error");
51 DBUG_EXECUTE_IF(
"all_errors_are_temporary_errors",
52 if (thd->get_stmt_da()->is_error())
55 my_error(ER_LOCK_DEADLOCK, MYF(0));
65 if (thd->is_fatal_error || !thd->is_error())
68 error= (error_arg == 0)? thd->get_stmt_da()->sql_errno() : error_arg;
76 if (slave_trans_retries &&
77 (error == ER_LOCK_DEADLOCK || error == ER_LOCK_WAIT_TIMEOUT))
84 thd->get_stmt_da()->sql_conditions();
88 DBUG_PRINT(
"info", (
"has condition %d %s", err->
get_sql_errno(),
92 case ER_GET_TEMPORARY_ERRMSG:
94 case ER_SLAVE_SILENT_RETRY_TRANSACTION:
106 #endif // EMBEDDED_LIBRARY
111 const char *
msg, ...)
const
115 do_report(level, err_code, msg, args);
120 Slave_reporting_capability::va_report(loglevel
level,
int err_code,
121 const char *prefix_msg,
122 const char *
msg, va_list args)
const
124 #if !defined(EMBEDDED_LIBRARY)
125 THD *thd= current_thd;
126 void (*report_function)(
const char *, ...);
127 char buff[MAX_SLAVE_ERRMSG];
130 uint pbuffsize=
sizeof(buff);
133 !thd->transaction.all.cannot_safely_rollback())
134 level= WARNING_LEVEL;
145 pbuffsize=
sizeof(m_last_error.
message);
146 m_last_error.
number = err_code;
147 m_last_error.update_timestamp();
148 report_function= sql_print_error;
151 report_function= log_warnings?
152 sql_print_warning : NULL;
154 case INFORMATION_LEVEL:
155 report_function= log_warnings?
156 sql_print_information : NULL;
164 curr_buff += sprintf(curr_buff,
"%s; ", prefix_msg);
165 my_vsnprintf(curr_buff, pbuffsize, msg, args);
171 report_function(
"Slave %s: %s%s Error_code: %d",
172 m_thread_name, pbuff,
173 (curr_buff[0] && *(strend(curr_buff)-1) ==
'.') ?
"" :
",",
178 Slave_reporting_capability::~Slave_reporting_capability()