Debian Codegraph @

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

raw
1 ################################################################################
2 # BUG#21162660 - CRASH AFTER FAILURE IN RELAY-LOG-RECOVERY, ON START GR COMMAND
3 #
4 # This test checks that a server restart with relay-log-recovery set to 1 will
5 # not cause any error during recovery as the group_replication channels are
6 # not used for this purpose.
7 #
8 # Test:
9 # 0. The test requires two servers: server1 and server2.
10 # 1. Setup group replication on two servers and make them ONLINE.
11 # 2. Restart server1 with relay-log-recovery=1. Then, check that on starting GR
12 # server doesn't crashes.
13 # 3. Assert check that start GR doesn't purge relay logs.
14 # 4. Restart server1 with relay-log-recovery=0. Then, check that on starting GR
15 # server doesn't crashes.
16 # 5. Assert check that start GR doesn't purge relay logs.
17 # 6. Check number of members in the group is 2. Add some data on server1 and
18 # validate that same data is available in server2.
19 # 7. Clean up.
20 ################################################################################
21
22 --source include/big_test.inc
23 --let $group_replication_group_name= aaaabbbb-aabb-aabb-aabb-aaaaaabbbbbb
24 --source include/have_group_replication_plugin.inc
25 --source include/force_restart.inc
26 --source include/group_replication.inc
27
28 --let $rpl_connection_name= server1
29 --source include/rpl_connection.inc
30 SET SESSION sql_log_bin= 0;
31 call mtr.add_suppression("Relay log recovery on channel with GTID_ONLY=1.*");
32 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped,*");
33 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
34 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
35 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
36 --source include/gtid_utils.inc
37 SET SESSION sql_log_bin= 1;
38 --let $server1_received_gtid= aaaabbbb-aabb-aabb-aabb-aaaaaabbbbbb:1-2
39
40 --echo # This will not generate error during relay log recovery on restart as relay log for group_replication channels are ignored.
41 --let $allow_rpl_inited=1
42 --let $rpl_server_number=1
43 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
44 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
45 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --relay-log-recovery=1
46 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
47 --source include/restart_mysqld.inc
48
49 --echo #No server crash here on starting group replication.
50 --let $rpl_server_number= 1
51 --source include/rpl_reconnect.inc
52
53 --source include/start_group_replication.inc
54
55 --echo # Asserting that the successful start group_replication does not purge relay logs.
56 --let $server1_received_gtid_after_restart1= `SELECT RECEIVED_TRANSACTION_SET FROM performance_schema.replication_connection_status WHERE channel_name = "group_replication_applier"`
57 --let $assert_text= RECEIVED_GTID must be similar to the one before restart as the relay logs are not purged.
58 --let $assert_cond= "$server1_received_gtid_after_restart1"<>"$server1_received_gtid"
59 --source include/assert.inc
60
61 --echo # This restart will not generate any error as relay-log-recovery is OFF.
62 --let $allow_rpl_inited=1
63 --let $rpl_server_number=1
64 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
65 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
66 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --relay-log-recovery=0
67 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
68 --source include/restart_mysqld.inc
69
70 --echo #No server crash here on starting group replication.
71 --let $rpl_server_number= 1
72 --source include/rpl_reconnect.inc
73
74 --source include/start_group_replication.inc
75
76 --echo # Asserting that the successful start group_replication does not purge relay logs.
77 --let $server1_received_gtid_after_restart2= `SELECT RECEIVED_TRANSACTION_SET FROM performance_schema.replication_connection_status WHERE channel_name = "group_replication_applier"`
78 --let $assert_text= RECEIVED_GTID must be similar to the one before restart as the relay logs are not purged.
79 --let $assert_cond= "$server1_received_gtid_after_restart2"<>"$server1_received_gtid"
80 --source include/assert.inc
81
82 --echo # Check that there are two members in the group currently.
83 --let $group_replication_number_of_members= 2
84 --source include/gr_wait_for_number_of_members.inc
85
86 --let $rpl_connection_name= server1
87 --source include/rpl_connection.inc
88 --echo # Adding some data to see if replication is working fine.
89 CREATE TABLE t1 (i INT PRIMARY KEY NOT NULL);
90 INSERT INTO t1 VALUES(1);
91
92 --source include/rpl_sync.inc
93
94 --echo # Checking the data in the two servers. It should be same.
95 --let $diff_tables= server1:test.t1, server2:test.t1
96 --source include/diff_tables.inc
97
98 --echo # Cleanup
99 --let $rpl_connection_name= server1
100 --source include/rpl_connection.inc
101 SET SESSION sql_log_bin= 0;
102 --source include/gtid_utils_end.inc
103 SET SESSION sql_log_bin= 1;
104 DROP TABLE t1;
105
106 --source include/group_replication_end.inc