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