Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate group_replication_consistency= 'AFTER' behaviour against member leaves,
3 # on the case on which the member that executes the transaction leaves the group.
4 #
5 # Test:
6 # 00. The test requires three servers: M1, M2 and M3.
7 # 01. Create a table on the group.
8 # 02. Make server3 block before send its prepare message. This
9 # will allow us to deterministically to remove server1 from
10 # the group while others are waiting for server3 acknowledge.
11 # 03. Execute T1 on server1.
12 # 04. Wait until T1 is prepared on server3.
13 # 05. Remove server1 from the group.
14 # 06. Wait until server1 is removed from the group.
15 # Make server3 do send its prepare message.
16 # 07. Validate data.
17 # 08. 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
31 SET SESSION sql_log_bin=0;
32 call mtr.add_suppression("Due to a plugin error, some transactions were unable to be certified and will now rollback.");
33 call mtr.add_suppression("Error while waiting for conflict detection procedure to finish on session .*");
34 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
35 SET SESSION sql_log_bin=1;
36
37 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
38
39
40 --echo
41 --echo ############################################################
42 --echo # 02. Make server3 block before send its prepare message. This
43 --echo # will allow us to deterministically to remove server1 from
44 --echo # the group while others are waiting for server3 acknowledge.
45 --let $rpl_connection_name= server3
46 --source include/rpl_connection.inc
47 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_before_message_send_after_applier_prepare';
48
49
50 --echo
51 --echo ############################################################
52 --echo # 03. Execute T1 on server1.
53 --let $rpl_connection_name= server1
54 --source include/rpl_connection.inc
55 --send INSERT INTO t1 VALUES (1)
56
57
58 --echo
59 --echo ############################################################
60 --echo # 04. Wait until T1 is prepared on server3.
61 --let $rpl_connection_name= server3
62 --source include/rpl_connection.inc
63 # Wait for the debug sync to be reached.
64 SET DEBUG_SYNC= "now WAIT_FOR signal.after_before_message_send_after_applier_prepare_waiting";
65
66
67 --echo
68 --echo ############################################################
69 --echo # 05. Remove server1 from the group.
70 --let $rpl_connection_name= server_1
71 --source include/rpl_connection.inc
72 --source include/stop_group_replication.inc
73
74
75 --echo
76 --echo ############################################################
77 --echo # 06. Wait until server1 is removed from the group.
78 --echo # Make server3 do send its prepare message.
79 --let $rpl_connection_name= server3
80 --source include/rpl_connection.inc
81 --let $group_replication_number_of_members= 2
82 --source include/gr_wait_for_number_of_members.inc
83
84 # Signal debug sync to continue.
85 SET DEBUG_SYNC= 'now SIGNAL signal.after_before_message_send_after_applier_prepare_continue';
86 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_before_message_send_after_applier_prepare';
87
88
89 --echo
90 --echo ############################################################
91 --echo # 07. Validate data.
92 --let $rpl_connection_name= server1
93 --source include/rpl_connection.inc
94 --error ER_RUN_HOOK_ERROR
95 --reap
96
97 --let $assert_text= 'There are no values in table t1'
98 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 0
99 --source include/assert.inc
100
101 --let $rpl_connection_name= server2
102 --source include/rpl_connection.inc
103 --let $assert_text= 'There is 1 value in table t1'
104 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
105 --source include/assert.inc
106
107 --let $rpl_connection_name= server3
108 --source include/rpl_connection.inc
109 --let $assert_text= 'There is 1 value in table t1'
110 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
111 --source include/assert.inc
112
113 --let $diff_tables=server2:t1, server3:t1
114 --source include/diff_tables.inc
115
116
117 --echo
118 --echo ############################################################
119 --echo # 08. Clean up.
120 --let $rpl_connection_name= server1
121 --source include/rpl_connection.inc
122 SET SESSION sql_log_bin=0;
123 DROP TABLE t1;
124 SET SESSION sql_log_bin=1;
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