Debian Codegraph @

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

raw
1 ################################################################################
2 #
3 # This test verifies that group_view_change_uuid validation is done correctly
4 # when starting on boot as well as when we pass it manually in the test.
5 #
6 # Test:
7 # 0. The test requires one server: M1.
8 # 1. We can't start a Group Replication if
9 # group_replication_view_change_uuid is configured with a invalid
10 # uuid
11 # 2. We can't start a Group Replication if
12 # group_replication_view_change_uuid is configured with same uuid
13 # as group_replication_group_name
14 # 3. We can't start a Group Replication if
15 # group_replication_view_change_uuid is configured with same uuid
16 # as server 1
17 # 4. We can't set group_replication_group_name to same uuid
18 # configured on group_replication_view_change_uuid
19 # 5. Cleanup
20 ################################################################################
21
22 --source include/have_group_replication_plugin.inc
23
24 SET SESSION sql_log_bin=0;
25 call mtr.add_suppression("Unable to start Group Replication on boot");
26 call mtr.add_suppression("Invalid input value for group_replication_view_change_uuid ''. Please, provide a valid UUID.");
27 call mtr.add_suppression("group_replication_group_name '.*', which is the same as group_replication_view_change_uuid. Please change group_replication_view_change_uuid to AUTOMATIC");
28 call mtr.add_suppression("group_replication_view_change_uuid is incompatible with group. group_replication_view_change_uuid.*matches server_uuid.*.");
29 SET SESSION sql_log_bin=1;
30
31 --echo ####################################################################
32 --echo # 1. We can't start a Group Replication if
33 --echo # group_replication_view_change_uuid is configured with a invalid
34 --echo # uuid
35
36 --let $view_change_uuid_save = `SELECT @@GLOBAL.group_replication_view_change_uuid`
37
38 SET PERSIST_ONLY group_replication_view_change_uuid = "";
39
40 --let $allow_rpl_inited=1
41 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
42 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
43 --let $restart_parameters=restart:--group-replication-start-on-boot=1 --group-replication-group-name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1
44 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
45 --source include/restart_mysqld.inc
46
47 # include/restart_mysqld.inc will only wait for the server to be up, that is,
48 # the server is accepting client connections.
49 # That point is before the Group Replication start, which may cause this
50 # client session to assert the error log before the error condition was reached.
51 # Before assert the error log we wait until the error is logged into the table
52 # performance_schema.error_log.
53 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.error_log WHERE error_code='MY-013748' AND data LIKE '%Invalid input value for group_replication_view_change_uuid %'
54 --source include/wait_condition.inc
55
56 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
57 --let $assert_select= Invalid input value for group_replication_view_change_uuid ''. Please, provide a valid UUID.
58 --let $assert_count= 1
59 --let $assert_text= group_replication_view_change_uuid '' not a valid uuid
60 --source include/assert_grep.inc
61
62
63 --error ER_GROUP_REPLICATION_CONFIGURATION
64 START GROUP_REPLICATION;
65
66 --error ER_WRONG_VALUE_FOR_VAR
67 SET GLOBAL group_replication_view_change_uuid = "";
68
69 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
70 --let $assert_select= Invalid input value for group_replication_view_change_uuid ''. Please, provide a valid UUID.
71 --let $assert_count= 2
72 --let $assert_text= group_replication_view_change_uuid '' not a valid uuid
73 --source include/assert_grep.inc
74
75
76 --echo ####################################################################
77 --echo # 2. We can't start a Group Replication if
78 --echo # group_replication_view_change_uuid is configured with same uuid
79 --echo # as group_replication_group_name
80
81 --replace_result $group_replication_group_name GROUP_NAME
82 --eval SET PERSIST_ONLY group_replication_view_change_uuid = "$group_replication_group_name"
83
84 --let $allow_rpl_inited=1
85 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
86 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
87 --let $restart_parameters=restart:--group-replication-start-on-boot=1 --group-replication-group-name=$group_replication_group_name --group_replication_view_change_uuid=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1
88 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
89 --source include/restart_mysqld.inc
90
91 # include/restart_mysqld.inc will only wait for the server to be up, that is,
92 # the server is accepting client connections.
93 # That point is before the Group Replication start, which may cause this
94 # client session to assert the error log before the error condition was reached.
95 # Before assert the error log we wait until the error is logged into the table
96 # performance_schema.error_log.
97 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.error_log WHERE error_code='MY-013750' AND data LIKE '%which is the same as group_replication_view_change_uuid. Please change group_replication_view_change_uuid to AUTOMATIC%'
98 --source include/wait_condition.inc
99
100 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
101 --let $assert_select= group_replication_group_name '.*', which is the same as group_replication_view_change_uuid. Please change group_replication_view_change_uuid to AUTOMATIC
102 --let $assert_count= 1
103 --let $assert_text= group_replication_group_name shall be different from group_replication_view_change_uuid
104 --source include/assert_grep.inc
105
106 --error ER_GROUP_REPLICATION_CONFIGURATION
107 START GROUP_REPLICATION;
108
109 --replace_result $group_replication_group_name GROUP_NAME
110 --error ER_WRONG_VALUE_FOR_VAR_PLUS_ACTIONABLE_PART
111 --eval SET GLOBAL group_replication_view_change_uuid = "$group_replication_group_name"
112
113 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
114 --let $assert_select= group_replication_group_name '.*', which is the same as group_replication_view_change_uuid. Please change group_replication_view_change_uuid to AUTOMATIC
115 --let $assert_count= 2
116 --let $assert_text= group_replication_group_name shall be different from group_replication_view_change_uuid
117 --source include/assert_grep.inc
118
119
120 --echo ####################################################################
121 --echo # 3. We can't start a Group Replication if
122 --echo # group_replication_view_change_uuid is configured with same uuid
123 --echo # as server 1
124
125 --let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
126
127 --replace_result $member1_uuid MEMBER_1_UUID
128 --eval SET PERSIST_ONLY group_replication_view_change_uuid = "$member1_uuid"
129
130 --let $allow_rpl_inited=1
131 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
132 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
133 --let $restart_parameters=restart:--group-replication-start-on-boot=1 --group-replication-group-name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1
134 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
135 --source include/restart_mysqld.inc
136
137 # include/restart_mysqld.inc will only wait for the server to be up, that is,
138 # the server is accepting client connections.
139 # That point is before the Group Replication start, which may cause this
140 # client session to assert the error log before the error condition was reached.
141 # Before assert the error log we wait until the error is logged into the table
142 # performance_schema.error_log.
143 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.error_log WHERE error_code='MY-013752' AND data LIKE '%group_replication_view_change_uuid is incompatible with group. group_replication_view_change_uuid %'
144 --source include/wait_condition.inc
145
146 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
147 --let $assert_select= group_replication_view_change_uuid is incompatible with group. group_replication_view_change_uuid.*matches server_uuid.*.
148 --let $assert_count= 1
149 --let $assert_text= group_replication_view_change_uuid shall be diferent from server uuid
150 --source include/assert_grep.inc
151
152
153 --error ER_GROUP_REPLICATION_CONFIGURATION
154 START GROUP_REPLICATION;
155
156 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
157 --let $assert_select= group_replication_view_change_uuid is incompatible with group. group_replication_view_change_uuid.*matches server_uuid.*.
158 --let $assert_count= 2
159 --let $assert_text= group_replication_view_change_uuid shall be diferent from server uuid
160 --source include/assert_grep.inc
161
162
163 --echo ####################################################################
164 --echo # 4. We can't set group_replication_group_name to same uuid
165 --echo # configured on group_replication_view_change_uuid
166
167 SET GLOBAL group_replication_view_change_uuid = "9f46e042-98a0-439d-a8fb-7130670ca49b";
168
169 --error ER_WRONG_VALUE_FOR_VAR_PLUS_ACTIONABLE_PART
170 SET GLOBAL group_replication_group_name = "9f46e042-98a0-439d-a8fb-7130670ca49b";
171
172
173 --echo ####################################################################
174 --echo # 5. Cleanup
175
176 RESET PERSIST;
177 --replace_result $view_change_uuid_save VIEW_CHANGE_UUID
178 --eval SET GLOBAL group_replication_view_change_uuid = $view_change_uuid_save
179
180 --let $allow_rpl_inited=1
181 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
182 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
183 --let $restart_parameters=restart:--group-replication-start-on-boot=OFF --group-replication-group-name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1
184 --source include/restart_mysqld_no_echo.inc
185
186 --source include/gr_clear_configuration.inc