| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# The default collation for utf8mb4 changed between 5.7 and 8.0. This test |
| 4 |
# checks that replication does not break when an 8.0 slave replicates |
| 5 |
# transactions with different default collation from an 5.7 master. It also |
| 6 |
# checks that events replicated from the 8.0 slave to a second 8.0 slave are |
| 7 |
# correctly applied. |
| 8 |
# |
| 9 |
# ==== Implementation ==== |
| 10 |
# |
| 11 |
# Simulate the topology 5.7 master -> 8.0 slave_1 -> 8.0 slave_2 by making |
| 12 |
# slave_1 replicate a potencially problematic binary log generated by a 5.7 |
| 13 |
# server. |
| 14 |
# Check that that binary log is replicated successfully in slave_1. Finally, |
| 15 |
# replicate it to slave_2. |
| 16 |
# |
| 17 |
# ==== References ==== |
| 18 |
# |
| 19 |
# BUG#27081073 RENAMING A COLUMN BREAKS REPLICATION FROM 5.7 TO 8.0 BECAUSE OF |
| 20 |
# IMPL. COLLATION |
| 21 |
|
| 22 |
--source include/have_binlog_format_statement.inc |
| 23 |
|
| 24 |
# simulate the following replication chain: |
| 25 |
# 5.7 master -> 8.0 slave -> 8.0 slave |
| 26 |
--let $rpl_topology=1->2, 2->3 |
| 27 |
--let $rpl_skip_start_slave= 1 |
| 28 |
--source include/rpl_init.inc |
| 29 |
|
| 30 |
--let $rpl_connection_name= server_2 |
| 31 |
--source include/rpl_connection.inc |
| 32 |
--let $MYSQLD_SLAVE_DATADIR= `select @@datadir` |
| 33 |
|
| 34 |
# clear slave datadir |
| 35 |
RESET SLAVE; |
| 36 |
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001 |
| 37 |
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index |
| 38 |
|
| 39 |
# copy the binlog with the following statements: |
| 40 |
# |
| 41 |
#--source include/have_binlog_format_statement.inc |
| 42 |
# |
| 43 |
# CREATE TABLE `foobar` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 44 |
# `foo` varchar(100) CHARACTER SET utf8mb4 NOT NULL, |
| 45 |
# PRIMARY KEY (`id`), UNIQUE KEY `id_foo` (`foo`) |
| 46 |
# ) ENGINE=InnoDB AUTO_INCREMENT=12345 |
| 47 |
# DEFAULT CHARSET=latin1; |
| 48 |
# |
| 49 |
# INSERT INTO foobar (foo) VALUES (0x666F6F626172406578616D706C652E636F6D); |
| 50 |
# INSERT INTO foobar (foo) VALUES (0x666F6F626172406578616D706C652E636F6DD98B); |
| 51 |
# |
| 52 |
# ALTER TABLE `foobar` CHANGE `foo` `old_foo` varchar(100) CHARACTER SET |
| 53 |
# utf8mb4 NOT NULL; |
| 54 |
# DROP TABLE `foobar`; |
| 55 |
# |
| 56 |
|
| 57 |
# on Win* platforms path separator is backslash |
| 58 |
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`) |
| 59 |
{ |
| 60 |
--copy_file std_data/slave-relay-bin_win.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index |
| 61 |
} |
| 62 |
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`) |
| 63 |
{ |
| 64 |
--copy_file std_data/slave-relay-bin_linux.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index |
| 65 |
} |
| 66 |
|
| 67 |
--copy_file std_data/rpl_cross_version_default_utf8mb4_collation.000001 $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001 |
| 68 |
|
| 69 |
--source include/start_slave.inc |
| 70 |
|
| 71 |
# wait until slave reads and applies all events from 5.7 relay log without |
| 72 |
# errors |
| 73 |
--let $slave_param= Slave_SQL_Running_State |
| 74 |
--let $slave_param_value= Replica has read all relay log; waiting for more updates |
| 75 |
--source include/wait_for_slave_param.inc |
| 76 |
|
| 77 |
|
| 78 |
# check that the second 8.0 slave replicates without errors |
| 79 |
--let $rpl_connection_name= server_3 |
| 80 |
--source include/rpl_connection.inc |
| 81 |
|
| 82 |
RESET SLAVE; |
| 83 |
|
| 84 |
--source include/start_slave.inc |
| 85 |
|
| 86 |
--let $rpl_connection_name= server_2 |
| 87 |
--source include/rpl_connection.inc |
| 88 |
--let $sync_slave_connection= server_3 |
| 89 |
--source include/sync_slave_sql_with_master.inc |
| 90 |
|
| 91 |
# clean up |
| 92 |
--source include/stop_slave.inc |
| 93 |
RESET SLAVE; |
| 94 |
--let $rpl_connection_name= server_2 |
| 95 |
--source include/rpl_connection.inc |
| 96 |
--source include/stop_slave.inc |
| 97 |
RESET SLAVE; |
| 98 |
--let $rpl_only_running_threads= 1 |
| 99 |
--source include/rpl_end.inc |