Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that recovery errors are properly reported between attempts on
3 # performance_schema.replication_applier_status_by_worker and SHOW SLAVE STATUS.
4 #
5 # Test:
6 # 0. The test requires two servers: M1 and M2.
7 # 1. Bootstrap group on server1 and create table t1 on it.
8 # 2. Create the same table t1 on server1 and then join it to
9 # the group, recovery will fail.
10 # Assert that error is visible on
11 # performance_schema.replication_applier_status_by_worker
12 # and SHOW SLAVE STATUS between retry attempts.
13 # 3. Clean up.
14 ################################################################################
15 --source include/have_group_replication_plugin.inc
16 --let $rpl_skip_group_replication_start= 1
17 --source include/group_replication.inc
18
19
20 --echo
21 --echo ############################################################
22 --echo # 1. Bootstrap group on server1 and create table t1 on it.
23 --let $rpl_connection_name= server1
24 --source include/rpl_connection.inc
25 --source include/start_and_bootstrap_group_replication.inc
26 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
27
28
29 --echo
30 --echo ############################################################
31 --echo # 2. Create the same table t1 on server1 and then join it to
32 --echo # the group, recovery will fail.
33 --echo # Assert that error is visible on
34 --echo # performance_schema.replication_applier_status_by_worker
35 --echo # and SHOW SLAVE STATUS between retry attempts.
36 --let $rpl_connection_name= server2
37 --source include/rpl_connection.inc
38 SET SESSION sql_log_bin= 0;
39 call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Worker [0-9] failed executing transaction .*; Error 'Table 't1' already exists' on query.*");
40 call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Error 'Table 't1' already exists' on query.*");
41 call mtr.add_suppression("Replica: Table 't1' already exists Error_code: MY-001050");
42 call mtr.add_suppression("Error while starting the group replication incremental recovery receiver/applier threads");
43
44 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
45 SET SESSION sql_log_bin= 1;
46
47 SET @group_replication_recovery_reconnect_interval_save= @@GLOBAL.group_replication_recovery_reconnect_interval;
48 # Increase the reconnect interval to avoid reconnects on slow machines.
49 SET GLOBAL group_replication_recovery_reconnect_interval= 3600;
50
51 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
52 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
53 START GROUP_REPLICATION;
54
55 --echo # Wait until the error is reported on performance_schema.replication_applier_status_by_worker table
56 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_applier_status_by_worker WHERE channel_name='group_replication_recovery' AND last_error_number=1050;
57 --source include/wait_condition.inc
58
59 --let $last_errno = query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery', Last_Errno, 1)
60 --let $assert_text= Recovery channel error is reported on Last_Errno
61 --let $assert_cond= $last_errno = 1050
62 --source include/assert.inc
63
64 --let $last_sql_errno = query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery', Last_SQL_Errno, 1)
65 --let $assert_text= Recovery channel error is reported on Last_SQL_Errno
66 --let $assert_cond= $last_sql_errno = 1050
67 --source include/assert.inc
68
69 --let $server2_uuid= `SELECT @@server_uuid`
70 --let $assert_text= MEMBER_STATE is RECOVERING
71 --let $assert_cond= "[SELECT MEMBER_STATE FROM performance_schema.replication_group_members WHERE MEMBER_ID=\'$server2_uuid\', MEMBER_STATE, 1]" = "RECOVERING"
72 --source include/assert.inc
73
74 --source include/stop_group_replication.inc
75 SET GLOBAL group_replication_recovery_reconnect_interval= @group_replication_recovery_reconnect_interval_save;
76
77
78 --echo
79 --echo ############################################################
80 --echo # 3. Clean up.
81 --let $rpl_connection_name= server2
82 --source include/rpl_connection.inc
83 SET SESSION sql_log_bin= 0;
84 DROP TABLE t1;
85 SET SESSION sql_log_bin= 1;
86
87 --let $rpl_connection_name= server1
88 --source include/rpl_connection.inc
89 DROP TABLE t1;
90
91 --source include/group_replication_end.inc