Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that list of senders is updated when a member of the group is also
3 # added manually to the list of sources.
4 #
5 # Test:
6 # 0. The test requires 4 servers:
7 # server1: group primary
8 # server2: group secondary
9 # server3: group secondary
10 # server4: replica server
11 # 1. Deploy a 3 members group in single primary mode.
12 # 2. Add manually the third member of group to the list of
13 # unmanaged sources of the replica.
14 # 3. Configure replica to manage the asynchronous connection
15 # to group A.
16 # 4. Create and start the managed channel.
17 # Replica will connect to server3 (weigth: 90).
18 # 5. Remove the manually added server3 from the sources list.
19 # Replica will connect to server1 (weigth: 80).
20 # 6. Clean up.
21 ################################################################################
22
23 --source include/have_group_replication_plugin.inc
24 --let $group_replication_group_name= aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
25 --let $rpl_skip_group_replication_start= 1
26 --let $rpl_server_count= 4
27 --source include/group_replication.inc
28
29 --echo
30 --echo ############################################################
31 --echo # 1. Deploy a 3 members group in single primary mode.
32 --let $rpl_connection_name= server1
33 --source include/rpl_connection.inc
34 --let $server1_uuid= `SELECT @@server_uuid`
35 --source include/start_and_bootstrap_group_replication.inc
36
37 --let $rpl_connection_name= server2
38 --source include/rpl_connection.inc
39 --source include/start_group_replication.inc
40
41 --let $rpl_connection_name= server3
42 --source include/rpl_connection.inc
43 --let $server3_uuid= `SELECT @@server_uuid`
44 --source include/start_group_replication.inc
45
46
47 --echo
48 --echo ############################################################
49 --echo # 2. Add manually the third member of group to the list of
50 --echo # unmanaged sources of the replica.
51 --let $rpl_connection_name= server4
52 --source include/rpl_connection.inc
53 --replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3
54 --eval SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', $SERVER_MYPORT_3, '', 90);
55
56
57 --echo ############################################################
58 --echo # 3. Configure replica to manage the asynchronous connection
59 --echo # to group A.
60 --echo
61 --let $rpl_connection_name= server4
62 --source include/rpl_connection.inc
63 --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 $group_replication_group_name GROUP
64 --eval SELECT asynchronous_connection_failover_add_managed('ch1', 'GroupReplication', '$group_replication_group_name', '127.0.0.1', $SERVER_MYPORT_2, '', 80, 70);
65
66
67 --echo ############################################################
68 --echo # 4. Create and start the managed channel.
69 --echo # Replica will connect to server3 (weigth: 90).
70 --let $rpl_connection_name= server4
71 --source include/rpl_connection.inc
72 --replace_result $SERVER_MYPORT_1 SERVER_1_PORT
73 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_CONNECTION_AUTO_FAILOVER=1, SOURCE_PORT=$SERVER_MYPORT_1, SOURCE_CONNECT_RETRY=1, SOURCE_RETRY_COUNT=1 FOR CHANNEL 'ch1'
74
75 --let $rpl_channel_name='ch1'
76 --source include/start_slave.inc
77 --let $rpl_channel_name=
78
79 --let $wait_condition= SELECT COUNT(*)=4 FROM performance_schema.replication_asynchronous_connection_failover
80 --source include/wait_condition.inc
81
82 --replace_column 3 PORT
83 SELECT * FROM performance_schema.replication_asynchronous_connection_failover ORDER BY weight DESC;
84
85 --echo Wait until ch1 IO_THREAD is connected to server3
86 --let $wait_condition= SELECT service_state="ON" FROM performance_schema.replication_connection_status WHERE channel_name="ch1" AND source_uuid="$server3_uuid"
87 --source include/wait_condition.inc
88
89
90 --echo ############################################################
91 --echo # 5. Remove the manually added server3 from the sources list.
92 --echo # Replica will connect to server1 (weigth: 80).
93 --let $rpl_connection_name= server4
94 --source include/rpl_connection.inc
95 --replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3
96 --eval SELECT asynchronous_connection_failover_delete_source('ch1', '127.0.0.1', $SERVER_MYPORT_3, '');
97
98 --let $assert_text= 'There are 0 rows in performance_schema.replication_asynchronous_connection_failover for single servers'
99 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE managed_name="", count, 1] = 0
100 --source include/assert.inc
101
102 --let $assert_text= 'There are 3 rows in performance_schema.replication_asynchronous_connection_failover belonging to the group'
103 --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE managed_name="$group_replication_group_name", count, 1] = 3
104 --source include/assert.inc
105
106 --replace_column 3 PORT
107 SELECT * FROM performance_schema.replication_asynchronous_connection_failover ORDER BY weight DESC;
108
109 --echo Wait until ch1 IO_THREAD is connected to server1
110 --let $wait_condition= SELECT service_state="ON" FROM performance_schema.replication_connection_status WHERE channel_name="ch1" AND source_uuid="$server1_uuid"
111 --source include/wait_condition.inc
112
113
114 --echo ############################################################
115 --echo # 6. Clean up.
116 --let $rpl_connection_name= server4
117 --source include/rpl_connection.inc
118
119 SET SESSION sql_log_bin = 0;
120 call mtr.add_suppression("The source .* for channel 'ch1' has joined the group .*, and so added its entry into replication_asynchronous_connection_failover table.");
121 call mtr.add_suppression("The group .* for the channel .* has been removed, and so removed its entry from replication_asynchronous_connection_failover_managed and all the group members from replication_asynchronous_connection_failover table.");
122 call mtr.add_suppression("The group .* for the channel .* has been added, and so added its entry in replication_asynchronous_connection_failover_managed and source to replication_asynchronous_connection_failover table.");
123 SET SESSION sql_log_bin = 1;
124
125 --let $rpl_channel_name='ch1'
126 --source include/stop_slave.inc
127
128 --let $rpl_reset_slave_all= 1
129 --let $rpl_multi_source= 1
130 --source include/rpl_reset_slave.inc
131 --let $rpl_channel_name=
132 --let $rpl_reset_slave_all=
133 --let $rpl_multi_source=
134
135 --replace_result $group_replication_group_name GROUP
136 --eval SELECT asynchronous_connection_failover_delete_managed('ch1', '$group_replication_group_name')
137
138 --let $rpl_connection_name= server3
139 --source include/rpl_connection.inc
140 --source include/stop_group_replication.inc
141
142 --let $rpl_connection_name= server2
143 --source include/rpl_connection.inc
144 --source include/stop_group_replication.inc
145
146 --let $rpl_connection_name= server1
147 --source include/rpl_connection.inc
148 --source include/stop_group_replication.inc
149
150 --source include/group_replication_end.inc