225 lines
7.0 KiB
Plaintext
225 lines
7.0 KiB
Plaintext
################################################################################
|
|
# 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
|