Debian Codegraph @

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

raw
1 ################################################################################
2 # Check that pipeline errors are properly detected and handled.
3 #
4 # Test:
5 # 0. The test requires two servers: M1 and M2.
6 # 1. Setup a group with two members. Bootstrap group with M2. Start GR on M1.
7 # 2. Execute some transactions on M1 that will be applied through M2 Group
8 # Replication applier that is forced to fail using DEBUG point.
9 # - Wait until M2 Group Replication applier errors out.
10 # - Reset debug flag on M2.
11 # 3. Commit a transaction to validate that everything is OK.
12 # 4. Check that GTID_EXECUTED on M1 contains all transactions. Also check that
13 # data is on tables.
14 # 5. Check that GTID_EXECUTED on M2 contains all transactions. Also check that
15 # data is on tables.
16 # 6. Clean up.
17 ################################################################################
18 --source include/have_debug.inc
19 --source include/have_group_replication_plugin.inc
20
21 --echo
22 --echo ############################################################
23 --echo # 1. Setup a new group with two members.
24 --echo #
25 --let $rpl_skip_group_replication_start= 1
26 --source include/group_replication.inc
27
28 --let $rpl_connection_name= server2
29 --source include/rpl_connection.inc
30
31 SET SESSION sql_log_bin= 0;
32 call mtr.add_suppression("Failed to fetch transaction data containing required transaction info for applier");
33 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
34 call mtr.add_suppression("Error at event handling! Got error: 1");
35 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
36 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
37 SET SESSION sql_log_bin= 1;
38
39 --source include/start_and_bootstrap_group_replication.inc
40
41 --echo ############################################################
42 --echo # 2. Execute some transactions on member 1 that will be
43 --echo # applied through member 2 Group Replication applier
44 --echo # that is forced to fail.
45 --echo #
46 --let $rpl_connection_name= server1
47 --source include/rpl_connection.inc
48 --source include/start_group_replication.inc
49
50 --echo
51 --echo # On member 2 we force a pipeline error on applier
52 --echo # handler.
53 --let $rpl_connection_name= server2
54 --source include/rpl_connection.inc
55 SET @debug_saved= @@GLOBAL.DEBUG;
56 SET @@GLOBAL.DEBUG= '+d,applier_handler_force_error_on_pipeline';
57
58 --let $rpl_connection_name= server1
59 --source include/rpl_connection.inc
60 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
61
62 --echo
63 --echo # Wait until member 2 Group Replication applier errors out.
64 --echo #
65 --let $rpl_connection_name= server2
66 --source include/rpl_connection.inc
67
68 --let $wait_condition= SELECT service_state="OFF" FROM performance_schema.replication_applier_status WHERE channel_name="group_replication_applier"
69 --source include/wait_condition.inc
70
71 --echo
72 --echo # Reset debug flag.
73 --echo #
74 --source include/stop_group_replication.inc
75 SET @@GLOBAL.DEBUG= @debug_saved;
76 --source include/start_group_replication.inc
77
78 --echo
79 --echo ############################################################
80 --echo # 3. Commit a transaction to validate that everything is OK
81 --echo #
82 --let $rpl_connection_name= server1
83 --source include/rpl_connection.inc
84 INSERT INTO t1 VALUES (1);
85 --source include/rpl_sync.inc
86
87
88 --echo
89 --echo ############################################################
90 --echo # 4. Check that GTID_EXECUTED on server 1 contains all
91 --echo # transactions.
92 --echo # Also check that data is on tables.
93 --let $rpl_connection_name= server1
94 --source include/rpl_connection.inc
95 --let $assert_text= GTID_EXECUTED must contain all committed GTIDs
96 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-5"
97 --source include/assert.inc
98
99 --let $assert_text= 'There is a value 1 in table t1'
100 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
101 --source include/assert.inc
102
103
104 --echo
105 --echo ############################################################
106 --echo # 5. Check that GTID_EXECUTED on server 2 contains all
107 --echo # transactions.
108 --echo # Also check that data is on tables.
109 --let $rpl_connection_name= server2
110 --source include/rpl_connection.inc
111 --let $assert_text= GTID_EXECUTED must contain all committed GTIDs
112 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-5"
113 --source include/assert.inc
114
115 --let $assert_text= 'There is a value 1 in table t1'
116 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
117 --source include/assert.inc
118
119
120 --echo
121 --echo ############################################################
122 --echo # 6. Test cleanup.
123 --echo #
124 DROP TABLE t1;
125 --source include/group_replication_end.inc