Debian Codegraph @

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