Debian Codegraph @

mysql-test/suite/rpl/t/rpl_multi_source_cmd_errors.test

raw
1 # WL#1697: Multisource replication
2 #
3 # Test the error conditions for a command.
4 #
5 # 1. When Multiple channels exist and FOR CHANNEL clause
6 # is not issued, then certain COMMANDS shall fail.
7 # 2. When a non existent channel is provided as input,
8 # certain commands shall fail
9 # 3. CHANGE MASTER errors related to Channel as input.
10 #
11
12 #Skip on group replication runs
13 --source include/not_group_replication_plugin.inc
14 --source include/have_binlog_format_mixed.inc
15 # Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
16 --source include/have_slave_repository_type_table.inc
17 --source include/have_debug.inc
18
19 --echo #
20 --echo # set up masters server_1 and server_3 with server_2 being a slave.
21 --echo #.
22 --let $rpl_multi_source= 1
23 --let $rpl_topology= 1->2,3->2
24 --source include/rpl_init.inc
25
26 # Multisource replication is already setup.
27
28 # On slave
29 --let $rpl_connection_name= server_2
30 --source include/rpl_connection.inc
31 --echo #
32 --echo # 1. Test ER_REPLICA_MULTIPLE_CHANNELS_CMD
33 --echo #
34 --error ER_REPLICA_MULTIPLE_CHANNELS_CMD
35 CHANGE REPLICATION SOURCE TO SOURCE_USER = "root";
36
37 --error ER_REPLICA_MULTIPLE_CHANNELS_CMD
38 SHOW RELAYLOG EVENTS;
39
40 --error ER_REPLICA_MULTIPLE_CHANNELS_CMD
41 SELECT SOURCE_POS_WAIT("dummy-bin.000001", 4);
42
43 --error ER_REPLICA_MULTIPLE_CHANNELS_CMD
44 START SLAVE UNTIL SOURCE_LOG_FILE = "dummy-bin.0000001", SOURCE_LOG_POS = 1729
45
46 #--error ER_REPLICA_MULTIPLE_CHANNELS_CMD
47 #SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS("1111-1111-1111-1111:1");
48
49 --error ER_REPLICA_MULTIPLE_CHANNELS_CMD
50 START SLAVE UNTIL SOURCE_LOG_FILE = "dummy-bin.000001", SOURCE_LOG_POS = 4;
51
52
53 --echo #
54 --echo # 2. Test errors of commands on an invalid channel
55 --echo #
56 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
57 START SLAVE FOR CHANNEL "non_existent";
58
59 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
60 STOP SLAVE FOR CHANNEL "non_existent";
61
62 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
63 SHOW RELAYLOG EVENTS FOR CHANNEL "non_existent";
64
65 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
66 RESET SLAVE FOR CHANNEL "non_existent";
67
68 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
69 FLUSH RELAY LOGS FOR CHANNEL "non_existent";
70
71 --echo # Following wait functions shall return for a non_existnent channels
72 SELECT SOURCE_POS_WAIT("dummy-bin.00001",4, 3, "non_existtent");
73
74 SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS("1111-1111-1111-1111:1", 2, "non_existent");
75
76 --echo #
77 --echo # 3a) Test that proper error messages are sent out when invalid
78 --echo # channel names are given for change master command.
79 --echo #
80 --error ER_REPLICA_CHANNEL_NAME_INVALID_OR_TOO_LONG
81 CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_USER = "root" FOR CHANNEL "A123456789A123456789A123456789A123456789A123456789A123456789A123456789";
82
83 --error ER_REPLICA_CHANNEL_NAME_INVALID_OR_TOO_LONG
84 CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_USER = "root" FOR CHANNEL " ";
85
86 --echo #
87 --echo # 3.b) Check that maximum channels permitted error is issued.
88 --echo #
89
90 --let $debug_point= max_replication_channels_exceeded
91 --source include/add_debug_point.inc
92
93 --error ER_REPLICA_MAX_CHANNELS_EXCEEDED
94 CHANGE REPLICATION SOURCE TO SOURCE_LOG_POS = 4 FOR CHANNEL "257th_channel";
95
96 --let $debug_point= max_replication_channels_exceeded
97 --source include/remove_debug_point.inc
98
99 --echo #
100 --echo # 3.c) Check that restricted channel names cannot be used
101 --echo #
102
103 --error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
104 CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10 FOR CHANNEL "group_replication_applier";
105 --error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
106 CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10 FOR CHANNEL "group_replication_recovery";
107
108 --echo # Assert that channels are not created for failed CHANGE MASTER command.
109 --echo # and number of channels configured must be 2
110 --let $assert_text= there shall be only two rows representing 2 channels.
111 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_applier_configuration] = 2;
112 --source include/assert.inc
113
114 # End MSR setup.
115 --let $rpl_skip_sync= 1
116 --let $rpl_only_running_threads= 1
117 --source include/rpl_end.inc