File: rpl_unknown_ignorable_event.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (76 lines) | stat: -rw-r--r-- 3,142 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# ==== 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

# this test requires the receiver thread to parse the event
# stream and extract a WRITE_ROWS log event. With compression
# on this is not happening, since the Transaction_payload
# event encapsulates the WRITE ROWS event.
--source include/not_binlog_transaction_compression_on.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