Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that Group Replication does allow serves with the same server_uuid on
3 # a group. The second server that tries to join with the same server_uuid will
4 # not be allowed to join.
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. Bootstrap a group on server1, forcing server1 uuid to
9 # "cccccccc-cccc-cccc-cccc-cccccccccccc".
10 # 2. Try to join a second member to the group with the same
11 # server uuid as server1. The join must fail.
12 # 3. Assert that group membership is reported properly on
13 # both servers.
14 # 4. Clean up.
15 ################################################################################
16
17 --source include/have_debug.inc
18 --source include/have_group_replication_plugin.inc
19 --let $rpl_skip_group_replication_start= 1
20 --source include/group_replication.inc
21
22
23 --echo
24 --echo ############################################################
25 --echo # 1. Bootstrap a group on server1, forcing server1 uuid to
26 --echo # "cccccccc-cccc-cccc-cccc-cccccccccccc".
27 --let $rpl_connection_name= server1
28 --source include/rpl_connection.inc
29 SET @debug_save= @@GLOBAL.DEBUG;
30 SET @@GLOBAL.DEBUG= '+d,group_replication_force_member_uuid';
31
32 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
33 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
34 SET GLOBAL group_replication_bootstrap_group= 1;
35 --source include/start_group_replication_command.inc
36 --source include/gr_clear_bootstrap_group.inc
37 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_group_members WHERE channel_name="group_replication_applier" AND member_id="cccccccc-cccc-cccc-cccc-cccccccccccc" AND member_state="ONLINE"
38 --source include/wait_condition.inc
39
40
41 --echo
42 --echo ############################################################
43 --echo # 2. Try to join a second member to the group with the same
44 --echo # server uuid as server1. The join must fail.
45 --let $rpl_connection_name= server2
46 --source include/rpl_connection.inc
47 SET SESSION sql_log_bin= 0;
48 call mtr.add_suppression("There is already a member with server_uuid cccccccc-cccc-cccc-cccc-cccccccccccc. The member will now exit the group.");
49 SET SESSION sql_log_bin= 1;
50
51 SET @debug_save= @@GLOBAL.DEBUG;
52 SET @@GLOBAL.DEBUG= '+d,group_replication_force_member_uuid';
53
54 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
55 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
56 --error ER_GROUP_REPLICATION_CONFIGURATION
57 START GROUP_REPLICATION;
58
59
60 --echo
61 --echo ############################################################
62 --echo # 3. Assert that group membership is reported properly on
63 --echo # both servers.
64 --let $rpl_connection_name= server2
65 --source include/rpl_connection.inc
66 --let $assert_text= Member2 only reports one member
67 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_group_members] = 1
68 --source include/assert.inc
69
70 --let $server2_port= `SELECT @@GLOBAL.port`
71 --let $assert_text= Member2 is reported as OFFLINE
72 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_group_members WHERE channel_name="group_replication_applier" AND member_id="cccccccc-cccc-cccc-cccc-cccccccccccc" AND member_state="OFFLINE" AND member_port=$server2_port] = 1
73 --source include/assert.inc
74
75 --let $rpl_connection_name= server1
76 --source include/rpl_connection.inc
77 --let $assert_text= Member1 only reports one member
78 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_group_members] = 1
79 --source include/assert.inc
80
81 --let $server1_port= `SELECT @@GLOBAL.port`
82 --let $assert_text= Member1 is reported as ONLINE
83 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_group_members WHERE channel_name="group_replication_applier" AND member_id="cccccccc-cccc-cccc-cccc-cccccccccccc" AND member_state="ONLINE" AND member_port=$server1_port] = 1
84 --source include/assert.inc
85
86
87 --echo
88 --echo ############################################################
89 --echo # 4. Clean up.
90 --let $rpl_connection_name= server1
91 --source include/rpl_connection.inc
92 SET @@GLOBAL.DEBUG= @debug_save;
93
94 --let $rpl_connection_name= server2
95 --source include/rpl_connection.inc
96 SET @@GLOBAL.DEBUG= @debug_save;
97
98 --source include/group_replication_end.inc