Debian Codegraph @

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

raw
1 ################################################################################
2 #Bug#24665506 MEMBER RESTART WHILE DML ON GROUP RESULTS IN RESTARTED MEMBER
3 # RECOVERING FOREVER
4 # Problem: If the group replication is stopped while the node is downloading
5 # partial transaction data, starting the group replication is
6 # hanging forever.
7 #
8 # # Test:
9 # 0. The test requires three servers: M1, M2 and M3.
10 # 1. Create a basic table on all three servers.
11 # 2. On M2: To replicate a partial transaction downloaded scenario,
12 # setup a debug point to bring down the applier channel
13 # if it receives a Write_rows_log_event and restart the
14 # group replication to make the debug point effective.
15 # 3. On M1: Execute an insert and wait till M2 goes offline
16 # (because of the above debug point, applier channel will
17 # go down after receiving Write_rows_log_event).
18 # 4. On M2: Reset the debug point and restart the group replication in order
19 # to download the transaction into the new relay log file fully.
20 # 5. On M1: Insert another tuple and do a diff tables with other nodes.
21 # (just to check that everything is working fine).
22 # 6. Cleanup.
23 ################################################################################
24 --source include/big_test.inc
25 --source include/have_debug.inc
26
27 # skip this test if compression is enabled.
28 # This test requires that inspection is done on a per event basis
29 # on the applier, and act when a Write_rows_log_event is received.
30 # With compression, a full transaction is commpressed inside a
31 # Transaction_payload event, thence no partial transaction can be
32 # received and handled at the expected point in time in the pipeline.
33 --source include/not_binlog_transaction_compression_on.inc
34
35 --source include/have_group_replication_plugin.inc
36
37 --echo ########################################################################
38 --echo # 0. The test requires three servers: M1, M2 and M3.
39 --let $rpl_server_count= 3
40 --source include/group_replication.inc
41
42 --echo ########################################################################
43 --echo # 1. Create a basic table on all three servers.
44 --let $rpl_connection_name= server1
45 --source include/rpl_connection.inc
46 CREATE TABLE t1(a INT PRIMARY KEY);
47 --source include/rpl_sync.inc
48
49 --let $rpl_connection_name= server2
50 --source include/rpl_connection.inc
51 SET sql_log_bin=0;
52 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication.");
53 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
54 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
55 call mtr.add_suppression("The replica coordinator and worker threads are stopped");
56 SET sql_log_bin=1;
57
58 --echo ########################################################################
59 --echo # 2. On M2: To replicate a partial transaction downloaded scenario,
60 --echo # setup a debug point to bring down the applier channel
61 --echo # if it receives a Write_rows_log_event and restart the
62 --echo # group replication to make the debug point effective.
63 SET GLOBAL DEBUG="+d,stop_applier_channel_after_reading_write_rows_log_event";
64 --source include/stop_group_replication.inc
65 --source include/start_group_replication.inc
66
67 --echo ########################################################################
68 --echo # 3. On M1: Execute an insert and wait till M2 goes offline
69 --echo # (because of the above debug point, applier channel will
70 --echo # go down after receiving Write_rows_log_event).
71 --let $rpl_connection_name= server1
72 --source include/rpl_connection.inc
73 INSERT INTO t1 values (12);
74
75 --let $wait_condition= SELECT COUNT(*) = 2 FROM performance_schema.replication_group_members WHERE member_state='ONLINE';
76 --source include/wait_condition.inc
77
78 --echo ########################################################################
79 --echo # 4. On M2: Reset the debug point and restart the group replication in
80 --echo # order to download the transaction into the new relay log
81 --echo # file fully.
82 --let $rpl_connection_name= server2
83 --source include/rpl_connection.inc
84 SET GLOBAL DEBUG="-d,stop_applier_channel_after_reading_write_rows_log_event";
85
86 # In case MTS, applier coordinator thread will wait for 60 seconds to get the
87 # remaining group of events. Setting the timeout to a bigger number to avoid
88 # time out on pb2 machines.
89 --let $wait_timeout=120
90 --source include/stop_group_replication.inc
91
92 --let $wait_timeout=120
93 --source include/start_group_replication.inc
94
95 --let $assert_text= Certifier broadcast thread must be running
96 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.threads WHERE name = "thread/group_rpl/THD_certifier_broadcast"] = 1
97 --source include/assert.inc
98
99 --echo ########################################################################
100 --echo # 5. On M1: Insert another tuple and do a diff tables with other nodes.
101 --echo # (just to check that everything is working fine).
102 --let $rpl_connection_name= server1
103 --source include/rpl_connection.inc
104 INSERT INTO t1 values (13);
105 --source include/rpl_sync.inc
106
107 --let $diff_tables=server1:t1, server2:t1, server3:t1
108 --source include/diff_tables.inc
109
110 --echo ################
111 --echo # 6. Cleanup.
112 DROP TABLE t1;
113 --source include/group_replication_end.inc