polardbxengine/mysql-test/suite/rpl/t/rpl_unknown_ignorable_event...

71 lines
2.8 KiB
Plaintext

# ==== Purpose ====
#
# Bug#19949915 IGNORABLE EVENTS DO NOT WORK AND ARE NOT TESTED
#
# Problem:
# In 5.6, Ignorable log events were introduced. These events have
# the flag LOG_EVENT_IGNORABLE_F flag (0x80) set in the flags field.
# When the server (specifically, the replication receiver and applier
# threads) sees an event with a type code it does not recognize, the
# server is supposed to check if this flag is set. If the flag is not
# set, the server generates an error and stops; if the flag is set,
# the server ignores the event. The purpose is to allow future server
# versions to introduce new event types that the slave can ignore
# (such as informational event types). However, this does not work,
# since the slave applier thread explicitly checks if the type code
# is in the range of known event types, and reports an error, before
# it goes further and checks if the event is ignorable.
# Fix:
# The slave applier thread does not check if this is a known event
# type any more.
#
# Steps to reproduce:
# 1) Set a debug point on slave to simulate unknown ignorable log events.
# 2) Write a write_rows log event and a previous gtids log event
# if gtid mode is on to binlog on master.
# 3) The slave receiver thread simulates an unknown ignorable
# log event by rewriting the write rows log event and
# previous gtids log event if gtid mode is on before
# writing it(them) in relay log.
# 4) Verify that the slave applier thread skips the unknown ignorable
# log event.
#
--source include/not_group_replication_plugin.inc
--source include/have_binlog_format_row.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
--source include/sync_slave_sql_with_master.inc
--echo # Set a debug point on slave to simulate unknown ignorable log events.
SET @save_debug=@@global.debug;
SET GLOBAL DEBUG='d,simulate_unknown_ignorable_log_event';
--source include/rpl_connection_master.inc
--echo # Write a previous_gtids log event to binlog
--echo # on master if gtid mode is on.
FLUSH LOGS;
--echo # Write a write_rows log event to binlog on master.
INSERT INTO t1 VALUES (1);
--echo # The slave receiver thread simulates an unknown ignorable
--echo # log event by rewriting the write_rows log event and
--echo # previous_gtids log event if gtid mode is on before
--echo # writing it(them) in relay log.
--source include/sync_slave_sql_with_master.inc
--echo # Verify that the slave applier thread skips these unknown ignorable
--echo # log event.
--let $assert_text= Table t1 must not contain 1
--let $assert_cond= [SELECT count(*) FROM t1 WHERE c1=1] = 0
--source include/assert.inc
SET GLOBAL DEBUG= @save_debug;
# Cleanup
--source include/rpl_connection_master.inc
DROP TABLE t1;
--source include/rpl_end.inc