diff options
author | unknown <mats@kindahl-laptop.dnsalias.net> | 2007-06-11 22:18:10 +0200 |
---|---|---|
committer | unknown <mats@kindahl-laptop.dnsalias.net> | 2007-06-11 22:18:10 +0200 |
commit | 24eb04abea7e656091afba9eda0aa13c3ea7ea8c (patch) | |
tree | 648b2b5f243c10d9392b6763baf941c5b42ccaa7 /sql/rpl_reporting.cc | |
parent | 1f89a70d0a3245c93b323913a9728c602666be49 (diff) | |
parent | abbf5941d950e3a857987785991b72f1040d0721 (diff) | |
download | mariadb-git-24eb04abea7e656091afba9eda0aa13c3ea7ea8c.tar.gz |
Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-rpl
into kindahl-laptop.dnsalias.net:/home/bk/b24954-mysql-5.1-new-rpl
mysql-test/r/rpl_rotate_logs.result:
Auto merged
mysql-test/t/rpl_rotate_logs.test:
Auto merged
sql/Makefile.am:
Auto merged
sql/log_event.cc:
Auto merged
sql/sql_repl.cc:
Auto merged
Diffstat (limited to 'sql/rpl_reporting.cc')
-rw-r--r-- | sql/rpl_reporting.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sql/rpl_reporting.cc b/sql/rpl_reporting.cc new file mode 100644 index 00000000000..28f257790c7 --- /dev/null +++ b/sql/rpl_reporting.cc @@ -0,0 +1,48 @@ + +#include "mysql_priv.h" +#include "rpl_reporting.h" + +void +Slave_reporting_capability::report(loglevel level, int err_code, + const char *msg, ...) const +{ + void (*report_function)(const char *, ...); + char buff[MAX_SLAVE_ERRMSG]; + char *pbuff= buff; + uint pbuffsize= sizeof(buff); + va_list args; + va_start(args, msg); + + switch (level) + { + case ERROR_LEVEL: + /* + It's an error, it must be reported in Last_error and Last_errno in SHOW + SLAVE STATUS. + */ + pbuff= m_last_error.message; + pbuffsize= sizeof(m_last_error.message); + m_last_error.number = err_code; + report_function= sql_print_error; + break; + case WARNING_LEVEL: + report_function= sql_print_warning; + break; + case INFORMATION_LEVEL: + report_function= sql_print_information; + break; + default: + DBUG_ASSERT(0); // should not come here + return; // don't crash production builds, just do nothing + } + + my_vsnprintf(pbuff, pbuffsize, msg, args); + + va_end(args); + + /* If the msg string ends with '.', do not add a ',' it would be ugly */ + report_function("Slave %s: %s%s Error_code: %d", + m_thread_name, pbuff, + (pbuff[0] && *(strend(pbuff)-1) == '.') ? "" : ",", + err_code); +} |