Debian Codegraph @

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

raw
1 ################################################################################
2 # This test validates that Group Replication does support events checksums on
3 # all binary and relay logs, with the exception of the relay logs of
4 # group_replication_applier channel
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. Start GR on server1 and create a table.
9 # 2. Start GR on server2.
10 # 3. Validate that server2 recovery channel relay logs have
11 # checksums.
12 # 4. Execute a new transaction on server1 and validate that
13 # server2 applier channel relay logs do not have checksums.
14 # 5. Validate that server2 binary log have checksums.
15 # 6. Validate that server1 binary log have checksums.
16 # 7. Clean up.
17 ################################################################################
18 --source include/have_debug.inc
19 --source include/have_group_replication_plugin.inc
20 --let $rpl_skip_group_replication_start= 1
21 --source include/group_replication.inc
22 --let $output_file = $MYSQLTEST_VARDIR/tmp/gr-checksum-dump-file
23 --let $_binlog_compression_enable= `SELECT @@GLOBAL.binlog_transaction_compression`
24
25
26 --echo
27 --echo ############################################################
28 --echo # 1. Start GR on server1 and create a table.
29 --let $rpl_connection_name= server1
30 --source include/rpl_connection.inc
31 --source include/start_and_bootstrap_group_replication.inc
32 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
33
34
35 --echo
36 --echo ############################################################
37 --echo # 2. Start GR on server2.
38 --echo # Disable recovery channel relay logs purge through a debug flag.
39 --let $rpl_connection_name= server2
40 --source include/rpl_connection.inc
41 SET GLOBAL debug= '+d,gr_recovery_skip_purge_logs';
42 --source include/start_group_replication.inc
43 SET GLOBAL debug= '-d,gr_recovery_skip_purge_logs';
44
45
46 --echo
47 --echo ############################################################
48 --echo # 3. Validate that server2 recovery channel relay logs have
49 --echo # checksums.
50 --let $datadir= `SELECT @@datadir`
51 --let $mysqlbinlog_parameters= $datadir/server-relay-log-group_replication_recovery.000003
52 --let $mysqlbinlog_pipe= > $output_file 2>&1
53 --source include/mysqlbinlog.inc
54
55 --let $assert_file= $output_file
56 --let $assert_count = 15
57 --let $assert_select = .*CRC32 0x\w+.*
58 --let $assert_text = recovery channel relay logs have checksums
59 --source include/assert_grep.inc
60
61
62 --echo
63 --echo ############################################################
64 --echo # 4. Execute a new transaction on server1 and validate that
65 --echo # server2 applier channel relay logs do not have checksums.
66 --let $rpl_connection_name= server1
67 --source include/rpl_connection.inc
68 INSERT INTO t1 VALUES (1);
69 --source include/rpl_sync.inc
70
71 --let $rpl_connection_name= server2
72 --source include/rpl_connection.inc
73 --let $datadir= `SELECT @@datadir`
74 --let $mysqlbinlog_parameters= $datadir/server-relay-log-group_replication_applier.000002
75 --let $mysqlbinlog_pipe= > $output_file 2>&1
76 --source include/mysqlbinlog.inc
77
78 --let $assert_file= $output_file
79 --let $assert_count = 0
80 --let $assert_select = .*CRC32 0x\w+.*
81 --let $assert_text = applier channel relay logs do not have checksums
82 --source include/assert_grep.inc
83
84
85 --echo
86 --echo ############################################################
87 --echo # 5. Validate that server2 binary log have checksums.
88 --let $rpl_connection_name= server2
89 --source include/rpl_connection.inc
90 --let $datadir= `SELECT @@datadir`
91 --let $mysqlbinlog_parameters= $datadir/server-binary-log.000001
92 --let $mysqlbinlog_pipe= > $output_file 2>&1
93 --source include/mysqlbinlog.inc
94
95 --let $assert_file= $output_file
96 --let $assert_count = 17
97 if ($_binlog_compression_enable == 1) {
98 --let $assert_count = 18
99 }
100 --let $assert_select = .*CRC32 0x\w+.*
101 --let $assert_text = binary log have checksums
102 --source include/assert_grep.inc
103
104
105 --echo
106 --echo ############################################################
107 --echo # 6. Validate that server1 binary log have checksums.
108 --let $rpl_connection_name= server1
109 --source include/rpl_connection.inc
110 --let $datadir= `SELECT @@datadir`
111 --let $mysqlbinlog_parameters= $datadir/server-binary-log.000001
112 --let $mysqlbinlog_pipe= > $output_file 2>&1
113 --source include/mysqlbinlog.inc
114
115 --let $assert_file= $output_file
116 --let $assert_count = 17
117 if ($_binlog_compression_enable == 1) {
118 --let $assert_count = 18
119 }
120 --let $assert_select = .*CRC32 0x\w+.*
121 --let $assert_text = binary log have checksums
122 --source include/assert_grep.inc
123
124
125 --echo
126 --echo ############################################################
127 --echo # 7. Clean up.
128 --remove_file $output_file
129 DROP TABLE t1;
130 --source include/group_replication_end.inc