Debian Codegraph @

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

raw
1 #
2 # WL#1697: Multisource replication
3 #
4 # MSR works only with slave repository type= TABLE.
5 #
6 # This tests test the following.
7 # 1. Start three servers. By default, slave repository is of type FILE
8 # 2. setup a master-slave replication between server 1 and server 2
9 # (a default channel exists between server 1 and server 2)
10 # 3. Execute CHANGE MASTER to create a new channel.
11 # - the command shall fail as we have wrong repository type
12 # 4. Convert only master info repository to TABLE
13 # - CHANGE MASTER shall fail
14 # 5. Convert only relay log info repository to TABLE
15 # - CHANGE MASTER shall fail
16 # 6. Convert both master info and relay log info repositories to TABLE
17 # - CHANGE MASTER shall succeed
18 # 7. Restart the slave server
19 # - There shall be errors in server log and slave should not be setup.
20 # - subsequent commands shall fail unless the slave is properly restarted.
21 # 8. Restart the slave server with type=TABLE
22 # - success
23 # 9. Set repositories to FILE
24 # - failure with an error message.
25 # 10. Set repositories to TABLE // doing it again
26 # - nothing to do.
27 #
28
29 ##Skip on group replication runs
30 --source include/not_group_replication_plugin.inc
31 --source include/have_binlog_format_mixed.inc
32 --source include/master-slave.inc
33
34 --echo #
35 --echo # Create a new channel from the slave to the third server.
36 --echo # There shall be an error
37 --let $rpl_connection_name= server_2
38 --source include/rpl_connection.inc
39
40 --replace_result $SERVER_MYPORT_3 MASTER_PORT
41 --error ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
42 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3";
43
44 --echo # Convert only master_info_repository to table.
45 --echo # The same error shall persist
46 --source include/stop_slave.inc
47 SET @@GLOBAL.master_info_repository ="TABLE";
48
49 call mtr.add_suppression("Replica: Cannot create new connection metadata structure when repositories are of type FILE. Convert replica repositories to TABLE to replicate from multiple sources.");
50
51 --replace_result $SERVER_MYPORT_3 MASTER_PORT
52 --error ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
53 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_USER = "root", SOURCE_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3";
54
55 --echo # Convert only relay log info repository to TABLE
56 --echo # The same error shall remain
57 SET @@GLOBAL.master_info_repository = "FILE";
58 SET @@GLOBAL.relay_log_info_repository = "TABLE";
59
60
61 --replace_result $SERVER_MYPORT_3 MASTER_PORT
62 --error ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
63 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_USER = "root", SOURCE_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3";
64
65 --echo #
66 --echo # Convert both repositories to TABLE. CHANGE MASTER command passes
67 --echo #
68 #As relay_log_info_repository is already set to TABLE, set master_info_repository to TABLE
69 SET @@GLOBAL.master_info_repository = "TABLE";
70
71 --replace_result $SERVER_MYPORT_3 MASTER_PORT
72 --replace_column 2 #
73 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST ="127.0.0.1", SOURCE_USER ="root", SOURCE_PORT=$SERVER_MYPORT_3 FOR CHANNEL "channel_3"
74
75 --echo # Slave now is a multisourced slave.
76 --echo # Restart the slave and check that slave threads are not started because
77 --echo # the repositories are of type FILE
78 call mtr.add_suppression("Replica: This replica was a multisourced replica previously*");
79 call mtr.add_suppression("Failed to create or recover replication info repositories");
80
81 --let $rpl_server_number=2
82 --source include/rpl_restart_server.inc
83 # SHOW SLAVE STATUS will be empty
84 --query_vertical SHOW SLAVE STATUS
85 # Assert that pfs tables are empty
86 --let $assert_text= there shall be only 0 rows as the slave is not configured.
87 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_applier_configuration] =0;
88 --source include/assert.inc
89
90 # subsequent commands shall fail with ER_REPLICA_CONFIGURATION i.e slave not setup
91 # but due to bug19344559 is setup. The error currently fails with
92 # ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
93 # --error ER_REPLICA_CONFIGURATION
94 # --eval CHANGE MASTER TO MASTER_HOST = "127.0.0.1", MASTER_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3"
95
96 --echo #
97 --echo # Test that if slave server is started with TABLE, replication proceeds
98 --echo # as usual.
99 --let $rpl_server_number=2
100 --let $rpl_server_parameters=--master-info-repository=TABLE --relay-log-info-repository=TABLE
101 --source include/rpl_restart_server.inc
102 #assert that two rows are present
103 --let $assert_text= there shall be only 2 rows as slave is restarted properly
104 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_applier_configuration] = 2;
105 --source include/assert.inc
106
107 --echo #
108 --echo # Set slave repostiories to FILE. An error is generated.
109 --echo #
110
111 --error ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
112 SET @@GLOBAL.master_info_repository = "FILE";
113
114 --error ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
115 SET @@GLOBAL.relay_log_info_repository = "FILE";
116
117 SHOW VARIABLES LIKE '%info_repository%';
118
119 --echo #
120 --echo # Currently slave repositores are of type TABLE. Try again
121 --echo # again setting to TABLE. Returns success doing nothing.
122 --echo #
123
124 SET @@GLOBAL.master_info_repository = "TABLE";
125 SET @@GLOBAL.relay_log_info_repository = "TABLE";
126
127 # Clean up.
128 # Delete channel_3 and restart server with FILE
129 #
130 # Stop slave for channel_3
131 --let $rpl_channel_name= 'channel_3'
132 --source include/stop_slave.inc
133
134 # Reset slave for channel_3
135 RESET SLAVE ALL FOR CHANNEL 'channel_3';
136
137 --let $rpl_channel_name=
138
139 --let $rpl_server_number= 2
140 --let $rpl_server_parameters=--master-info-repository=FILE --relay-log-info-repository=FILE
141 --source include/rpl_restart_server.inc
142
143 #End MSR setup
144 --let $rpl_only_running_threads= 1
145 --let $rpl_group_replication= 1
146 --source include/rpl_end.inc
147
148