Debian Codegraph @

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

raw
1 ################################################################################
2 ## Server_uuid should not match with group_replication_group_name when GR is
3 ## running.
4 ##
5 ## This test case covers testing of server_uuid matching
6 ## group_replication_group_name when
7 ## server is bootstrap and start_on_boot=ON.
8 ##
9 ## Test:
10 ## 0. This test requires 2 members.
11 ## 0.1. Store members uuids and set bin logs for required servers.
12 ## 1. Restart server1 with group_name as server1_uuid
13 ## 1.1. Assert GR do not start.
14 ## Since server_uuid matches group_name GR should not start.
15 ## 2. Restart server1 with unique group_name
16 ## 2.1. Assert GR starts on server1.
17 ## Since server_uuid does not match group_name GR should start.
18 ## 2.2. Start server2 to confirm other servers can join group.
19 ## 2.3. Assert GR starts on server2.
20 ## Since server_uuid does not match group_name GR should start.
21 ## 3. Validate failure logged in error file.
22 ## 4. Cleanup
23 ################################################################################
24
25 --source include/big_test.inc
26 --source include/have_group_replication_plugin.inc
27 --source include/force_restart.inc
28
29 --let $allow_rpl_inited=1
30
31 ## 0.1. Store members uuids and set bin logs for required servers.
32
33 --let $rpl_connection_name= server1
34 --source include/rpl_connection.inc
35 --let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
36
37 set session sql_log_bin=0;
38 call mtr.add_suppression("Member server_uuid is incompatible with the group.*");
39 set session sql_log_bin=1;
40
41 SET @debug_group_replication_local_address= @@GLOBAL.group_replication_local_address;
42
43 --echo
44 --echo ########################
45 --echo ## FAILING SCENARIO ##
46 --echo ########################
47 --echo
48
49 ## 1. Restart server1 with group_name as server1_uuid
50
51 --let $rpl_connection_name= server1
52 --source include/rpl_connection.inc
53
54 --let $restart_parameters=restart:--group_replication_group_name=$member1_uuid --group_replication_bootstrap_group=ON --group_replication_local_address=$_group_replication_local_address --group_replication_start_on_boot=1
55 --replace_result $member1_uuid MEMBER_UUID $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS
56 --source include/restart_mysqld.inc
57
58 ## 1.1. Assert GR do not start.
59 ## Since server_uuid matches group_name GR should not start.
60
61 --let $assert_text= 'Assert server1 do not join group when server_uuid and group_name are same.'
62 --let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 0
63 --source include/assert.inc
64
65 --echo
66 --echo ###########################
67 --echo ## SUCCESSFUL SCENARIO ##
68 --echo ###########################
69 --echo
70
71 ## 2. Restart server1 with unique group_name
72
73 --let $group_replication_group_name= 8a94f357-aaaa-11aa-22bb-c80aa9422222
74 --let $restart_parameters=restart:--group_replication_group_name=$group_replication_group_name --group_replication_bootstrap_group=ON --group_replication_local_address=$_group_replication_local_address --group_replication_start_on_boot=1
75 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS
76 --source include/restart_mysqld.inc
77
78 --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"
79 --source include/wait_condition.inc
80
81 ## 2.1. Assert GR starts on server1.
82 ## Since server_uuid does not match group_name GR should start.
83
84 --let $assert_text= 'Assert server1 joins group when server_uuid and group_name are different.'
85 --let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 1
86 --source include/assert.inc
87
88 ## 2.2. Start server2 to confirm other servers can join group.
89
90 --let $rpl_connection_name= server2
91 --source include/rpl_connection.inc
92 SET GLOBAL group_replication_bootstrap_group=OFF;
93 --source include/start_group_replication.inc
94
95 ## 2.3. Assert GR starts on server2.
96 ## Since server_uuid does not match group_name GR should start.
97
98 --let $assert_text= 'Assert server2 joins group when server_uuid and group_name are different.'
99 --let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 2
100 --source include/assert.inc
101
102 --echo
103 --echo ############################
104 --echo ## VALIDATE ERROR LOGGED ##
105 --echo ############################
106 --echo
107
108 ## 3. Validate failure logged in error file.
109
110 --let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_server_uuid_matches_group_name_bootstrap.1.test
111 --let $assert_text = Found the expected error about server_uuid incompatible with the group_name
112 --let $assert_select = Member server_uuid is incompatible with the group
113 --let $assert_count = 1
114 --source include/assert_grep.inc
115
116 --echo
117 --echo ###############
118 --echo ## Cleanup ##
119 --echo ###############
120 --echo
121
122 ## 4. Cleanup
123
124 SET @@GLOBAL.group_replication_local_address= @debug_group_replication_local_address;
125 --source include/stop_group_replication.inc
126
127 --let $rpl_connection_name= server1
128 --source include/rpl_connection.inc
129 --source include/stop_group_replication.inc