Debian Codegraph @

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

raw
1 #######################################################################################
2 # This test checks dynamically setting the values for
3 # group_replication_communication_debug_options variable and checks all possible correct
4 # and incorrect values before and after starting the group replication and also
5 # setting the incorrect values through cmdline
6 #
7 # WL10200 : Change GCS/XCOM to have dynamic debugging and tracing
8 # Test :
9 # 0. This test requires 2 servers(1 server for all the correct and incorrect values verification, and
10 # 2nd server for cmdline value verification for this gr_communication_debug_options variable)
11 # 1. Store the values of gr_communication_debug_options before doing any operations on server1
12 # 2. Check and make sure file is not created when the server is started
13 # and validate the default value set for group_replication_communication_
14 # debug_options variable
15 # 3. Make sure server throws proper error when user tries to set incorrect values for
16 # gr_communication_debug_options
17 # 4. Test passing more than one value to group_replication_communication_debug_options
18 # with one incorrect value, and make sure server throws proper error
19 # 5. Bootstrap and start group replication on server1
20 # 6. Make sure file is created once the gr is started, in server1 data directory
21 # 7. Make sure server1 throws proper error, if user tries to set incorrect value,
22 # even after the gr is started
23 # 8. Validate the option set after 3-4 failed attempts with incorrect values
24 # 9. Set all the 5 valid values dynamically and make sure value set is GCS_DEBUG_ALL
25 # 10.Test passing more than one values(correct/incorrect) to group_replication_communication_debug_options
26 # also validate the set options.
27 # 11.Overwrite the previous option with "" dynamically and make sure old value is
28 # overridden by disabling all the previous set options.
29 # 12.Set all the 5 valid values and start the gr and validate that value set is GCS_DEBUG_ALL
30 # 13.Try to set all the valid values possible dynamically on server1 and validate the same
31 # 14.Make sure GCS_DEBUG_TRACE file is present after all these operations
32 # 15.Server2 is set with incorrect gr_communications_debug_options during the start,
33 # connect a client and try to start the gr and then set the correct values to
34 # gr_communications_debug_options and start the gr and validate
35 # 16.Overwrite previous set options with "" dynamically and make sure old value is
36 # overridden by disabling all the previous set options
37 # 17.Connect to server1 and cleanup
38 #######################################################################################
39 --source include/have_debug.inc
40 --let $group_replication_group_name= 89ab83b0-9f17-11e3-a5e2-0800200c9a66
41 --source include/have_group_replication_plugin.inc
42 --let $rpl_server_count= 2
43 --let $rpl_skip_group_replication_start= 1
44 --source include/group_replication.inc
45
46 SET SESSION sql_log_bin=0;
47 call mtr.add_suppression("\\[ERROR\\] \\[MY-[^]]*\\] \\[Repl\] Plugin group_replication reported: 'Some debug options in '.*' are not valid.'");
48 SET SESSION sql_log_bin=1;
49
50 # Store the values of gr_communication_debug_options before doing any operations on server1
51 --let $saved_gr_communication_debug_options_server1 = `SELECT @@GLOBAL.group_replication_communication_debug_options;`
52
53 # Check and make sure file is not created when the server is started and validate
54 # the default value set for group_replication_communication_debug_options variable
55 --error 1
56 --file_exists $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
57
58 --let $assert_text= Checking the value of gr_communications_debug_opts
59 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_NONE"
60 --source include/assert.inc
61
62 # Make sure server throws proper error when user tries to set incorrect values for
63 # gr_communication_debug_options.
64 --error ER_WRONG_VALUE_FOR_VAR
65 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="123456";
66 --error ER_WRONG_VALUE_FOR_VAR
67 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="!@#!#!#";
68 --error ER_WRONG_VALUE_FOR_VAR
69 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS=",,,";
70 --error ER_WRONG_VALUE_FOR_VAR
71 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_DBG";
72
73 # Test passing more than one value to group_replication_communication_debug_options
74 # with one incorrect value, and make sure server throws proper error
75 --error ER_WRONG_VALUE_FOR_VAR
76 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_ALL,12345";
77
78 # Bootstrap and start group replication on server1
79 --source include/start_and_bootstrap_group_replication.inc
80
81 # Make sure file is created once the gr is started, in server1 data directory
82 --file_exists $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
83
84 # Make sure server1 throws proper error, if user tries to set incorrect value,
85 # even after the gr is started
86 --error ER_WRONG_VALUE_FOR_VAR
87 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="123456";
88 --error ER_WRONG_VALUE_FOR_VAR
89 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="!@#!#!#";
90 --error ER_WRONG_VALUE_FOR_VAR
91 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS=",,,,,";
92 --error ER_WRONG_VALUE_FOR_VAR
93 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_DBG";
94
95 # Validate the option set after 3-4 failed attempts with incorrect values
96 --let $assert_text= Checking the value of gr_communications_debug_opts
97 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_NONE"
98 --source include/assert.inc
99
100 # Set all the 5 valid values dynamically and make sure value set is GCS_DEBUG_ALL
101 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_BASIC,GCS_DEBUG_TRACE,XCOM_DEBUG_BASIC,XCOM_DEBUG_TRACE,GCS_DEBUG_ALL";
102 --let $assert_text= Checking the value of gr_communications_debug_opts
103 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_ALL"
104 --source include/assert.inc
105
106 # Test passing more than one values(correct/incorrect) to group_replication_communication_debug_options
107 # also validate the set options
108 --error ER_WRONG_VALUE_FOR_VAR
109 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_ALL,12345";
110 --error ER_WRONG_VALUE_FOR_VAR
111 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_ALL,XCOM_DEBUG_DBG";
112
113 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_BASIC,GCS_DEBUG_TRACE,XCOM_DEBUG_BASIC,XCOM_DEBUG_TRACE";
114
115 --let $assert_text= Checking the value of gr_communications_debug_opts
116 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_BASIC,GCS_DEBUG_TRACE,XCOM_DEBUG_BASIC,XCOM_DEBUG_TRACE"
117 --source include/assert.inc
118
119 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_BASIC,,,,,XCOM_DEBUG_BASIC";
120 --let $assert_text= Checking the value of gr_communications_debug_opts
121 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_BASIC,XCOM_DEBUG_BASIC"
122 --source include/assert.inc
123
124 # Overwrite the previous option with "" dynamically and make sure old value is
125 # overridden by disabling all the previous set options.
126 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="";
127 --let $assert_text= Checking the value of gr_communications_debug_opts
128 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_NONE"
129 --source include/assert.inc
130
131 --let $rpl_connection_name= server1
132 --source include/rpl_connection.inc
133 --source include/stop_group_replication.inc
134 --remove_file $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
135
136 --source include/start_and_bootstrap_group_replication.inc
137
138 # Try to set all the valid values possible dynamically on server1 and validate the same
139 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_NONE";
140
141 --let $assert_text= Checking the value of gr_communications_debug_opts
142 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_NONE"
143 --source include/assert.inc
144
145 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_BASIC";
146 --let $assert_text= Checking the value of gr_communications_debug_opts
147 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_BASIC"
148 --source include/assert.inc
149
150 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_TRACE";
151 --let $assert_text= Checking the value of gr_communications_debug_opts
152 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_TRACE"
153 --source include/assert.inc
154
155 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="XCOM_DEBUG_BASIC";
156 --let $assert_text= Checking the value of gr_communications_debug_opts
157 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "XCOM_DEBUG_BASIC"
158 --source include/assert.inc
159
160 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="XCOM_DEBUG_TRACE";
161 --let $assert_text= Checking the value of gr_communications_debug_opts
162 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "XCOM_DEBUG_TRACE"
163 --source include/assert.inc
164
165 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_ALL";
166 --let $assert_text= Checking the value of gr_communications_debug_opts
167 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_ALL"
168 --source include/assert.inc
169
170 # Make sure GCS_DEBUG_TRACE file is present after all these operations
171 --file_exists $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
172
173 # Server2 is set with incorrect gr_communications_debug_options during the start,
174 # connect a client and try to start the gr and then set the correct values to
175 # gr_communications_debug_options and start the gr and validate
176 --let $rpl_connection_name= server2
177 --source include/rpl_connection.inc
178
179 SET SESSION sql_log_bin=0;
180 call mtr.add_suppression("\\[ERROR\\] \\[[^]]*\\] \\[[^]]*\\] Plugin group_replication reported: 'Some debug options in '.*' are not valid.'");
181 SET SESSION sql_log_bin=1;
182
183 SET GLOBAL group_replication_group_name= "89ab83b0-9f17-11e3-a5e2-0800200c9a66";
184 --error ER_GROUP_REPLICATION_CONFIGURATION
185 START GROUP_REPLICATION;
186
187 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="GCS_DEBUG_BASIC,XCOM_DEBUG_BASIC,GCS_DEBUG_TRACE";
188 --let $assert_text= Checking the value of gr_communications_debug_opts
189 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_BASIC,GCS_DEBUG_TRACE,XCOM_DEBUG_BASIC"
190 --source include/assert.inc
191
192 --source include/start_group_replication.inc
193 --file_exists $MYSQLTEST_VARDIR/mysqld.1/data/GCS_DEBUG_TRACE
194
195 # Overwrite previous set options with "" dynamically and make sure old value is
196 # overridden by disabling all the previous set options.
197 SET GLOBAL GROUP_REPLICATION_COMMUNICATION_DEBUG_OPTIONS="";
198 --let $assert_text= Checking the value of gr_communications_debug_opts
199 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_communication_debug_options]" = "GCS_DEBUG_NONE"
200 --source include/assert.inc
201
202 # Connect to server1 and cleanup
203 --let $rpl_connection_name= server1
204 --source include/rpl_connection.inc
205
206 --disable_query_log
207 --eval SET @@GLOBAL.group_replication_communication_debug_options= "$saved_gr_communication_debug_options_server1"
208 --enable_query_log
209
210 --source include/group_replication_end.inc
211
212 # Known issue: Once bug#26729404 is fixed, remove the below lines.
213 # For Server2, the value of gr_communications_debug_options can't be
214 # set back to GCS_DEBUG_INVALID since its a garbage value and this
215 # will cause check-testcase failure on server2. Thus, disabling the
216 # check-testcase by sourcing 'force_restart.inc' file for the test.
217 --source include/force_restart.inc