Debian Codegraph @

mysql-test/suite/group_replication/t/gr_recovery_endpoints_ipv6_ipv4.test

raw
1 ###############################################################################
2 # This test verifies that if the recovery endpoints has endpoint with IPv6 and
3 # IPV4, clone will IPv4 due to lack of support IPv6 and incremental recovery
4 # will use IPv6.
5 #
6 # Test:
7 # 0. The test requires two servers
8 # 1. Install clone plugin on server1.
9 # 2. Configure recovery endpoints with two valid endpoints
10 # 3. Bootstrap server1 and add some data
11 # 4. Restart server2 with a monitoring process (mysqld_safe) if needed
12 # 5. Setup the server so group replication starts on boot
13 # Install the Clone plugin
14 # 6. Ensure clone is used on recovery
15 # 7. On a empty server2 start group replication
16 # 8. Clone will fail connecting to first endpoint IPv6 and shall use IPv4
17 # 9. Distributed recovery shall use first endpoint IPv6
18 # 10. Clone shall succeed and all data retrieved from server1
19 # 11. Cleanup
20 #
21 ###############################################################################
22
23 --source include/have_ipv6.inc
24 --source include/have_mysqld_monitoring_process.inc
25 --source include/have_clone_plugin.inc
26 --source include/have_group_replication_plugin.inc
27 --let $rpl_skip_group_replication_start= 1
28 --source include/group_replication.inc
29
30 --echo
31 --echo # 1. Install clone plugin on server1.
32
33 --let $rpl_connection_name= server1
34 --source include/rpl_connection.inc
35
36 --let $server1_port= `SELECT @@GLOBAL.PORT`
37
38 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
39 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
40
41 --echo
42 --echo # 2. Configure recovery endpoints with two valid endpoints
43
44 --replace_result $server1_port SERVER1_PORT
45 --eval SET @@GLOBAL.group_replication_advertise_recovery_endpoints = "[::1]:$server1_port,127.0.0.1:$server1_port"
46
47
48 --echo
49 --echo # 3. Bootstrap server1 and add some data
50
51 --source include/start_and_bootstrap_group_replication.inc
52
53 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
54 INSERT INTO t1 VALUES (1);
55 INSERT INTO t1 VALUES (2);
56
57 --echo
58 --echo # 4. Restart server2 with a monitoring process (mysqld_safe) if needed
59
60 --let $rpl_connection_name= server2
61 --source include/rpl_connection.inc
62
63 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
64 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
65 --let $_group_replication_start_on_boot= `SELECT @@GLOBAL.group_replication_start_on_boot`
66 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
67
68 --let $plugin_list= $GROUP_REPLICATION
69 --source include/spawn_monitoring_process.inc
70
71 --echo
72 --echo # 5. Setup the server so group replication starts on boot
73 --echo # Install the Clone plugin
74
75 --disable_query_log
76 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
77 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
78 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
79 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
80
81 SET PERSIST group_replication_start_on_boot= ON;
82 --enable_query_log
83
84 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
85 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
86
87 --echo
88 --echo # 6. Ensure clone is used on recovery
89
90 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
91 SET GLOBAL group_replication_clone_threshold= 1;
92
93 --echo
94 --echo # 7. On a empty server2 start group replication
95
96 --let $rpl_connection_name= server2
97 --source include/rpl_connection.inc
98
99 START GROUP_REPLICATION;
100
101 --source include/wait_until_disconnected.inc
102
103 --let $rpl_server_number= 2
104 --source include/rpl_reconnect.inc
105
106 --let $group_replication_member_state=ONLINE
107 --source include/gr_wait_for_member_state.inc
108
109 --echo # 8. Clone will fail connecting to first endpoint IPv6 and shall use IPv4
110
111 --let $assert_only_after = CURRENT_TEST: group_replication.gr_recovery_endpoints_ipv6_ipv4
112 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
113 --let $assert_count = 1
114 --let $assert_select = .*SET GLOBAL clone_valid_donor_list = '::1:$server1_port' result in error.*
115 --let $assert_text = clone fail setting IPv6 donor
116 --source include/assert_grep.inc
117
118 --echo
119 --echo # 9. Distributed recovery shall use first endpoint IPv6
120
121 --let $assert_only_after = CURRENT_TEST: group_replication.gr_recovery_endpoints_ipv6_ipv4
122 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
123 --let $assert_count = 1
124 --let $assert_select = .*connected to source 'root@::1:$server1_port'.*
125 --let $assert_text = recovery channel used recovery endpoints configuration
126 --source include/assert_grep.inc
127
128 --echo
129 --echo # 10. Clone shall succeed and all data retrieved from server1
130
131 --let $assert_text= Clone must be completed
132 --let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1;
133 --source include/assert.inc
134
135 # See if the data has been properly cloned in server3
136 --let $diff_tables=server1:test.t1 ,server2:test.t1
137 --source include/diff_tables.inc
138
139 --echo
140 --echo # 11. Cleanup
141
142 --eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save
143
144 RESET PERSIST IF EXISTS group_replication_group_name;
145 RESET PERSIST IF EXISTS group_replication_local_address;
146 RESET PERSIST IF EXISTS group_replication_group_seeds;
147 RESET PERSIST IF EXISTS group_replication_start_on_boot;
148 RESET PERSIST IF EXISTS group_replication_communication_stack;
149
150 --replace_result $_group_replication_start_on_boot START_ON_BOOT_VALUE
151 --eval SET GLOBAL group_replication_start_on_boot= $_group_replication_start_on_boot
152
153 DROP TABLE t1;
154
155 --source include/rpl_sync.inc
156
157 set session sql_log_bin=0;
158 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
159 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
160 call mtr.add_suppression("This member will start distributed recovery using clone. It is due to the number of missing transactions being higher than the configured threshold of 1.");
161 call mtr.add_suppression(".*SET GLOBAL clone_valid_donor_list = '::1:.*' result in error.*");
162 call mtr.add_suppression("There was an issue when configuring the remote cloning process: Error while updating the clone donor list. Error number: 3869.*");
163 set session sql_log_bin=1;
164
165 --source include/clean_monitoring_process.inc
166
167 UNINSTALL PLUGIN clone;
168
169 --let $rpl_connection_name= server1
170 --source include/rpl_connection.inc
171
172 --eval SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "DEFAULT"
173
174 UNINSTALL PLUGIN clone;
175
176 --source include/group_replication_end.inc