Commit 7032533d authored by unknown's avatar unknown

Added ER_SAFE() for cases when the error message could be out of bands


sql/slave.cc:
  Cleanup up indentation.
  Change to use ER_SAFE() instead of ER().
sql/unireg.h:
  Added ER_SAFE()
parent 24d065d9
......@@ -909,7 +909,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
// sanity check to make sure the master did not get a really bad
// error on the query
if(!check_expected_error(thd, (expected_error = qev->error_code)))
if (!check_expected_error(thd, (expected_error = qev->error_code)))
{
mysql_parse(thd, thd->query, q_len);
if (expected_error !=
......@@ -917,10 +917,10 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
const char* errmsg = "Slave: did not get the expected error\
running query from master - expected: '%s'(%d), got '%s'(%d)";
sql_print_error(errmsg, ER(expected_error), expected_error,
sql_print_error(errmsg, ER_SAFE(expected_error),
expected_error,
actual_error ? thd->net.last_error:"no error",
actual_error
);
actual_error);
thd->query_error = 1;
}
else if (expected_error == actual_error)
......@@ -930,9 +930,9 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
last_slave_errno = 0;
}
}
else // master could be inconsistent, abort and tell DBA to
// check/fix it
else
{
// master could be inconsistent, abort and tell DBA to check/fix it
thd->db = thd->query = 0;
thd->convert_set = 0;
close_thread_tables(thd);
......
......@@ -37,8 +37,9 @@
#define SHAREDIR "share/"
#endif
#define ER(X) ((X) >= 1000 && (X) < ER_ERROR_MESSAGES + 1000) ? \
errmesg[(X)-1000] : "Invalid error code"
#define ER(X) errmesg[(X)-1000]
#define ER_SAFE(X) (((X) >= 1000 && (X) < ER_ERROR_MESSAGES + 1000) ? ER(X) : "Invalid error code")
#define ERRMAPP 1 /* Errormap f|r my_error */
#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */
......
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