Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that GR behaves properly when group GNOs are exhausted.
3 # MAX_GNO: 9223372036854775807
4 #
5 # Test:
6 # 0. The test requires two servers: M1 and M2.
7 # 1. Create a table t1 on both M1 and M2, before starting GR. Validate that
8 # transactions are aborted on local member and remote members move to ERROR
9 # state when group GNOs are exhausted:
10 # - Set GTID_PURGED=GROUP_UUID:1-9223372036854775804 on M1.
11 # - Bootstrap start GR on M1. Verify GTID_EXECUTED on M1.
12 # - Set GTID_PURGED=GROUP_UUID:1-9223372036854775804 on M2.
13 # - Start GR on M2. Verify GTID_EXECUTED on M2.
14 # - On M1, verify that DML execution failed because GNOs are exhausted.
15 # - On M2, verify that member_state is now ERROR.
16 # - Verify GTID_EXECUTED=GROUP_UUID:1-9223372036854775806 on both M1 and M2.
17 # - Stop GR on M1 and M2.
18 # 2. Validate that member start moves to ERROR state when GNOs are exhausted:
19 # - Set GTID_PURGED=GROUP_UUID:1-9223372036854775806 on M1.
20 # - Bootstrap start GR on M1. Verify that member_state is ERROR on M1.
21 # - Stop GR on M1.
22 # 3. Validate that member start moves to ERROR state when GNOs are exhausted on
23 # view change log:
24 # - Set GTID_PURGED=GROUP_UUID:1-9223372036854775804 on M1.
25 # - Bootstrap start GR on M1. Verify GTID_EXECUTED on M1.
26 # - Set GTID_PURGED=GROUP_UUID:1-9223372036854775804 on M2.
27 # - Start GR on M2. Verify GTID_EXECUTED on M2.
28 # - Stop GR on M2. Verify that member_state is ERROR on M1 due to view change
29 # log event.
30 # - Verify GTID_EXECUTED=GROUP_UUID:1-9223372036854775806 on M1. Stop GR on M1.
31 # 4. Clean up.
32 ################################################################################
33 --source include/big_test.inc
34 --let $group_replication_group_name= c234f752-1ee4-11e6-adee-00212844d44e
35 --source include/have_group_replication_plugin.inc
36 --let $rpl_skip_group_replication_start= 1
37 --source include/group_replication.inc
38
39
40 # Suppressions and table creation.
41 --let $rpl_connection_name= server1
42 --source include/rpl_connection.inc
43 SET SESSION sql_log_bin= 0;
44 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
45 call mtr.add_suppression("Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the group with a new group_replication_group_name.");
46 call mtr.add_suppression("Error at event handling! Got error: 1");
47 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
48 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
49 call mtr.add_suppression("The member is leaving a group without being on one.");
50 call mtr.add_suppression("The member is already leaving or joining a group.");
51 call mtr.add_suppression("Unable to ensure the execution of group transactions received during recovery.");
52 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
53 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
54 call mtr.add_suppression("Skipping leave operation: member already left the group.");
55 call mtr.add_suppression("The integer component of the GTID number is high.");
56 SET SESSION sql_log_bin= 1;
57 --let $rpl_connection_name= server2
58 --source include/rpl_connection.inc
59 SET SESSION sql_log_bin= 0;
60 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
61 call mtr.add_suppression("Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the group with a new group_replication_group_name.");
62 call mtr.add_suppression("Error at event handling! Got error: 1");
63 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
64 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
65 call mtr.add_suppression("All donors left. Aborting group replication incremental recovery.");
66 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
67 call mtr.add_suppression("The member is leaving a group without being on one.");
68 call mtr.add_suppression("The member is already leaving or joining a group.");
69 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
70 call mtr.add_suppression("Skipping leave operation: member already left the group.");
71 call mtr.add_suppression("The integer component of the GTID number is high.");
72 SET SESSION sql_log_bin= 1;
73
74
75 --echo
76 --echo ############################################################
77 --echo # 1. Validate that transactions are aborted on local member
78 --echo # and remote members move to ERROR state when group GNOs
79 --echo # are exhausted.
80 # Set GTID_EXECUTED and start server 1.
81 --let $rpl_connection_name= server1
82 --source include/rpl_connection.inc
83 --eval SET GLOBAL GTID_PURGED= "$group_replication_group_name:1-9223372036854775804"
84 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775804
85 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775804"
86 --source include/assert.inc
87
88 --source include/start_and_bootstrap_group_replication.inc
89 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775805
90 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775805"
91 --source include/assert.inc
92
93 # Set GTID_EXECUTED and start server 2.
94 --let $rpl_connection_name= server2
95 --source include/rpl_connection.inc
96 --eval SET GLOBAL GTID_PURGED= "$group_replication_group_name:1-9223372036854775804"
97 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775804
98 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775804"
99 --source include/assert.inc
100
101 --source include/start_group_replication.inc
102 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775806
103 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775806"
104 --source include/assert.inc
105
106 # Exhaust GNOs.
107 --let $rpl_connection_name= server1
108 --source include/rpl_connection.inc
109 --error ER_TRANSACTION_ROLLBACK_DURING_COMMIT
110 INSERT INTO t1 VALUES (1);
111 --let $wait_condition= SELECT @@GLOBAL.GTID_EXECUTED = "$group_replication_group_name:1-9223372036854775806"
112 --source include/wait_condition.inc
113
114 --let $rpl_connection_name= server2
115 --source include/rpl_connection.inc
116 --let $group_replication_member_state= ERROR
117 --source include/gr_wait_for_member_state.inc
118 --let $wait_condition= SELECT @@GLOBAL.GTID_EXECUTED = "$group_replication_group_name:1-9223372036854775806"
119 --source include/wait_condition.inc
120 --source include/stop_group_replication.inc
121
122 --let $rpl_connection_name= server1
123 --source include/rpl_connection.inc
124 --source include/stop_group_replication.inc
125
126
127 --echo
128 --echo ############################################################
129 --echo # 2. Validate that member start moves to ERROR state when
130 --echo # group GNOs are exhausted.
131 RESET MASTER;
132 --eval SET GLOBAL GTID_PURGED= "$group_replication_group_name:1-9223372036854775806"
133 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775806
134 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775806"
135 --source include/assert.inc
136
137 --source include/gr_set_bootstrap_group.inc
138 --let $group_replication_start_member_state= ERROR
139 --source include/start_group_replication.inc
140 --source include/gr_clear_bootstrap_group.inc
141
142 --let $wait_condition= SELECT @@GLOBAL.GTID_EXECUTED = "$group_replication_group_name:1-9223372036854775806"
143 --source include/wait_condition.inc
144
145 --source include/stop_group_replication.inc
146
147
148 --echo ############################################################
149 --echo # 3. Validate that member moves to ERROR state when group
150 --echo # GNOs are exhausted on view change log.
151 # Set GTID_EXECUTED and start server 1.
152 --let $rpl_connection_name= server1
153 --source include/rpl_connection.inc
154 RESET MASTER;
155 --eval SET GLOBAL GTID_PURGED= "$group_replication_group_name:1-9223372036854775805"
156 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775805
157 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775805"
158 --source include/assert.inc
159
160 --source include/start_and_bootstrap_group_replication.inc
161 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775806
162 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775806"
163 --source include/assert.inc
164
165 # Set GTID_EXECUTED and start server 2.
166 --let $rpl_connection_name= server2
167 --source include/rpl_connection.inc
168 RESET MASTER;
169 --eval SET GLOBAL GTID_PURGED= "$group_replication_group_name:1-9223372036854775805"
170 --let $assert_text= GTID_EXECUTED must be UUID:1-9223372036854775805
171 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-9223372036854775805"
172 --source include/assert.inc
173
174 # Server 2 joins the group.
175 # Since server 1 cannot log the new view change event it will leave the group
176 # Server 2 will leave the group as there are no available donors.
177 --let $group_replication_start_member_state= ERROR
178 --source include/start_group_replication.inc
179
180 # Server2 GTIDs cannot be checked, because server1 may send some data on recovery
181 # but it can also leave before that.
182
183 --source include/stop_group_replication.inc
184
185 # On server 1 view change log event is tried to be logged, what will exhaust group GNOs.
186 --let $rpl_connection_name= server1
187 --source include/rpl_connection.inc
188 --let $group_replication_member_state= ERROR
189 --source include/gr_wait_for_member_state.inc
190
191 --let $wait_condition= SELECT @@GLOBAL.GTID_EXECUTED = "$group_replication_group_name:1-9223372036854775806"
192 --source include/wait_condition.inc
193 --source include/stop_group_replication.inc
194
195
196 --echo
197 --echo ############################################################
198 --echo # 4. Clean up.
199 --let $rpl_connection_name= server2
200 --source include/rpl_connection.inc
201 RESET MASTER;
202 --source include/start_and_bootstrap_group_replication.inc
203 --let $rpl_connection_name= server1
204 --source include/rpl_connection.inc
205 RESET MASTER;
206 --source include/start_group_replication.inc
207
208 --let $rpl_connection_name= server1
209 --source include/rpl_connection.inc
210 SET SESSION sql_log_bin= 0;
211 DROP TABLE t1;
212 SET SESSION sql_log_bin= 1;
213
214 --let $rpl_connection_name= server2
215 --source include/rpl_connection.inc
216 SET SESSION sql_log_bin= 0;
217 DROP TABLE t1;
218 SET SESSION sql_log_bin= 1;
219
220 --source include/group_replication_end.inc