Debian Codegraph @

mysql-test/suite/rpl_nogtid/t/rpl_functional_index_cross_version_replication.test

raw
1 # ==== Purpose ====
2 #
3 # Tests the row-based replication of tables with functional indexes and with
4 # extra columns or columns added with `ALTER TABLE` in a cross-version scenario
5 # by replacing the slave's relay-log for a relay-log produced with a version
6 # prior to the code changes being tested.
7 #
8 # ==== Requirements ====
9 #
10 # R1. It should be possible to replicate from an 8.0.17 master where a
11 # replicated column was added after a hidden generated column.
12 #
13 # ==== Implementation ====
14 #
15 # TC1. Apply OLD-generated relay log on NEW server
16 # ------------------------------------------------------------------------
17 # 1) Stop the slave.
18 # 2) Setup the previous saved log - from a 8.0.17 server - as the slave relay
19 # log which contains:
20 #
21 # CREATE TABLE t (a INT, INDEX i((a+1)));
22 # ALTER TABLE t ADD COLUMN b TEXT;
23 # INSERT INTO t(a, b) VALUES (1, '1');
24 #
25 # 3) Start the slave.
26 # 4) Check table included in the relay log exists.
27 #
28 # ==== References ====
29 #
30 # BUG#29390506 HIDDEN GENERATED COLUMNS PREVENT SLAVE FROM HAVING EXTRA COLUMNS IN TABLES
31 #
32
33 --let $rpl_skip_start_slave = 1
34 --source include/not_have_privilege_checks_user.inc
35 --source include/master-slave.inc
36 --source include/have_binlog_format_row.inc
37
38 --echo #
39 --echo # TC1. Apply OLD-generated relay log on NEW server
40 --echo #
41
42 #
43 # 1) Stop the slave.
44 #
45 --source include/rpl_connection_slave.inc
46 call mtr.add_suppression("Replica SQL.*Error executing row event: .Table .test.t. doesn.t exist., Error_code: MY-001146");
47
48 #
49 # 2) Setup the previous saved log as the slave relay log which contains:
50 #
51 # CREATE TABLE t (a INT, INDEX i((a+1)));
52 # ALTER TABLE t ADD COLUMN b TEXT;
53 # INSERT INTO t(a, b) VALUES (1, '1');
54 #
55 --let $fake_relay_log = $MYSQL_TEST_DIR/std_data/rpl_unfiltered_hidden_gcol.000001
56 --source include/setup_fake_relay_log.inc
57
58 #
59 # 3) Start the slave.
60 #
61 START SLAVE SQL_THREAD;
62
63 #
64 # 4) Check table included in the relay log exists.
65 #
66 # Test if the slave arrived at a sane state and finished processing all
67 # relay-logs.
68 #
69 --let $slave_param = Slave_SQL_Running_State
70 --let $slave_param_value= Replica has read all relay log; waiting for more updates
71 --let $slave_io_running_check_disable = 1
72 --source include/wait_for_slave_param.inc
73
74 # Even with the above validation, we should protect against future changes that
75 # bipass _OLD_ relay-logs. Therefore, making the test fail if the table doesn't
76 # exist.
77 #
78
79 --let $wait_timeout= 60
80 --let $wait_condition= SELECT count(*) = 1 FROM t
81 --source include/wait_condition_or_abort.inc
82
83 --let $table_t = `SHOW TABLES LIKE "t"`
84 --let $assert_text = Slave was able to apply the provided relay log.
85 --let $assert_cond = "$table_t" = "t"
86 --source include/assert.inc
87
88 # Clean up
89 DROP TABLE t;
90
91 STOP SLAVE SQL_THREAD;
92 --source include/cleanup_fake_relay_log.inc
93 --source include/start_slave.inc
94
95 --source include/rpl_end.inc