Debian Codegraph @

mysql-test/suite/rpl/t/rpl_from_mysql80.test

raw
1 --source include/have_innodb.inc
2 --source include/have_binlog_format_row.inc
3 --source include/master-slave.inc
4
5 # Test some replication events from MySQL 8.0 to MariaDB.
6 # Works by copying in a binlog generated by MySQL 8.0.
7 # The binlog was generated by the following test case. Note that after
8 # re-generating this, values for Master_log_pos below may need updating, check
9 # mysqlbinlog for the correct new values.
10 #
11 # The latin1 character set is needed since MariaDB currently does not support
12 # the default MySQL character set. The binlog_format=statement is needed due to
13 # missing support for the JSON type in row events. These can be removed once
14 # support is added in MariaDB.
15 #
16 # --source include/not_group_replication_plugin.inc
17 # --source include/have_binlog_format_row.inc
18 # --source include/master-slave.inc
19 #
20 # --connection master
21 # SET NAMES 'latin1';
22 # SET SESSION collation_server= 'latin1_swedish_ci';
23 # CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c VARCHAR(1024)) ENGINE=InnoDB CHARACTER SET latin1;
24 # INSERT INTO t1 VALUES (1, 0, '');
25 # BEGIN;
26 # INSERT INTO t1 VALUES (2, 0, 'hulu');
27 # INSERT INTO t1 VALUES (3, 0, 'bulu');
28 # COMMIT;
29 # INSERT INTO t1 VALUES (4, 0, 'skip');
30 #
31 # SET SESSION binlog_transaction_compression= 1;
32 # BEGIN;
33 # --disable_query_log
34 # --let $i= 0
35 # while ($i < 100) {
36 # eval INSERT INTO t1 VALUES ($i+1000, $i, CONCAT("--", $i, "--", REPEAT("\\/", 100), "--"));
37 # inc $i;
38 # }
39 # --enable_query_log
40 # COMMIT;
41 # SET SESSION binlog_transaction_compression= default;
42 #
43 # INSERT INTO t1 VALUES (5, 0, 'after compressed');
44 # SET SESSION binlog_row_value_options= PARTIAL_JSON;
45 # CREATE TABLE t2 (a INT PRIMARY KEY, b JSON) ENGINE=InnoDB;
46 # SET SESSION binlog_format=statement;
47 # INSERT INTO t2 VALUES (1, CONCAT('{"a": "hulu", "b": "', REPEAT("[zyzzy]", 100), '", "c": "bulu"}'));
48 # SET SESSION binlog_format=row;
49 # UPDATE t2 SET b=JSON_REPLACE(b, '$.b', REPEAT("oOo", 50));
50 # SET SESSION binlog_row_value_options= DEFAULT;
51 # --sync_slave_with_master
52 #
53 # --connection master
54 # SET sql_log_bin= 0;
55 # FLUSH BINARY LOGS;
56 # SET sql_log_bin= 1;
57 # DROP TABLE t1, t2;
58 # --source include/rpl_end.inc
59
60
61 --connection slave
62 --source include/stop_slave.inc
63
64 --connection master
65 --let $datadir= `SELECT @@datadir`
66 --let $rpl_server_number= 1
67 --source include/rpl_stop_server.inc
68
69 # Copy in the MySQL 8.0 generated binlog.
70 --remove_file $datadir/master-bin.000001
71 --copy_file $MYSQL_TEST_DIR/std_data/mdev35643_mysql_80_binlog.000001 $datadir/master-bin.000001
72
73 --source include/rpl_start_server.inc
74
75 --save_master_pos
76
77 --connection slave
78 CHANGE MASTER TO Master_log_file='master-bin.000001', Master_log_pos=4, Master_use_gtid=No;
79 START SLAVE IO_THREAD;
80 --source include/wait_for_slave_io_to_start.inc
81 # The position 1178 is the start of: INSERT INTO t1 VALUES (4, 0, 'skip');
82 # After that comes unknown MySQL 8.0 events, which we test error for below.
83 START SLAVE UNTIL Master_log_file='master-bin.000001', Master_log_pos= 1178;
84 --disable_result_log
85 SELECT MASTER_POS_WAIT('master-bin.000001', 1178, 60);
86 --enable_result_log
87 SELECT * FROM t1 ORDER BY a;
88
89 --source include/wait_for_slave_sql_to_stop.inc
90
91 START SLAVE;
92 --let $slave_sql_errno= 1594
93 --source include/wait_for_slave_sql_error.inc
94
95 STOP SLAVE IO_THREAD;
96 --source include/wait_for_slave_io_to_stop.inc
97 # The position 2298 is the start of: INSERT INTO t1 VALUES (5, 0, 'after compressed');
98 CHANGE MASTER TO Master_log_file='master-bin.000001', Master_log_pos=2297;
99 START SLAVE IO_THREAD;
100 START SLAVE SQL_THREAD;
101 --source include/wait_for_slave_io_to_start.inc
102 --let $slave_sql_errno= 1594
103 --source include/wait_for_slave_sql_error.inc
104
105 SELECT * FROM t1 ORDER BY a;
106 SELECT * FROM t2 ORDER BY a;
107
108 STOP SLAVE IO_THREAD;
109 --source include/wait_for_slave_io_to_stop.inc
110 # Restart replication after the MySQL 8.0 file.
111 CHANGE MASTER TO Master_log_file='master-bin.000002', Master_log_pos=4;
112 START SLAVE IO_THREAD;
113 START SLAVE SQL_THREAD;
114 --source include/wait_for_slave_io_to_start.inc
115 --source include/wait_for_slave_sql_to_start.inc
116 --sync_with_master
117
118 DROP TABLE t1, t2;
119 CALL mtr.add_suppression('TRANSACTION_PAYLOAD_EVENT event. You can avoid this event by specifying');
120 CALL mtr.add_suppression('PARTIAL_UPDATE_ROWS_EVENT event. You can avoid this event by specifying');
121
122 --connection master
123 --source include/rpl_end.inc