File: rpl_cross_version_default_utf8mb4_collation.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 (99 lines) | stat: -rw-r--r-- 3,415 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# ==== Purpose ====
#
# The default collation for utf8mb4 changed between 5.7 and 8.0. This test
# checks that replication does not break when an 8.0 slave replicates
# transactions with different default collation from an 5.7 master. It also
# checks that events replicated from the 8.0 slave to a second 8.0 slave are
# correctly applied.
#
# ==== Implementation ====
#
# Simulate the topology 5.7 master -> 8.0 slave_1 -> 8.0 slave_2 by making
# slave_1 replicate a potencially problematic binary log generated by a 5.7
# server.
# Check that that binary log is replicated successfully in slave_1. Finally,
# replicate it to slave_2.
#
# ==== References ====
#
# BUG#27081073 RENAMING A COLUMN BREAKS REPLICATION FROM 5.7 TO 8.0 BECAUSE OF
#              IMPL. COLLATION

--source include/have_binlog_format_statement.inc

# simulate the following replication chain:
# 5.7 master -> 8.0 slave -> 8.0 slave
--let $rpl_topology=1->2, 2->3
--let $rpl_skip_start_slave= 1
--source include/rpl_init.inc

--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $MYSQLD_SLAVE_DATADIR= `select @@datadir`

# clear slave datadir
RESET SLAVE;
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index

# copy the binlog with the following statements:
#
#--source include/have_binlog_format_statement.inc
#
# CREATE TABLE `foobar` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
#                        `foo` varchar(100) CHARACTER SET utf8mb4 NOT NULL,
#                        PRIMARY KEY (`id`), UNIQUE KEY `id_foo` (`foo`)
#                       ) ENGINE=InnoDB AUTO_INCREMENT=12345
#                       DEFAULT CHARSET=latin1;
#
# INSERT INTO foobar (foo) VALUES (0x666F6F626172406578616D706C652E636F6D);
# INSERT INTO foobar (foo) VALUES (0x666F6F626172406578616D706C652E636F6DD98B);
#
# ALTER TABLE `foobar` CHANGE `foo` `old_foo` varchar(100) CHARACTER SET
# utf8mb4 NOT NULL;
# DROP TABLE `foobar`;
#

# on Win* platforms path separator is backslash
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
{
      --copy_file std_data/slave-relay-bin_win.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
}
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
{
      --copy_file std_data/slave-relay-bin_linux.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
}

--copy_file std_data/rpl_cross_version_default_utf8mb4_collation.000001 $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001

--source include/start_slave.inc

# wait until slave reads and applies all events from 5.7 relay log without
# errors
--let $slave_param= Slave_SQL_Running_State
--let $slave_param_value= Replica has read all relay log; waiting for more updates
--source include/wait_for_slave_param.inc


# check that the second 8.0 slave replicates without errors
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc

RESET SLAVE;

--source include/start_slave.inc

--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $sync_slave_connection= server_3
--source include/sync_slave_sql_with_master.inc

# clean up
--source include/stop_slave.inc
RESET SLAVE;
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--source include/stop_slave.inc
RESET SLAVE;
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc