Debian Codegraph @

mysql-test/suite/rpl/t/rpl_binlog_compression_require_row_format.test

raw
1 #
2 # This file contains test cases that test a combination of binlog transaction
3 # compression and require row format on the applier.
4 #
5
6
7 #
8 # ==== Purpose ====
9 #
10 # The following test verifies that the applier configured with require_row_format=TRUE
11 # and binary log compression work together properly.
12 #
13 # ==== Implementation ====
14 #
15 # The test does:
16 # 1. configure require_row_format to TRUE on the slave
17 # 2. enables compression on the master
18 # 3. generate one large transaction on the master, which is compressed
19 # and as such, is put in the Transaction_payload_event envelope
20 # 4. assert that the right set of events are generated into the binary log
21 # 5. assert that the right set of events are copied to the relay log
22 # 6. assert that the events are applied successfully
23 # 7. assert that the content of the tables between master and slave match
24 # 8. assert that the slave's binary log shows the right set of events
25 # 9. clean up
26 #
27 # ==== References ====
28 #
29 # WL#3549: binlog compression
30 #
31
32 --source include/master-slave.inc
33 --source include/have_binlog_format_row.inc
34
35 # saves the current setting of keep_transaction_payload_events
36 # we will turn it on (even if they are disabled), so we can
37 # assert that show binlog events shall produce the expected
38 # output
39 --let $saved_keep_transaction_payload_events= $keep_transaction_payload_events
40 --let $keep_transaction_payload_events= 1
41
42 --source include/rpl_connection_master.inc
43 --let $saved_binlog_transaction_compression_master = `SELECT @@global.binlog_transaction_compression`
44
45 --source include/rpl_connection_slave.inc
46 --let $saved_binlog_transaction_compression_slave = `SELECT @@global.binlog_transaction_compression`
47
48 #
49 # enable compression for the slave applier threads
50 # enable require_row_format on the channel
51 #
52 --source include/stop_slave.inc
53 SET @@global.binlog_transaction_compression=TRUE;
54
55 --let $saved_change_master_require_row_format = `SELECT IF (require_row_format = 'YES', 1, 0) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME=''`
56 CHANGE REPLICATION SOURCE TO REQUIRE_ROW_FORMAT = 1 FOR CHANNEL '';
57 --source include/start_slave.inc
58
59 #
60 # Reset the master and enable compression
61 #
62
63 --source include/rpl_connection_master.inc
64 --source include/rpl_reset.inc
65
66 --source include/rpl_connection_master.inc
67 SET @@session.binlog_transaction_compression=TRUE;
68
69 --source include/rpl_connection_slave.inc
70 FLUSH LOGS;
71 --source include/rpl_connection_master.inc
72 FLUSH LOGS;
73
74 #
75 # Now, start the test
76 #
77
78 # 1. on master insert a large transaction
79 CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY, c2 LONGTEXT);
80 BEGIN;
81 --let $nrows = 10
82 while ($nrows > 0)
83 {
84 --eval INSERT INTO t1 VALUES ($nrows, REPEAT('a', 1000000))
85 --dec $nrows
86 }
87 COMMIT;
88 --let $checksum_master = query_get_value(CHECKSUM TABLE t1 EXTENDED, Checksum, 1)
89
90 # assert that SHOW BINLOG EVENTS shows the correct output
91 --echo BINLOG EVENTS on master [$compression_type]
92 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
93 --let $keep_transaction_payload_events = 1
94 --source include/show_binlog_events.inc
95
96 --source include/rpl_connection_slave.inc
97 --source include/start_slave_io.inc
98
99 # 2. make sure it is copied fine to the relay log
100 --source include/rpl_connection_master.inc
101 --source include/sync_slave_io_with_master.inc
102
103 # assert that SHOW RELAYLOG EVENTS shows the correct output
104 --echo RELAY LOG EVENTS for $compression_type
105 --let $binlog_file= LAST
106 --source include/show_relaylog_events.inc
107
108 # 3. make sure it is applied fine to the slave
109 --source include/start_slave_sql.inc
110 --source include/rpl_connection_master.inc
111 --source include/sync_slave_sql_with_master.inc
112
113 # 4. lets compare contents of the table on master and slave
114 --let $checksum_slave = query_get_value(CHECKSUM TABLE t1 EXTENDED, Checksum, 1)
115
116 # 5. assert that tables have the same contents
117 # We use checksums, because the diff_tables requires
118 # modifications to the sort_buffer_size.
119 # Plain selects cause a valgrind warning in temp tables...
120 --let $assert_cond= $checksum_master = $checksum_slave
121 --let $assert_text= Assert that master and slave tables have the same content
122 --source include/assert.inc
123
124 # assert that SHOW BINLOG EVENTS shows the correct output
125 --echo BINLOG EVENTS on slave contain compressed events
126 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
127 --let $keep_transaction_payload_events = 1
128 --source include/show_binlog_events.inc
129
130 # 6. clean up the test database
131 --source include/rpl_connection_master.inc
132 DROP TABLE t1;
133 --source include/sync_slave_sql_with_master.inc
134
135 # If we got here, then transaction boundary parser has
136 # worked fine with compression and require_row_format
137
138 #
139 # Clean up: reset variables and channel
140 #
141 --let $keep_transaction_payload_events= $saved_keep_transaction_payload_events
142 --let $saved_keep_transaction_payload_events=
143
144 --source include/rpl_connection_master.inc
145 --replace_result $saved_binlog_transaction_compression_master SAVED
146 --eval SET @@global.binlog_transaction_compression=$saved_binlog_transaction_compression_master
147
148 --source include/rpl_connection_slave.inc
149 --replace_result $saved_binlog_transaction_compression_slave SAVED
150 --eval SET @@global.binlog_transaction_compression=$saved_binlog_transaction_compression_slave
151 --source include/stop_slave.inc
152 --replace_result $saved_change_master_require_row_format SAVED
153 --eval CHANGE REPLICATION SOURCE TO REQUIRE_ROW_FORMAT=$saved_change_master_require_row_format
154 --source include/start_slave.inc
155
156 --source include/rpl_connection_master.inc
157 --source include/rpl_reset.inc
158
159 #
160 # =========================
161 # End of test case
162 # =========================
163
164 # end the test case
165 --source include/rpl_end.inc