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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
#
# WL#1697: Multisource replication
#
# The aim of this test:
# 1. To check that replicated FLUSH RELAY LOGS commands do not cause
# errors when we have replication chains of several servers and
# not all channels exist on all servers.
#Skip on group replication runs
--source include/not_group_replication_plugin.inc
--source include/have_binlog_format_mixed.inc
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
--source include/have_slave_repository_type_table.inc
--echo #
--echo # Set up replication chain S1->S2->S3.
--echo #
--let $rpl_topology= 1->2->3
--let $rpl_multi_source= 1
--source include/rpl_init.inc
--echo #
--echo # Assert that server 2 does have channel_1 and doesn't have channel_2.
--echo #
--connection server_2
--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_1"`
--let $assert_text= Server 2 does have a channel named "channel_1".
--let $assert_cond= $num = 1;
--source include/assert.inc
--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_2"`
--let $assert_text= Server 2 doesn't have a channel named "channel_2".
--let $assert_cond= $num = 0;
--source include/assert.inc
--echo #
--echo # Flush relay logs for a nonexistent channel.
--echo # A error will be returned.
--echo #
--error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
FLUSH RELAY LOGS FOR CHANNEL 'channel_2';
--echo #
--echo # Assert that server 3 doesn't have channel_1 and does have channel_2.
--echo #
--connection server_3
--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_1"`
--let $assert_text= Server 3 doesn't have a channel named "channel_1".
--let $assert_cond= $num = 0;
--source include/assert.inc
--let $num= `select count(*) from performance_schema.replication_connection_configuration where channel_name="channel_2"`
--let $assert_text= Server 3 does have a channel named "channel_2".
--let $assert_cond= $num = 1;
--source include/assert.inc
--echo #
--echo # Flush all logs from server 2 and verify that we don't have
--echo # errors on server 3.
--echo #
--connection server_2
FLUSH LOGS;
--connection server_1
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1);
--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc
--let $num= `select count(*) from t1`
--let $assert_text= Server 2 has one row on table t1.
--let $assert_cond= $num = 1;
--source include/assert.inc
--let $sync_slave_connection= server_3
--source include/sync_slave_sql_with_master.inc
--let $num= `select count(*) from t1`
--let $assert_text= Server 3 has one row on table t1.
--let $assert_cond= $num = 1;
--source include/assert.inc
--echo #
--echo # Flush channel_1 relay logs from server 2 and verify that we
--echo # don't have errors on server 3 (where channel_2 does not exist),
--echo # despite a warning being logged and replication is working.
--echo #
--connection server_3
call mtr.add_suppression("Replica channel 'channel_1' does not exist.");
--connection server_2
FLUSH RELAY LOGS FOR CHANNEL 'channel_1';
--connection server_1
INSERT INTO t1 VALUES (2);
--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc
--let $num= `select count(*) from t1`
--let $assert_text= Server 2 has two rows on table t1.
--let $assert_cond= $num = 2;
--source include/assert.inc
--let $sync_slave_connection= server_3
--source include/sync_slave_sql_with_master.inc
--let $num= `select count(*) from t1`
--let $assert_text= Server 3 has two rows on table t1.
--let $assert_cond= $num = 2;
--source include/assert.inc
--echo #
--echo # Clean up.
--echo #
--connection server_1
DROP TABLE t1;
--let $sync_slave_connection= server_2
--source include/sync_slave_sql_with_master.inc
--let $sync_slave_connection= server_3
--source include/sync_slave_sql_with_master.inc
--let $rpl_skip_sync= 1
--source include/rpl_end.inc
|