summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/rpl/r/rpl_corruption.result8
-rw-r--r--mysql-test/suite/rpl/t/rpl_corruption.test9
-rw-r--r--sql/log_event.cc8
-rw-r--r--sql/sql_repl.cc11
4 files changed, 25 insertions, 11 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result
index 62f56e70993..84328170dd2 100644
--- a/mysql-test/suite/rpl/r/rpl_corruption.result
+++ b/mysql-test/suite/rpl/r/rpl_corruption.result
@@ -17,16 +17,16 @@ SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char";
# 3. Master read a corrupted event from binlog and send the error to slave
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236]
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
# 4. Master read a corrupted event from binlog and send it to slave
SET GLOBAL master_verify_checksum=0;
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1913]
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
SET GLOBAL debug_dbug= "";
SET GLOBAL master_verify_checksum=1;
# 5. Slave. Corruption in network
diff --git a/mysql-test/suite/rpl/t/rpl_corruption.test b/mysql-test/suite/rpl/t/rpl_corruption.test
index c5625b4d002..45ca3805286 100644
--- a/mysql-test/suite/rpl/t/rpl_corruption.test
+++ b/mysql-test/suite/rpl/t/rpl_corruption.test
@@ -100,19 +100,20 @@ let $wait_condition=
SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump';
--source include/wait_condition.inc
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
--connection slave
START SLAVE IO_THREAD;
let $slave_io_errno= 1236;
+--let $slave_timeout= 10
--source include/wait_for_slave_io_error.inc
--connection master
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
# Emulate corruption on master without crc checking on master
--echo # 4. Master read a corrupted event from binlog and send it to slave
--connection master
SET GLOBAL master_verify_checksum=0;
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
--connection slave
START SLAVE IO_THREAD;
# When the checksum error is detected, the slave sets error code 1913
@@ -122,7 +123,7 @@ START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1913;
--source include/wait_for_slave_io_error.inc
--connection master
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2";
+SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
SET GLOBAL debug_dbug= "";
SET GLOBAL master_verify_checksum=1;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index b083a6eb2a4..04d1118b835 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -6126,6 +6126,7 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
seq_no(seq_no_arg), domain_id(domain_id_arg),
flags2(standalone ? FL_STANDALONE : 0)
{
+ cache_type= Log_event::EVENT_NO_CACHE;
}
@@ -6354,6 +6355,7 @@ Gtid_list_log_event::Gtid_list_log_event(const char *buf, uint event_len,
Gtid_list_log_event::Gtid_list_log_event(rpl_binlog_state *gtid_set)
: count(gtid_set->count()), list(0)
{
+ cache_type= EVENT_NO_CACHE;
/* Failure to allocate memory will be caught by is_valid() returning false. */
if (count < (1<<28) &&
(list = (rpl_gtid *)my_malloc(count * sizeof(*list) + (count == 0),
@@ -6419,16 +6421,16 @@ Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
uint32 i;
print_header(&cache, print_event_info, FALSE);
+ my_b_printf(&cache, "\tGtid list [");
for (i= 0; i < count; ++i)
{
longlong10_to_str(list[i].seq_no, buf, 10);
my_b_printf(&cache, "%u-%u-%s", list[i].domain_id,
list[i].server_id, buf);
if (i < count-1)
- my_b_printf(&cache, "\n# ");
- else
- my_b_printf(&cache, "\n");
+ my_b_printf(&cache, ",\n# ");
}
+ my_b_printf(&cache, "]\n");
}
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 5b52163eb0e..bf758c4bdb0 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1420,6 +1420,17 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
connect_gtid_state.length(0);
using_gtid_state= get_slave_connect_state(thd, &connect_gtid_state);
DBUG_EXECUTE_IF("simulate_non_gtid_aware_master", using_gtid_state= false;);
+ /*
+ We want to corrupt the first event, in Log_event::read_log_event().
+ But we do not want the corruption to happen early, eg. when client does
+ BINLOG_GTID_POS(). So test case sets a DBUG trigger which causes us to
+ set the real DBUG injection here.
+ */
+ DBUG_EXECUTE_IF("corrupt_read_log_event2_set",
+ {
+ DBUG_SET("-d,corrupt_read_log_event2_set");
+ DBUG_SET("+d,corrupt_read_log_event2");
+ });
if (global_system_variables.log_warnings > 1)
sql_print_information("Start binlog_dump to slave_server(%d), pos(%s, %lu)",