File: gr_set_gtid_next.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 (214 lines) | stat: -rw-r--r-- 8,915 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
################################################################################
# WL#6833: GCS Replication: Read-set free Certification
#          Module (DBSM Snapshot Isolation)
#
# Scenario 1: Set GTID_NEXT on a client session
#
# Verify Group Replication behaviour when a GTID_NEXT is
# specified on a transaction.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. With both members ONLINE. Execute some transactions on M1 with and without
#    GTID_NEXT specified.
# 2. Execute some transactions on M2 with and without GTID_NEXT specified.
# 3. Check that GTID_EXECUTED on M1 contains all transactions. Also check that
#    data is on tables.
# 4. Check that GTID_EXECUTED on M2 contains all transactions. Also check that
#    data is on tables.
# 5. Wait for stable set propagation and certification info garbage collection.
# 6. Check that stable set and certification info size are properly updated
#    after stable set propagation and certification info garbage collection on
#    M1.
# 7. Check that stable set and certification info size are properly updated
#    after stable set propagation and certification info garbage collection on
#    M2.
# 8. Clean up.
################################################################################

--source include/big_test.inc
--source include/have_group_replication_gtid_assignment_block_size_1.inc
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429489
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc

# Keep binary logs with only GTIDs from test.
--connection server1
SET SESSION sql_log_bin= 0;
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;
--connection server2
SET SESSION sql_log_bin= 0;
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;

--let $expected_gtid_set= "8a94f357-aab4-11df-86ab-c80aa9429489:1-6,aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1-2,bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb:1-3"


--echo
--echo ############################################################
--echo # 1. Execute some transactions on server 1 with and without
--echo #    GTID specified.
--connection server1
--eval SET GTID_NEXT= '$uuida:1'
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET GTID_NEXT= 'AUTOMATIC';

INSERT INTO t1 VALUES (1);


--echo
--echo ############################################################
--echo # 2. Execute some transactions on server 2  with and without
--echo #    GTID specified (including empty transactions).
--connection server2
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;

--source include/rpl_sync.inc
--eval SET GTID_NEXT= '$uuida:2'
INSERT INTO t1 VALUES (2);
SET GTID_NEXT= 'AUTOMATIC';

--eval SET GTID_NEXT= '$uuidb:1'
INSERT INTO t2 VALUES (1);
SET GTID_NEXT= 'AUTOMATIC';

--eval SET GTID_NEXT= '$uuidb:2'
INSERT INTO t2 VALUES (2);
SET GTID_NEXT= 'AUTOMATIC';

--eval SET GTID_NEXT= '$uuidb:3'
BEGIN;
COMMIT;
SET GTID_NEXT= 'AUTOMATIC';

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

--source include/rpl_sync.inc


--echo
--echo ############################################################
--echo # 3. Check that GTID_EXECUTED on server 1 contains all
--echo #    transactions.
--echo #    Also check that data is on tables.
--connection server1
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, $expected_gtid_set)
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 2 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 3 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 3, count, 1] = 1
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 2 in table t2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 2, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 3 in table t2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 3, count, 1] = 1
--source include/assert.inc


--echo
--echo ############################################################
--echo # 4. Check that GTID_EXECUTED on server 2 contains all
--echo #    transactions.
--echo #    Also check that data is on tables.
--connection server2
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, $expected_gtid_set)
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 2 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 3 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 3, count, 1] = 1
--source include/assert.inc

--let $assert_text= 'There is a value 1 in table t2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 2 in table t2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 2, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 3 in table t2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2 WHERE t2.c1 = 3, count, 1] = 1
--source include/assert.inc


--echo
--echo ############################################################
--echo # 5. Wait for stable set propagation and certification info
--echo #    garbage collection.
--connection server1
--let $wait_timeout= 65
--let $wait_condition= SELECT Transactions_committed_all_members<>"" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)
--source include/wait_condition.inc


--echo
--echo ############################################################
--echo # 6. Check that stable set and certification info size are
--echo #    properly updated after stable set propagation and
--echo #    certification info garbage collection on server 1.
--connection server1

--let $count_transactions_validating= query_get_value(SELECT Count_transactions_rows_validating from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Count_transactions_rows_validating, 1)
--let $assert_text= 'Count_transactions_rows_validating must be 1'
--let $assert_cond= $count_transactions_validating = 1
--source include/assert.inc

--let $transactions_committed_all_members= query_get_value(SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Transactions_committed_all_members, 1)
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED'
--let $assert_cond= GTID_IS_EQUAL("$transactions_committed_all_members", $expected_gtid_set)
--source include/assert.inc


--echo
--echo ############################################################
--echo # 7. Check that stable set and certification info size are
--echo #    properly updated after stable set propagation and
--echo #    certification info garbage collection on server 2.
--connection server2

--let $count_transactions_validating= query_get_value(SELECT Count_transactions_rows_validating from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Count_transactions_rows_validating, 1)
--let $assert_text= 'Count_transactions_rows_validating must be 1'
--let $assert_cond= $count_transactions_validating = 1
--source include/assert.inc

--let $transactions_committed_all_members= query_get_value(SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Transactions_committed_all_members, 1)
--let $assert_text= 'Transactions_committed_all_members must be equal to GTID_EXECUTED'
--let $assert_cond= GTID_IS_EQUAL("$transactions_committed_all_members", $expected_gtid_set)
--source include/assert.inc


--echo
--echo ############################################################
--echo # 8. Shutdown.
DROP TABLE t1;
DROP TABLE t2;

--connection server1
SET SESSION sql_log_bin= 0;
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;
--connection server2
SET SESSION sql_log_bin= 0;
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;

--source include/group_replication_end.inc