Skip to content

Commit e156a8d

Browse files
committed
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.
1 parent 762bf7a commit e156a8d

File tree

9 files changed

+16
-10
lines changed

9 files changed

+16
-10
lines changed

mysql-test/suite/binlog/include/binlog.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ SHOW SESSION VARIABLES LIKE "unique_checks";
391391
--echo # INSERT INTO t1 VALUES(2)
392392
--echo # foreign_key_checks=1 and unique_checks=1
393393
--echo # It should not change current session's variables, even error happens
394-
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");
394+
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");
395395
--error 1062
396396
BINLOG '
397397
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=

mysql-test/suite/binlog/r/binlog_base64_flag.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
call mtr.add_suppression("BINLOG_BASE64_EVENT: According to the master's version");
2+
call mtr.add_suppression("BINLOG_BASE64_EVENT: Column 1 of table 'test.char128_utf8' cannot be converted");
13
DROP TABLE IF EXISTS t1;
24
==== Test BUG#32407 ====
35
select * from t1;

mysql-test/suite/binlog/r/binlog_row_binlog.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ unique_checks OFF
10541054
# INSERT INTO t1 VALUES(2)
10551055
# foreign_key_checks=1 and unique_checks=1
10561056
# It should not change current session's variables, even error happens
1057-
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");
1057+
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");
10581058
BINLOG '
10591059
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
10601060
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==

mysql-test/suite/binlog/r/binlog_stm_binlog.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ unique_checks OFF
650650
# INSERT INTO t1 VALUES(2)
651651
# foreign_key_checks=1 and unique_checks=1
652652
# It should not change current session's variables, even error happens
653-
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");
653+
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");
654654
BINLOG '
655655
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
656656
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==

mysql-test/suite/binlog/t/binlog_base64_flag.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
# BINLOG statement does not work in embedded mode.
1010
source include/not_embedded.inc;
1111

12+
call mtr.add_suppression("BINLOG_BASE64_EVENT: According to the master's version");
13+
call mtr.add_suppression("BINLOG_BASE64_EVENT: Column 1 of table 'test.char128_utf8' cannot be converted");
14+
1215
disable_warnings;
1316
DROP TABLE IF EXISTS t1;
1417
enable_warnings;
15-
1618
# Test to show BUG#32407. This reads a binlog created with the
1719
# mysql-5.1-telco-6.1 tree, specifically at the tag
1820
# mysql-5.1.15-ndb-6.1.23, and applies it to the database. The test

sql/rpl_reporting.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "rpl_reporting.h"
2020
#include "log.h" // sql_print_error, sql_print_warning,
2121
// sql_print_information
22+
#include "sql_class.h"
2223

2324
Slave_reporting_capability::Slave_reporting_capability(char const *thread_name)
2425
: m_thread_name(thread_name)
@@ -70,7 +71,8 @@ Slave_reporting_capability::report(loglevel level, int err_code,
7071
va_end(args);
7172

7273
/* If the msg string ends with '.', do not add a ',' it would be ugly */
73-
report_function("Slave %s: %s%s %s%sInternal MariaDB error code: %d",
74+
report_function("%s %s: %s%s %s%sInternal MariaDB error code: %d",
75+
(current_thd && current_thd->rgi_fake) ? "" : "Slave",
7476
m_thread_name, pbuff,
7577
(pbuff[0] && *(strend(pbuff)-1) == '.') ? "" : ",",
7678
(extra_info ? extra_info : ""), (extra_info ? ", " : ""),

sql/rpl_rli.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ gtid_waiting rpl_global_gtid_waiting;
4646

4747
const char *const Relay_log_info::state_delaying_string = "Waiting until MASTER_DELAY seconds after master executed event";
4848

49-
Relay_log_info::Relay_log_info(bool is_slave_recovery)
50-
:Slave_reporting_capability("SQL"),
49+
Relay_log_info::Relay_log_info(bool is_slave_recovery, const char* thread_name)
50+
:Slave_reporting_capability(thread_name),
5151
replicate_same_server_id(::replicate_same_server_id),
5252
info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period),
5353
sync_counter(0), is_relay_log_recovery(is_slave_recovery),

sql/rpl_rli.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@ class Relay_log_info : public Slave_reporting_capability
387387
*/
388388
slave_connection_state restart_gtid_pos;
389389

390-
Relay_log_info(bool is_slave_recovery);
390+
Relay_log_info(bool is_slave_recovery, const char* thread_name= "SQL");
391391
~Relay_log_info();
392392

393393
/*
394-
Invalidate cached until_log_name and group_relay_log_name comparison
394+
Invalidate cached until_log_name and group_relay_log_name comparison
395395
result. Should be called after any update of group_realy_log_name if
396396
there chances that sql_thread is running.
397397
*/

sql/sql_binlog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void mysql_client_binlog_statement(THD* thd)
211211
size_t coded_len= 0, decoded_len= 0;
212212

213213
rli= thd->rli_fake;
214-
if (!rli && (rli= thd->rli_fake= new Relay_log_info(FALSE)))
214+
if (!rli && (rli= thd->rli_fake= new Relay_log_info(FALSE, "BINLOG_BASE64_EVENT")))
215215
rli->sql_driver_thd= thd;
216216
if (!(rgi= thd->rgi_fake))
217217
rgi= thd->rgi_fake= new rpl_group_info(rli);

0 commit comments

Comments
 (0)