| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Bug#19949915 IGNORABLE EVENTS DO NOT WORK AND ARE NOT TESTED |
| 4 |
# |
| 5 |
# Problem: |
| 6 |
# In 5.6, Ignorable log events were introduced. These events have |
| 7 |
# the flag LOG_EVENT_IGNORABLE_F flag (0x80) set in the flags field. |
| 8 |
# When the server (specifically, the replication receiver and applier |
| 9 |
# threads) sees an event with a type code it does not recognize, the |
| 10 |
# server is supposed to check if this flag is set. If the flag is not |
| 11 |
# set, the server generates an error and stops; if the flag is set, |
| 12 |
# the server ignores the event. The purpose is to allow future server |
| 13 |
# versions to introduce new event types that the slave can ignore |
| 14 |
# (such as informational event types). However, this does not work, |
| 15 |
# since the slave applier thread explicitly checks if the type code |
| 16 |
# is in the range of known event types, and reports an error, before |
| 17 |
# it goes further and checks if the event is ignorable. |
| 18 |
# Fix: |
| 19 |
# The slave applier thread does not check if this is a known event |
| 20 |
# type any more. |
| 21 |
# |
| 22 |
# Steps to reproduce: |
| 23 |
# 1) Set a debug point on slave to simulate unknown ignorable log events. |
| 24 |
# 2) Write a write_rows log event and a previous gtids log event |
| 25 |
# if gtid mode is on to binlog on master. |
| 26 |
# 3) The slave receiver thread simulates an unknown ignorable |
| 27 |
# log event by rewriting the write rows log event and |
| 28 |
# previous gtids log event if gtid mode is on before |
| 29 |
# writing it(them) in relay log. |
| 30 |
# 4) Verify that the slave applier thread skips the unknown ignorable |
| 31 |
# log event. |
| 32 |
# |
| 33 |
|
| 34 |
--source include/not_group_replication_plugin.inc |
| 35 |
--source include/have_binlog_format_row.inc |
| 36 |
--source include/have_debug.inc |
| 37 |
--source include/have_debug_sync.inc |
| 38 |
--source include/master-slave.inc |
| 39 |
|
| 40 |
# this test requires the receiver thread to parse the event |
| 41 |
# stream and extract a WRITE_ROWS log event. With compression |
| 42 |
# on this is not happening, since the Transaction_payload |
| 43 |
# event encapsulates the WRITE ROWS event. |
| 44 |
--source include/not_binlog_transaction_compression_on.inc |
| 45 |
|
| 46 |
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; |
| 47 |
--source include/sync_slave_sql_with_master.inc |
| 48 |
--echo # Set a debug point on slave to simulate unknown ignorable log events. |
| 49 |
SET @save_debug=@@global.debug; |
| 50 |
SET GLOBAL DEBUG='+d,simulate_unknown_ignorable_log_event'; |
| 51 |
|
| 52 |
--source include/rpl_connection_master.inc |
| 53 |
|
| 54 |
--echo # Write a previous_gtids log event to binlog |
| 55 |
--echo # on master if gtid mode is on. |
| 56 |
FLUSH LOGS; |
| 57 |
--echo # Write a write_rows log event to binlog on master. |
| 58 |
INSERT INTO t1 VALUES (1); |
| 59 |
|
| 60 |
--echo # The slave receiver thread simulates an unknown ignorable |
| 61 |
--echo # log event by rewriting the write_rows log event and |
| 62 |
--echo # previous_gtids log event if gtid mode is on before |
| 63 |
--echo # writing it(them) in relay log. |
| 64 |
--source include/sync_slave_sql_with_master.inc |
| 65 |
|
| 66 |
--echo # Verify that the slave applier thread skips these unknown ignorable |
| 67 |
--echo # log event. |
| 68 |
--let $assert_text= Table t1 must not contain 1 |
| 69 |
--let $assert_cond= [SELECT count(*) FROM t1 WHERE c1=1] = 0 |
| 70 |
--source include/assert.inc |
| 71 |
SET GLOBAL DEBUG= @save_debug; |
| 72 |
|
| 73 |
# Cleanup |
| 74 |
--source include/rpl_connection_master.inc |
| 75 |
DROP TABLE t1; |
| 76 |
--source include/rpl_end.inc |