Commit e156a8da authored by Andrei Elkin's avatar Andrei Elkin

MDEV-21851: Error in BINLOG_BASE64_EVENT i s always error-logged as if it is done by Slave

The prefix of error log message out of a failed BINLOG applying
is corrected to be the sql command name.
parent 762bf7a0
...@@ -391,7 +391,7 @@ SHOW SESSION VARIABLES LIKE "unique_checks"; ...@@ -391,7 +391,7 @@ SHOW SESSION VARIABLES LIKE "unique_checks";
--echo # INSERT INTO t1 VALUES(2) --echo # INSERT INTO t1 VALUES(2)
--echo # foreign_key_checks=1 and unique_checks=1 --echo # foreign_key_checks=1 and unique_checks=1
--echo # It should not change current session's variables, even error happens --echo # It should not change current session's variables, even error happens
call mtr.add_suppression("Slave SQL.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062"); call mtr.add_suppression("BINLOG_BASE64_EVENT.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
--error 1062 --error 1062
BINLOG ' BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
......
call mtr.add_suppression("BINLOG_BASE64_EVENT: According to the master's version");
call mtr.add_suppression("BINLOG_BASE64_EVENT: Column 1 of table 'test.char128_utf8' cannot be converted");
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
==== Test BUG#32407 ==== ==== Test BUG#32407 ====
select * from t1; select * from t1;
......
...@@ -1054,7 +1054,7 @@ unique_checks OFF ...@@ -1054,7 +1054,7 @@ unique_checks OFF
# INSERT INTO t1 VALUES(2) # INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1 # foreign_key_checks=1 and unique_checks=1
# It should not change current session's variables, even error happens # It should not change current session's variables, even error happens
call mtr.add_suppression("Slave SQL.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062"); call mtr.add_suppression("BINLOG_BASE64_EVENT.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
BINLOG ' BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
......
...@@ -650,7 +650,7 @@ unique_checks OFF ...@@ -650,7 +650,7 @@ unique_checks OFF
# INSERT INTO t1 VALUES(2) # INSERT INTO t1 VALUES(2)
# foreign_key_checks=1 and unique_checks=1 # foreign_key_checks=1 and unique_checks=1
# It should not change current session's variables, even error happens # It should not change current session's variables, even error happens
call mtr.add_suppression("Slave SQL.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062"); call mtr.add_suppression("BINLOG_BASE64_EVENT.*Could not execute Write_rows_v1 event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
BINLOG ' BINLOG '
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
......
...@@ -9,10 +9,12 @@ ...@@ -9,10 +9,12 @@
# BINLOG statement does not work in embedded mode. # BINLOG statement does not work in embedded mode.
source include/not_embedded.inc; source include/not_embedded.inc;
call mtr.add_suppression("BINLOG_BASE64_EVENT: According to the master's version");
call mtr.add_suppression("BINLOG_BASE64_EVENT: Column 1 of table 'test.char128_utf8' cannot be converted");
disable_warnings; disable_warnings;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
enable_warnings; enable_warnings;
# Test to show BUG#32407. This reads a binlog created with the # Test to show BUG#32407. This reads a binlog created with the
# mysql-5.1-telco-6.1 tree, specifically at the tag # mysql-5.1-telco-6.1 tree, specifically at the tag
# mysql-5.1.15-ndb-6.1.23, and applies it to the database. The test # mysql-5.1.15-ndb-6.1.23, and applies it to the database. The test
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "rpl_reporting.h" #include "rpl_reporting.h"
#include "log.h" // sql_print_error, sql_print_warning, #include "log.h" // sql_print_error, sql_print_warning,
// sql_print_information // sql_print_information
#include "sql_class.h"
Slave_reporting_capability::Slave_reporting_capability(char const *thread_name) Slave_reporting_capability::Slave_reporting_capability(char const *thread_name)
: m_thread_name(thread_name) : m_thread_name(thread_name)
...@@ -70,7 +71,8 @@ Slave_reporting_capability::report(loglevel level, int err_code, ...@@ -70,7 +71,8 @@ Slave_reporting_capability::report(loglevel level, int err_code,
va_end(args); va_end(args);
/* If the msg string ends with '.', do not add a ',' it would be ugly */ /* If the msg string ends with '.', do not add a ',' it would be ugly */
report_function("Slave %s: %s%s %s%sInternal MariaDB error code: %d", report_function("%s %s: %s%s %s%sInternal MariaDB error code: %d",
(current_thd && current_thd->rgi_fake) ? "" : "Slave",
m_thread_name, pbuff, m_thread_name, pbuff,
(pbuff[0] && *(strend(pbuff)-1) == '.') ? "" : ",", (pbuff[0] && *(strend(pbuff)-1) == '.') ? "" : ",",
(extra_info ? extra_info : ""), (extra_info ? ", " : ""), (extra_info ? extra_info : ""), (extra_info ? ", " : ""),
......
...@@ -46,8 +46,8 @@ gtid_waiting rpl_global_gtid_waiting; ...@@ -46,8 +46,8 @@ gtid_waiting rpl_global_gtid_waiting;
const char *const Relay_log_info::state_delaying_string = "Waiting until MASTER_DELAY seconds after master executed event"; const char *const Relay_log_info::state_delaying_string = "Waiting until MASTER_DELAY seconds after master executed event";
Relay_log_info::Relay_log_info(bool is_slave_recovery) Relay_log_info::Relay_log_info(bool is_slave_recovery, const char* thread_name)
:Slave_reporting_capability("SQL"), :Slave_reporting_capability(thread_name),
replicate_same_server_id(::replicate_same_server_id), replicate_same_server_id(::replicate_same_server_id),
info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period), info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period),
sync_counter(0), is_relay_log_recovery(is_slave_recovery), sync_counter(0), is_relay_log_recovery(is_slave_recovery),
......
...@@ -387,7 +387,7 @@ class Relay_log_info : public Slave_reporting_capability ...@@ -387,7 +387,7 @@ class Relay_log_info : public Slave_reporting_capability
*/ */
slave_connection_state restart_gtid_pos; slave_connection_state restart_gtid_pos;
Relay_log_info(bool is_slave_recovery); Relay_log_info(bool is_slave_recovery, const char* thread_name= "SQL");
~Relay_log_info(); ~Relay_log_info();
/* /*
......
...@@ -211,7 +211,7 @@ void mysql_client_binlog_statement(THD* thd) ...@@ -211,7 +211,7 @@ void mysql_client_binlog_statement(THD* thd)
size_t coded_len= 0, decoded_len= 0; size_t coded_len= 0, decoded_len= 0;
rli= thd->rli_fake; rli= thd->rli_fake;
if (!rli && (rli= thd->rli_fake= new Relay_log_info(FALSE))) if (!rli && (rli= thd->rli_fake= new Relay_log_info(FALSE, "BINLOG_BASE64_EVENT")))
rli->sql_driver_thd= thd; rli->sql_driver_thd= thd;
if (!(rgi= thd->rgi_fake)) if (!(rgi= thd->rgi_fake))
rgi= thd->rgi_fake= new rpl_group_info(rli); rgi= thd->rgi_fake= new rpl_group_info(rli);
......
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