polardbxengine/mysql-test/suite/group_replication/t/gr_default_table_encryption...

106 lines
3.9 KiB
Plaintext

################################################################################
# Validates that a member can only join a group when both the group and the new
# member have the value on the default_table_encryption global server option.
#
# Test:
# 0. This test requires 2 members.
# 1. Bootstrap a group on server 1 with
# GLOBAL.default_table_encryption = ON
# 2. Try join a member with
# GLOBAL.default_table_encryption = OFF
# to the group, it shall fail.
# 3. Try join a member with
# GLOBAL.default_table_encryption = ON
# to the group, it shall succeed.
# 4. Try to change GLOBAL.default_table_encryption while
# Group Replication is running, it shall fail.
# 5. Try to change SESSION.default_table_encryption while
# Group Replication is running, it shall succeed.
# 6. Try to PERSIST default_table_encryption while
# Group Replication is running, it shall fail.
# 7. Cleanup.
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--echo
--echo ############################################################
--echo # 1. Bootstrap a group on server 1 with
--echo # GLOBAL.default_table_encryption = ON
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @table_encryption_default= @@GLOBAL.default_table_encryption;
SET @@GLOBAL.default_table_encryption = ON;
--source include/start_and_bootstrap_group_replication.inc
--echo
--echo ############################################################
--echo # 2. Try join a member with
--echo # GLOBAL.default_table_encryption = OFF
--echo # to the group, it shall fail.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET SESSION sql_log_bin = 0;
call mtr.add_suppression("The member is configured with a default_table_encryption option value '0' different from the group '1'. The member will now exit the group.");
SET SESSION sql_log_bin = 1;
--disable_query_log
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--enable_query_log
SET @table_encryption_default= @@GLOBAL.default_table_encryption;
SET @@GLOBAL.default_table_encryption = OFF;
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--echo
--echo ############################################################
--echo # 3. Try join a member with
--echo # GLOBAL.default_table_encryption = ON
--echo # to the group, it shall succeed.
SET @@GLOBAL.default_table_encryption = ON;
--source include/start_group_replication.inc
--echo
--echo ############################################################
--echo # 4. Try to change GLOBAL.default_table_encryption while
--echo # Group Replication is running, it shall fail.
--error ER_GROUP_REPLICATION_RUNNING
SET @@GLOBAL.default_table_encryption = OFF;
--echo
--echo ############################################################
--echo # 5. Try to change SESSION.default_table_encryption while
--echo # Group Replication is running, it shall succeed.
SET @@SESSION.default_table_encryption = OFF;
--echo
--echo ############################################################
--echo # 6. Try to PERSIST default_table_encryption while
--echo # Group Replication is running, it shall fail.
--error ER_GROUP_REPLICATION_RUNNING
SET PERSIST default_table_encryption=ON;
--echo
--echo ############################################################
--echo # 7. Clean up.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
SET @@GLOBAL.default_table_encryption= @table_encryption_default;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
SET @@GLOBAL.default_table_encryption= @table_encryption_default;
SET @@SESSION.default_table_encryption= @table_encryption_default;
--source include/group_replication_end.inc