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

107 lines
5.5 KiB
Plaintext

################################################################################
# BUG#21162660 - CRASH AFTER FAILURE IN RELAY-LOG-RECOVERY, ON START GR COMMAND
#
# This test checks that a server restart with relay-log-recovery set to 1 will
# not cause any error during recovery as the group_replication channels are
# not used for this purpose.
#
# Test:
# 0. The test requires two servers: server1 and server2.
# 1. Setup group replication on two servers and make them ONLINE.
# 2. Restart server1 with relay-log-recovery=1. Then, check that on starting GR
# server doesn't crashes.
# 3. Assert check that start GR doesn't purge relay logs.
# 4. Restart server1 with relay-log-recovery=0. Then, check that on starting GR
# server doesn't crashes.
# 5. Assert check that start GR doesn't purge relay logs.
# 6. Check number of members in the group is 2. Add some data on server1 and
# validate that same data is available in server2.
# 7. Clean up.
################################################################################
--source include/big_test.inc
--let $group_replication_group_name= aaaabbbb-aabb-aabb-aabb-aaaaaabbbbbb
--source include/have_group_replication_plugin.inc
--source include/force_restart.inc
--source include/group_replication.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Previous relay log pos and relay log file had");
call mtr.add_suppression("Slave SQL for channel 'group_replication_applier': ... The slave coordinator and worker threads are stopped,*");
call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;
--let $server1_received_gtid= aaaabbbb-aabb-aabb-aabb-aaaaaabbbbbb:1-2
--echo # This will not generate error during relay log recovery on restart as relay log for group_replication channels are ignored.
--let $allow_rpl_inited=1
--let $rpl_server_number=1
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --relay-log-recovery=1
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
--source include/restart_mysqld.inc
--echo #No server crash here on starting group replication.
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc
--source include/start_group_replication.inc
--echo # Asserting that the successful start group_replication does not purge relay logs.
--let $server1_received_gtid_after_restart1= `SELECT RECEIVED_TRANSACTION_SET FROM performance_schema.replication_connection_status WHERE channel_name = "group_replication_applier"`
--let $assert_text= RECEIVED_GTID must be similar to the one before restart as the relay logs are not purged.
--let $assert_cond= "$server1_received_gtid_after_restart1"<>"$server1_received_gtid"
--source include/assert.inc
--echo # This restart will not generate any error as relay-log-recovery is OFF.
--let $allow_rpl_inited=1
--let $rpl_server_number=1
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --relay-log-recovery=0
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
--source include/restart_mysqld.inc
--echo #No server crash here on starting group replication.
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc
--source include/start_group_replication.inc
--echo # Asserting that the successful start group_replication does not purge relay logs.
--let $server1_received_gtid_after_restart2= `SELECT RECEIVED_TRANSACTION_SET FROM performance_schema.replication_connection_status WHERE channel_name = "group_replication_applier"`
--let $assert_text= RECEIVED_GTID must be similar to the one before restart as the relay logs are not purged.
--let $assert_cond= "$server1_received_gtid_after_restart2"<>"$server1_received_gtid"
--source include/assert.inc
--echo # Check that there are two members in the group currently.
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo # Adding some data to see if replication is working fine.
CREATE TABLE t1 (i INT PRIMARY KEY NOT NULL);
INSERT INTO t1 VALUES(1);
--source include/rpl_sync.inc
--echo # Checking the data in the two servers. It should be same.
--let $diff_tables= server1:test.t1, server2:test.t1
--source include/diff_tables.inc
--echo # Cleanup
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;
DROP TABLE t1;
--source include/group_replication_end.inc