Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate group_replication_consistency= 'AFTER' behaviour against member leaves.
3 #
4 # Test:
5 # 00. The test requires three servers: M1, M2 and M3.
6 # 01. Create a table on the group.
7 # 02. Make server3 block before send its prepare message. This
8 # will allow us to deterministically remove it from the
9 # group while others are waiting for its acknowledge.
10 # The not acknowledged transaction must rollback on server3.
11 # 03. Execute T1 on server1.
12 # 04. Wait until T1 is prepared on server3.
13 # 05. Make server3 do not send its prepare message and remove
14 # it from the group.
15 # 06. Wait until server3 is removed from the group. T1 will
16 # commit on server 1 and 2.
17 # 07. Clean up.
18 ################################################################################
19 --source include/big_test.inc
20 --source include/have_debug_sync.inc
21 --source include/have_group_replication_plugin.inc
22 --let $rpl_server_count= 3
23 --source include/group_replication.inc
24
25 --echo
26 --echo ############################################################
27 --echo # 01. Create a table on the group.
28 --let $rpl_connection_name= server1
29 --source include/rpl_connection.inc
30 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
31
32
33 --echo
34 --echo ############################################################
35 --echo # 02. Make server3 block before send its prepare message. This
36 --echo # will allow us to deterministically remove it from the
37 --echo # group while others are waiting for its acknowledge.
38 --echo # The not acknowledged transaction must rollback on server3.
39 --let $rpl_connection_name= server3
40 --source include/rpl_connection.inc
41 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_supress_message_send_after_applier_prepare';
42
43 SET SESSION sql_log_bin= 0;
44 call mtr.add_suppression("Due to a plugin error, some transactions were unable to be certified and will now rollback.");
45 call mtr.add_suppression("Plugin group_replication reported: 'Error on transaction '.*:5' from session '.*' while waiting for being prepared on all group members.");
46 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
47 call mtr.add_suppression("Replica: Error on observer while running replication hook 'before_commit'. Error_code: MY-003100");
48 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Error in Xid_log_event: Commit could not be completed, 'Error on observer while running replication hook 'before_commit'.', Error_code: MY-003100");
49 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Worker 1 failed executing transaction '.*:5'; Error on observer while running replication hook 'before_commit'. Error_code: MY-003100");
50 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped.*");
51 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
52 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
53 call mtr.add_suppression("Plugin group_replication reported: 'Skipping leave operation: concurrent attempt to leave the group is on-going.");
54 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
55 SET SESSION sql_log_bin= 1;
56
57
58 --echo
59 --echo ############################################################
60 --echo # 03. Execute T1 on server1.
61 --let $rpl_connection_name= server1
62 --source include/rpl_connection.inc
63 --send INSERT INTO t1 VALUES (1)
64
65
66 --echo
67 --echo ############################################################
68 --echo # 04. Wait until T1 is prepared on server3.
69 --let $rpl_connection_name= server3
70 --source include/rpl_connection.inc
71 # Wait for the debug sync to be reached.
72 SET DEBUG_SYNC= "now WAIT_FOR signal.after_supress_message_send_after_applier_prepare_waiting";
73
74
75 --echo
76 --echo ############################################################
77 --echo # 05. Make server3 do not send its prepare message and remove
78 --echo # it from the group.
79 --let $rpl_connection_name= server3
80 --source include/rpl_connection.inc
81 # Signal debug sync to continue.
82 SET DEBUG_SYNC= 'now SIGNAL signal.after_supress_message_send_after_applier_prepare_continue';
83 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_supress_message_send_after_applier_prepare';
84
85 --source include/stop_group_replication.inc
86
87 --let $assert_text= 'There are no values in table t1'
88 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 0
89 --source include/assert.inc
90
91
92 --echo
93 --echo ############################################################
94 --echo # 06. Wait until server3 is removed from the group. T1 will
95 --echo # commit on server 1 and 2.
96 --let $rpl_connection_name= server_1
97 --source include/rpl_connection.inc
98 --let $group_replication_number_of_members= 2
99 --source include/gr_wait_for_number_of_members.inc
100
101 --let $rpl_connection_name= server1
102 --source include/rpl_connection.inc
103 --reap
104
105 --let $assert_text= 'There is 1 value in table t1'
106 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
107 --source include/assert.inc
108
109 --let $rpl_connection_name= server2
110 --source include/rpl_connection.inc
111 --let $assert_text= 'There is 1 value in table t1'
112 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
113 --source include/assert.inc
114
115 --let $diff_tables=server1:t1, server2:t1
116 --source include/diff_tables.inc
117
118
119 --echo
120 --echo ############################################################
121 --echo # 07. Clean up.
122 --let $rpl_connection_name= server1
123 --source include/rpl_connection.inc
124 DROP TABLE t1;
125
126 --let $rpl_connection_name= server3
127 --source include/rpl_connection.inc
128 DROP TABLE t1;
129
130 --source include/group_replication_end.inc