1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
|
################################################################################
# WL#9052 - GCS compression options
#
# This test case checks compression options for group replication
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. When GROUP is OFFLINE. Set variable group_replication_compression_threshold
# to 0 i.e. disabled.
# 2. Check it asserts that:
# - The variable does not take invalid inputs.
# - The variable does not take over the max inputs.
# - The variable does not take negative inputs.
# - The variable can be set to valid value.
# - The default value is 0.
# 3. Set variable to valid value. Bootstrap M1 and start M2 to make them ONLINE.
# 4. Assert that on running member variable cannot be changed.
# 5. Then the test checks if two servers with and without compression enabled
# are able to exchange messages and still comunicate with each other.
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--let $saved_threshold= `SELECT @@group_replication_compression_threshold`
--let $sound_threshold= 512
--let $double_sound_threshold= `SELECT $sound_threshold * 2`
--let $half_sound_threshold= `SELECT $sound_threshold / 2`
--let $default_threshold= 1000000
--let $incorrect_threshold= "AAAA"
--let $overflow_threshold= 4294967297
--let $negative_threshold= -1
##
## Set group_replication_compression_threshold to 0 initially on both
## servers
##
# make sure that compression is disabled
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL group_replication_compression_threshold= 0;
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET GLOBAL group_replication_compression_threshold= 0;
##
## Perform tests
##
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
#
# Assert that the wrong input results in an error
#
--error ER_WRONG_TYPE_FOR_VAR
--eval SET GLOBAL group_replication_compression_threshold=$incorrect_threshold
#
# Assert that a wrong value - over the max - for the variable results in an error
#
--error ER_WRONG_VALUE_FOR_VAR
--eval SET GLOBAL group_replication_compression_threshold=$overflow_threshold
#
# Assert that a wrong value - lower than the minimum results in an error
#
--error ER_WRONG_VALUE_FOR_VAR
--eval SET GLOBAL group_replication_compression_threshold=$negative_threshold
#
# Assert that we can set compression to a sound value
#
--eval SET GLOBAL group_replication_compression_threshold=$sound_threshold
#
# Assert that the threshold was actually changed
#
--let $threshold= `SELECT @@group_replication_compression_threshold`
--let $assert_cond= $threshold = $sound_threshold
--let $assert_text= Assert that the compression_threshold is set to the default
--source include/assert.inc
#
# We are not allowed to use DEFAULT as a value.
#
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL group_replication_compression_threshold=DEFAULT;
##
## Now lets test with the system running
##
--eval SET GLOBAL group_replication_compression_threshold=$sound_threshold
## Start GR on server1
--source include/start_and_bootstrap_group_replication.inc
## Start GR on server2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
## Go back to server1
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
#
# Assert that we cannot change the variable while group replication
# is running
#
--error ER_GROUP_REPLICATION_RUNNING
--eval SET GLOBAL group_replication_compression_threshold=$double_sound_threshold
#
# Assert that despite the error the value remains unchanged
#
--let $threshold= `SELECT @@group_replication_compression_threshold`
--let $assert_cond= $threshold = $sound_threshold
--let $assert_text= Assert that the compression_threshold remains unchanged
--source include/assert.inc
##
## Now lets verify that the data goes across, both when it
## is compressed and not compressed
##
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB) ENGINE=InnoDB;
## This will trigger on the wire compression since we are generating
## a row insert larger than the compression threshold
--eval INSERT INTO t1 VALUES(1, REPEAT('A', $double_sound_threshold))
## This will not be compressed on the wire
--eval INSERT INTO t1 VALUES(2, REPEAT('B', $half_sound_threshold))
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/rpl_sync.inc
#
# Assert that compression is disabled on server2
# given that we had set threshold to 0 earlier in the test
#
--let $threshold= `SELECT @@group_replication_compression_threshold`
--let $assert_cond= $threshold = 0
--let $assert_text= Assert that the compression_threshold is disabled
--source include/assert.inc
# Server2 has no compression enabled, so lets see if it
# is able to speak with server1 which has compression on
--eval INSERT INTO t1 VALUES(3, REPEAT('C', $double_sound_threshold))
--source include/rpl_sync.inc
#
# Assert that the data made it through
#
--let $diff_tables= server1:test.t1,server2:test.t1
--source include/diff_tables.inc
#
# One last assert - entries in the error log are correct
#
#
# Assert that GR on server1 was started with compression enabled
# It was only started once
#
--let $assert_file=$MYSQLTEST_VARDIR/tmp/group_replication_compression_options_mysqld.1.err
--let $assert_text= LZ4 compression was active and logged to the error log
--let $assert_select=.*group_replication_compression_threshold: 512.*
--let $assert_count= 1
--source include/assert_grep.inc
#
# Assert that GR on server1 was never started with compression disabled
#
--let $assert_file=$MYSQLTEST_VARDIR/tmp/group_replication_compression_options_mysqld.1.err
--let $assert_text= LZ4 compression was disabled and logged to the error log
--let $assert_select=.*group_replication_compression_threshold: 0.*
--let $assert_count= 0
--source include/assert_grep.inc
#
# Assert that GR on server2 was never started with compression enabled
# It was started twice, btw
#
--let $assert_file=$MYSQLTEST_VARDIR/tmp/group_replication_compression_options_mysqld.2.err
--let $assert_text= LZ4 compression was disabled always
--let $assert_select=.*group_replication_compression_threshold: 0.*
--let $assert_count= 1
--source include/assert_grep.inc
##
## Clean up
##
DROP TABLE t1;
--source include/rpl_sync.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--replace_result $saved_threshold SAVED_THRESHOLD
--eval SET GLOBAL group_replication_compression_threshold= $saved_threshold
--source include/start_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--replace_result $saved_threshold SAVED_THRESHOLD
--eval SET GLOBAL group_replication_compression_threshold= $saved_threshold
--source include/start_group_replication.inc
## This is the end... My only friend the end!
--source include/group_replication_end.inc
|