File: gr_binlog_checksum_mixed.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 (209 lines) | stat: -rw-r--r-- 7,053 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
################################################################################
# This test validates that Group Replication can have members with different
# binlog_checksum configuration.
#
# Test:
# 0. The test requires two servers: M1 and M2.
#
# Check that a member with binlog_checksum= NONE can join a group
# with binlog_checksum= CRC32.
#  1. Set binlog_checksum to CRC32 and start GR on server1.
#  2. Set binlog_checksum to NONE and start GR on server2.
#  3. Commit data on both members, all is OK.
#  4. Validate that server1 binary log has checksums.
#  5. Validate that server2 binary log does not have checksums.
#
# Check that a member with binlog_checksum= CRC32 can join a group
# with binlog_checksum= NONE.
#  6. Set binlog_checksum to NONE and start GR on server1.
#  7. Set binlog_checksum to CRC32 and start GR on server2.
#  8. Commit data on both members, all is OK.
#  9. Validate that server1 binary log does not have checksums.
#  10. Validate that server2 binary log has checksums.
#
# 11. Clean up.
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--let $output_file = $MYSQLTEST_VARDIR/tmp/gr-checksum-dump-file
--let $_binlog_compression_enable= `SELECT @@GLOBAL.binlog_transaction_compression`


--echo
--echo ############################################################
--echo #  1. Set binlog_checksum to CRC32 and start GR on server1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @binlog_checksum_saved= @@GLOBAL.binlog_checksum;
SET @@GLOBAL.binlog_checksum= CRC32;

--source include/start_and_bootstrap_group_replication.inc
# This will be sent to server2 through recovery.
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);


--echo
--echo ############################################################
--echo #  2. Set binlog_checksum to NONE and start GR on server2.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @binlog_checksum_saved= @@GLOBAL.binlog_checksum;
SET @@GLOBAL.binlog_checksum= NONE;

--source include/start_group_replication.inc


--echo
--echo ############################################################
--echo #  3. Commit data on both members, all is OK.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (1);

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (2);

--source include/rpl_sync.inc
--let $assert_text= 'There are 2 rows in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2
--source include/assert.inc

--let $diff_tables=server1:t1, server2:t1
--source include/diff_tables.inc


--echo ############################################################
--echo #  4. Validate that server1 binary log has checksums.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $datadir= `SELECT @@datadir`
--let $mysqlbinlog_parameters= $datadir/server-binary-log.000002
--let $mysqlbinlog_pipe= > $output_file 2>&1
--source include/mysqlbinlog.inc

--let $assert_file= $output_file
--let $assert_count = 22
if ($_binlog_compression_enable == 1) {
  --let $assert_count = 24
}
--let $assert_select = .*CRC32 0x\w+.*
--let $assert_text = binary log have checksums
--source include/assert_grep.inc

--source include/stop_group_replication.inc


--echo
--echo ############################################################
--echo #  5. Validate that server2 binary log does not have checksums.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $datadir= `SELECT @@datadir`
--let $mysqlbinlog_parameters= $datadir/server-binary-log.000002
--let $mysqlbinlog_pipe= > $output_file 2>&1
--source include/mysqlbinlog.inc

--let $assert_file= $output_file
--let $assert_count = 0
--let $assert_select = .*CRC32 0x\w+.*
--let $assert_text = binary log does not have checksums
--source include/assert_grep.inc

--source include/stop_group_replication.inc


--echo
--echo ############################################################
--echo #  6. Set binlog_checksum to NONE and start GR on server1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@GLOBAL.binlog_checksum= NONE;

--source include/start_and_bootstrap_group_replication.inc
# This will be sent to server2 through recovery.
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY);


--echo
--echo ############################################################
--echo #  7. Set binlog_checksum to CRC32 and start GR on server2.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @@GLOBAL.binlog_checksum= CRC32;

--source include/start_group_replication.inc


--echo
--echo ############################################################
--echo #  8. Commit data on both members, all is OK.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
INSERT INTO t2 VALUES (1);

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
INSERT INTO t2 VALUES (2);

--source include/rpl_sync.inc
--let $assert_text= 'There are 2 rows in table t2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t2, count, 1] = 2
--source include/assert.inc

--let $diff_tables=server1:t1, server2:t1
--source include/diff_tables.inc


--echo ############################################################
--echo #  9. Validate that server1 binary log does not have checksums.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $datadir= `SELECT @@datadir`
--let $mysqlbinlog_parameters= $datadir/server-binary-log.000003
--let $mysqlbinlog_pipe= > $output_file 2>&1
--source include/mysqlbinlog.inc

--let $assert_file= $output_file
--let $assert_count = 0
--let $assert_select = .*CRC32 0x\w+.*
--let $assert_text = binary log does not have checksums
--source include/assert_grep.inc


--echo
--echo ############################################################
--echo #  10. Validate that server2 binary log has checksums.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $datadir= `SELECT @@datadir`
--let $mysqlbinlog_parameters= $datadir/server-binary-log.000003
--let $mysqlbinlog_pipe= > $output_file 2>&1
--source include/mysqlbinlog.inc

--let $assert_file= $output_file
--let $assert_count = 22
if ($_binlog_compression_enable == 1) {
  --let $assert_count = 24
}
--let $assert_select = .*CRC32 0x\w+.*
--let $assert_text = binary log have checksums
--source include/assert_grep.inc


--echo
--echo ############################################################
--echo # 11. Clean up.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@GLOBAL.binlog_checksum = @binlog_checksum_saved;

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @@GLOBAL.binlog_checksum = @binlog_checksum_saved;

--remove_file $output_file
DROP TABLE t1;
DROP TABLE t2;
--source include/group_replication_end.inc