1# 2# WL#1697: Multisource replication 3# 4# The aim of this test: 5# 1. To check that replicated FLUSH RELAY LOGS commands do not cause 6# errors when we have replication chains of several servers and 7# not all channels exist on all servers. 8#Skip on group replication runs 9--source include/not_group_replication_plugin.inc 10--source include/have_binlog_format_mixed.inc 11 12--echo # 13--echo # Set up replication chain S1->S2->S3. 14--echo # 15--let $rpl_topology= 1->2->3 16--let $rpl_multi_source= 1 17--source include/rpl_init.inc 18 19 20--echo # 21--echo # Assert that server 2 does have channel_1 and doesn't have channel_2. 22--echo # 23--connection server_2 24--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_1"` 25--let $assert_text= Server 2 does have a channel named "channel_1". 26--let $assert_cond= $num = 1; 27--source include/assert.inc 28 29--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_2"` 30--let $assert_text= Server 2 doesn't have a channel named "channel_2". 31--let $assert_cond= $num = 0; 32--source include/assert.inc 33 34 35--echo # 36--echo # Flush relay logs for a nonexistent channel. 37--echo # A error will be returned. 38--echo # 39--error ER_SLAVE_CHANNEL_DOES_NOT_EXIST 40FLUSH RELAY LOGS FOR CHANNEL 'channel_2'; 41 42 43--echo # 44--echo # Assert that server 3 doesn't have channel_1 and does have channel_2. 45--echo # 46--connection server_3 47--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_1"` 48--let $assert_text= Server 3 doesn't have a channel named "channel_1". 49--let $assert_cond= $num = 0; 50--source include/assert.inc 51 52--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_2"` 53--let $assert_text= Server 3 does have a channel named "channel_2". 54--let $assert_cond= $num = 1; 55--source include/assert.inc 56 57 58--echo # 59--echo # Flush all logs from server 2 and verify that we don't have 60--echo # errors on server 3. 61--echo # 62--connection server_2 63FLUSH LOGS; 64 65--connection server_1 66CREATE TABLE t1 (c1 INT); 67INSERT INTO t1 VALUES (1); 68 69--let $sync_slave_connection= server_2 70--source include/sync_slave_sql_with_master.inc 71 72--let $num= `select count(*) from t1` 73--let $assert_text= Server 2 has one row on table t1. 74--let $assert_cond= $num = 1; 75--source include/assert.inc 76 77--let $sync_slave_connection= server_3 78--source include/sync_slave_sql_with_master.inc 79 80--let $num= `select count(*) from t1` 81--let $assert_text= Server 3 has one row on table t1. 82--let $assert_cond= $num = 1; 83--source include/assert.inc 84 85 86 87--echo # 88--echo # Flush channel_1 relay logs from server 2 and verify that we 89--echo # don't have errors on server 3 (where channel_2 does not exist), 90--echo # despite a warning being logged and replication is working. 91--echo # 92--connection server_3 93call mtr.add_suppression("Slave channel 'channel_1' does not exist."); 94 95--connection server_2 96FLUSH RELAY LOGS FOR CHANNEL 'channel_1'; 97 98--connection server_1 99INSERT INTO t1 VALUES (2); 100 101--let $sync_slave_connection= server_2 102--source include/sync_slave_sql_with_master.inc 103 104--let $num= `select count(*) from t1` 105--let $assert_text= Server 2 has two rows on table t1. 106--let $assert_cond= $num = 2; 107--source include/assert.inc 108 109--let $sync_slave_connection= server_3 110--source include/sync_slave_sql_with_master.inc 111 112--let $num= `select count(*) from t1` 113--let $assert_text= Server 3 has two rows on table t1. 114--let $assert_cond= $num = 2; 115--source include/assert.inc 116 117 118--echo # 119--echo # Clean up. 120--echo # 121--connection server_1 122DROP TABLE t1; 123 124--let $sync_slave_connection= server_2 125--source include/sync_slave_sql_with_master.inc 126 127--let $sync_slave_connection= server_3 128--source include/sync_slave_sql_with_master.inc 129 130--let $rpl_skip_sync= 1 131--source include/rpl_end.inc 132