File: gr_received_sets_compatibility_member_accepted.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (168 lines) | stat: -rw-r--r-- 5,464 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
################################################################################
# Test that evaluates the safe guards that stop members from joining with
# transactions not present in the group.
#
# Here we test that a joiner can enter the group when it has more executed GTIDs
# than the group in its total, but the group has also some received transactions.
# In total the group has more transactions than the joiner, so it can join.
#
# Test guide:
#   0) The test requires three servers: M1, M2 and M3.
#   1) With all the 3 members ONLINE, create a table on M1. Check 4 transactions
#      belonging to the GROUP on M2 and M3. Block the applier on M2 so it can't
#      apply remote transactions.
#   2) Execute more transaction on M1. Check 6 transactions belonging to the
#      GROUP on M3 then make M3 leave.
#   3) Execute some more transactions and check M2 has applied none.
#   4) Remove M1.
#   5) Try add M3 back to the group. Check that M3 has more executed
#      transactions than M2. M3 can still join the group because M2 (the group)
#      has more transactions when we take into account its received
#      transactions. Start the applier on M2. Check M3 is ONLINE.
#   6) Clean up.
################################################################################

--source include/big_test.inc
--source include/have_debug_sync.inc
--let $group_replication_group_name= 3d4bc080-ec58-11e5-a837-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_server_count= 3
--source include/group_replication.inc

--echo #
--echo # Create a table for testing on server 1
--echo #

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;

--source include/rpl_sync.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc

--let $assert_text= Server 2 has 4 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc

--let $assert_text= Server 3 has 4 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc

--echo #
--echo # Step 1: Block the applier on server 2.
--echo #

--let $rpl_connection_name= server2
--source include/rpl_connection.inc

SET @@GLOBAL.DEBUG='+d,block_applier_updates';

--echo #
--echo # Step 2: Insert some transaction and remove server 3
--echo #

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);

--let $sync_slave_connection= server3
--source include/sync_slave_sql_with_master.inc

--let $assert_text= Server 3 has 6 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-6";
--source include/assert.inc

--source include/stop_group_replication.inc

--echo #
--echo # Step 3: Insert more transactions.
--echo # Assert that server 2 applied none
--echo #

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);


--let $rpl_connection_name= server2
--source include/rpl_connection.inc

--let $wait_condition= SELECT received_transaction_set="$group_replication_group_name:1-8" FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_applier';
--source include/wait_condition.inc

--let $assert_text= Server 2 has only 4 applied transactions.
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc

--echo #
--echo # Step 4: Remove server 1
--echo #

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--source include/stop_group_replication.inc

--echo #
--echo # Step 5: Try add server 3 back to the group.
--echo # Server 3 has more executed GTIDs, but server 2 has also retrieved GTIDs.
--echo #

--let $rpl_connection_name= server2
--source include/rpl_connection.inc

--let $assert_text= Server 2 has only 4 applied transactions.
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc

--let $assert_text= Server 3 has 6 applied transactions.
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-6";
--source include/assert.inc

--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--source include/start_group_replication_command.inc

--echo # Resume server 2 applier

--let $rpl_connection_name= server2
--source include/rpl_connection.inc

SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
SET @@GLOBAL.DEBUG='-d,block_applier_updates';
SET DEBUG_SYNC = "now SIGNAL resume_applier_read";

--let $rpl_connection_name= server3
--source include/rpl_connection.inc

--let $group_replication_member_state= ONLINE
--source include/gr_wait_for_member_state.inc

--echo #
--echo # Step 6: Cleanup
--echo #

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET DEBUG_SYNC= 'RESET';

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--source include/start_group_replication.inc

DROP TABLE t1;

--source include/group_replication_end.inc