| 1 |
################################################################################ |
| 2 |
# WL#11610 - GCS message fragmentation options |
| 3 |
# |
| 4 |
# This test case checks message fragmentation options for group replication |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. The test requires two servers: M1 and M2. |
| 8 |
# 1. When GROUP is OFFLINE, set variable |
| 9 |
# group_replication_communication_max_message_size to 0, i.e. disabled. |
| 10 |
# 2. Check it asserts that: |
| 11 |
# - The variable does not take invalid inputs. |
| 12 |
# - The variable does not take over the max inputs. |
| 13 |
# - The variable does not take negative inputs. |
| 14 |
# - The variable can be set to valid value. |
| 15 |
# 3. Bootstrap M1 and start M2 to make them ONLINE. |
| 16 |
# 4. Assert that on running member variable cannot be changed. |
| 17 |
# 5. Check if two servers with and without fragmentation enabled are able to |
| 18 |
# exchange messages and still comunicate with each other. |
| 19 |
# 6. Confirm, in the error log, the servers start with the expected |
| 20 |
# fragmentation threshold. |
| 21 |
# 7. Cleanup |
| 22 |
################################################################################ |
| 23 |
|
| 24 |
--source include/have_group_replication_plugin.inc |
| 25 |
--let $rpl_skip_group_replication_start= 1 |
| 26 |
--source include/group_replication.inc |
| 27 |
|
| 28 |
--let $sound_threshold= 50000 |
| 29 |
--let $double_sound_threshold= `SELECT $sound_threshold * 2` |
| 30 |
--let $half_sound_threshold= `SELECT $sound_threshold / 2` |
| 31 |
--let $default_threshold= 10485760 |
| 32 |
--let $incorrect_threshold= "AAAA" |
| 33 |
--let $overflow_threshold= 4294967297 |
| 34 |
--let $negative_threshold= -1 |
| 35 |
|
| 36 |
--echo ######################################################################### |
| 37 |
--echo # 1. When GROUP is OFFLINE, set variable group_replication_communication_max_message_size to 0, i.e. disabled. |
| 38 |
# make sure that fragmentation is disabled |
| 39 |
# disable compression to be sure fragmentation kicks in |
| 40 |
--let $rpl_connection_name= server2 |
| 41 |
--source include/rpl_connection.inc |
| 42 |
|
| 43 |
--let $saved_threshold_2= `SELECT @@group_replication_communication_max_message_size` |
| 44 |
SET GLOBAL group_replication_communication_max_message_size= 0; |
| 45 |
--let $saved_compression_2= `SELECT @@group_replication_compression_threshold` |
| 46 |
SET GLOBAL group_replication_compression_threshold= 0; |
| 47 |
|
| 48 |
--let $rpl_connection_name= server1 |
| 49 |
--source include/rpl_connection.inc |
| 50 |
|
| 51 |
--let $saved_threshold_1= `SELECT @@group_replication_communication_max_message_size` |
| 52 |
SET GLOBAL group_replication_communication_max_message_size= 0; |
| 53 |
--let $saved_compression_1= `SELECT @@group_replication_compression_threshold` |
| 54 |
SET GLOBAL group_replication_compression_threshold= 0; |
| 55 |
|
| 56 |
--echo ######################################################################### |
| 57 |
--echo # 2. Check it asserts that: |
| 58 |
--let $rpl_connection_name= server1 |
| 59 |
--source include/rpl_connection.inc |
| 60 |
|
| 61 |
--echo # 2.a. The variable does not take invalid inputs. |
| 62 |
--error ER_WRONG_TYPE_FOR_VAR |
| 63 |
--eval SET GLOBAL group_replication_communication_max_message_size=$incorrect_threshold |
| 64 |
|
| 65 |
--echo # 2.b. The variable does not take over the max inputs. |
| 66 |
--error ER_WRONG_VALUE_FOR_VAR |
| 67 |
--eval SET GLOBAL group_replication_communication_max_message_size=$overflow_threshold |
| 68 |
|
| 69 |
--echo # 2.c. The variable does not take negative inputs. |
| 70 |
--error ER_WRONG_VALUE_FOR_VAR |
| 71 |
--eval SET GLOBAL group_replication_communication_max_message_size=$negative_threshold |
| 72 |
|
| 73 |
--echo # 2.d. The variable can be set to DEFAULT. |
| 74 |
SET GLOBAL group_replication_communication_max_message_size=DEFAULT; |
| 75 |
|
| 76 |
# Assert that the threshold was actually changed |
| 77 |
--let $threshold= `SELECT @@group_replication_communication_max_message_size` |
| 78 |
--let $assert_cond= $threshold = $default_threshold |
| 79 |
--let $assert_text= Assert that communication_max_message_size was changed to the default value |
| 80 |
--source include/assert.inc |
| 81 |
|
| 82 |
--echo # 2.e. The variable can be set to a valid value. |
| 83 |
--eval SET GLOBAL group_replication_communication_max_message_size=$sound_threshold |
| 84 |
|
| 85 |
# Assert that the threshold was actually changed |
| 86 |
--let $threshold= `SELECT @@group_replication_communication_max_message_size` |
| 87 |
--let $assert_cond= $threshold = $sound_threshold |
| 88 |
--let $assert_text= Assert that communication_max_message_size was changed |
| 89 |
--source include/assert.inc |
| 90 |
|
| 91 |
--echo ######################################################################### |
| 92 |
--echo # 3. Bootstrap M1 and start M2 to make them ONLINE. |
| 93 |
# Start GR on server1 |
| 94 |
--source include/start_and_bootstrap_group_replication.inc |
| 95 |
|
| 96 |
# Start GR on server2 |
| 97 |
--let $rpl_connection_name= server2 |
| 98 |
--source include/rpl_connection.inc |
| 99 |
--source include/start_group_replication.inc |
| 100 |
|
| 101 |
# Go back to server1 |
| 102 |
--let $rpl_connection_name= server1 |
| 103 |
--source include/rpl_connection.inc |
| 104 |
|
| 105 |
--echo ######################################################################### |
| 106 |
--echo # 4. Assert that on running member variable cannot be changed. |
| 107 |
--error ER_GROUP_REPLICATION_RUNNING |
| 108 |
--eval SET GLOBAL group_replication_communication_max_message_size=$double_sound_threshold |
| 109 |
|
| 110 |
# Assert that the value remains unchanged since SET failed |
| 111 |
--let $threshold= `SELECT @@group_replication_communication_max_message_size` |
| 112 |
--let $assert_cond= $threshold = $sound_threshold |
| 113 |
--let $assert_text= Assert that the communication_max_message_size remains unchanged |
| 114 |
--source include/assert.inc |
| 115 |
|
| 116 |
--echo ######################################################################### |
| 117 |
--echo # 5. Check if two servers with and without fragmentation enabled are able to exchange messages and still comunicate with each other. |
| 118 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB) ENGINE=InnoDB; |
| 119 |
|
| 120 |
# This will trigger on the wire fragmentation since we are generating a row |
| 121 |
# larger than the fragment threshold |
| 122 |
--eval INSERT INTO t1 VALUES(1, REPEAT('A', $double_sound_threshold)) |
| 123 |
|
| 124 |
# This will not be fragmented on the wire |
| 125 |
--eval INSERT INTO t1 VALUES(2, 'B') |
| 126 |
|
| 127 |
--let $rpl_connection_name= server2 |
| 128 |
--source include/rpl_connection.inc |
| 129 |
|
| 130 |
--source include/rpl_sync.inc |
| 131 |
|
| 132 |
# Assert that fragmentation is disabled on server2 given that we had set |
| 133 |
# threshold to 0 earlier in the test |
| 134 |
--let $threshold= `SELECT @@group_replication_communication_max_message_size` |
| 135 |
--let $assert_cond= $threshold = 0 |
| 136 |
--let $assert_text= Assert that the communication_max_message_size is disabled |
| 137 |
--source include/assert.inc |
| 138 |
|
| 139 |
# Server2 has fragmentation disabled, so lets see if it |
| 140 |
# is able to speak with server1 which has fragmentation on |
| 141 |
--eval INSERT INTO t1 VALUES(3, REPEAT('C', $double_sound_threshold)) |
| 142 |
|
| 143 |
--source include/rpl_sync.inc |
| 144 |
|
| 145 |
# Assert that the data made it through |
| 146 |
--let $diff_tables= server1:test.t1,server2:test.t1 |
| 147 |
--source include/diff_tables.inc |
| 148 |
|
| 149 |
--echo ######################################################################### |
| 150 |
--echo # 6, Confirm, in the error log, the servers start with the expected fragmentation threshold. |
| 151 |
# Assert that GR on server1 was started with fragmentation enabled |
| 152 |
# It was only started once |
| 153 |
--let $assert_file=$MYSQLTEST_VARDIR/tmp/group_replication_fragmentation_options_mysqld.1.err |
| 154 |
--let $assert_text= Fragmentation was active and logged to the error log |
| 155 |
--let $assert_select=.*group_replication_communication_max_message_size: $sound_threshold.* |
| 156 |
--let $assert_count= 1 |
| 157 |
--source include/assert_grep.inc |
| 158 |
|
| 159 |
# Assert that GR on server1 was never started with fragmentation disabled |
| 160 |
--let $assert_file=$MYSQLTEST_VARDIR/tmp/group_replication_fragmentation_options_mysqld.1.err |
| 161 |
--let $assert_text= Fragmentation was disabled and logged to the error log |
| 162 |
--let $assert_select=.*group_replication_communication_max_message_size: 0.* |
| 163 |
--let $assert_count= 0 |
| 164 |
--source include/assert_grep.inc |
| 165 |
|
| 166 |
# Assert that GR on server2 was never started with fragmentation enabled |
| 167 |
--let $assert_file=$MYSQLTEST_VARDIR/tmp/group_replication_fragmentation_options_mysqld.2.err |
| 168 |
--let $assert_text= Fragmentation was always disabled |
| 169 |
--let $assert_select=.*group_replication_communication_max_message_size: 0.* |
| 170 |
--let $assert_count= 1 |
| 171 |
--source include/assert_grep.inc |
| 172 |
|
| 173 |
--echo ######################################################################### |
| 174 |
--echo # Clean up |
| 175 |
DROP TABLE t1; |
| 176 |
|
| 177 |
--source include/rpl_sync.inc |
| 178 |
|
| 179 |
# restore server1 |
| 180 |
--let $rpl_connection_name= server1 |
| 181 |
--source include/rpl_connection.inc |
| 182 |
|
| 183 |
--source include/stop_group_replication.inc |
| 184 |
--replace_result $saved_threshold_1 SAVED_VALUE |
| 185 |
--eval SET GLOBAL group_replication_communication_max_message_size= $saved_threshold_1 |
| 186 |
--replace_result $saved_compression_1 SAVED_VALUE |
| 187 |
--eval SET GLOBAL group_replication_compression_threshold= $saved_compression_1 |
| 188 |
--source include/start_group_replication.inc |
| 189 |
|
| 190 |
# restore server2 |
| 191 |
--let $rpl_connection_name= server2 |
| 192 |
--source include/rpl_connection.inc |
| 193 |
|
| 194 |
--source include/stop_group_replication.inc |
| 195 |
--replace_result $saved_threshold_2 SAVED_VALUE |
| 196 |
--eval SET GLOBAL group_replication_communication_max_message_size= $saved_threshold_2 |
| 197 |
--replace_result $saved_compression_2 SAVED_VALUE |
| 198 |
--eval SET GLOBAL group_replication_compression_threshold= $saved_compression_2 |
| 199 |
--source include/start_group_replication.inc |
| 200 |
|
| 201 |
# (looney toons music) th-th-th-that's all folks! |
| 202 |
--source include/group_replication_end.inc |