| 1 |
# |
| 2 |
# The test checks that basic DDL and DML events are encrypted |
| 3 |
# in the binary log on master. |
| 4 |
# The test is to be run with all binlog formats |
| 5 |
# (combinations for rpl_init.inc take care of that). |
| 6 |
# |
| 7 |
# |
| 8 |
# The test runs with the encrypted master and non-encrypted slave. |
| 9 |
# It generates a sequence of events on master, and checks that |
| 10 |
# - all events are encrypted on master; |
| 11 |
# - slave is able to replicate from the master; |
| 12 |
# - relay logs and binary logs are not encrypted on slave. |
| 13 |
# |
| 14 |
# The same exercise is repeated |
| 15 |
# - without annotated binlog events and without binlog checksums; |
| 16 |
# - with binlog checksums; |
| 17 |
# - with annotated events and binlog checksums; |
| 18 |
# - with annotated events, default checksums and minimal binlog row image |
| 19 |
# |
| 20 |
|
| 21 |
--source include/long_test.inc |
| 22 |
# The test can take very long time with valgrind |
| 23 |
--source include/not_valgrind.inc |
| 24 |
|
| 25 |
--source include/have_partition.inc |
| 26 |
--source encryption_algorithms.inc |
| 27 |
--source include/have_innodb.inc |
| 28 |
--enable_connect_log |
| 29 |
|
| 30 |
--echo ################# |
| 31 |
--echo # Initialization |
| 32 |
--echo ################# |
| 33 |
|
| 34 |
--disable_connect_log |
| 35 |
--let $rpl_topology= 1->2 |
| 36 |
--source include/rpl_init.inc |
| 37 |
--enable_connect_log |
| 38 |
|
| 39 |
# We stop SQL thread because we want to have |
| 40 |
# all relay logs at the end of the test flow |
| 41 |
|
| 42 |
--connection server_2 |
| 43 |
--disable_connect_log |
| 44 |
--source include/stop_slave_sql.inc |
| 45 |
--enable_connect_log |
| 46 |
|
| 47 |
--connection server_1 |
| 48 |
|
| 49 |
SET @binlog_annotate_row_events.save= @@global.binlog_annotate_row_events; |
| 50 |
SET @binlog_checksum.save= @@global.binlog_checksum; |
| 51 |
SET @master_verify_checksum.save= @@global.master_verify_checksum; |
| 52 |
SET @binlog_row_image.save= @@global.binlog_row_image; |
| 53 |
|
| 54 |
--echo #################################################### |
| 55 |
--echo # Test 1: simple binlog, no checksum, no annotation |
| 56 |
--echo #################################################### |
| 57 |
|
| 58 |
--connection server_1 |
| 59 |
|
| 60 |
SET binlog_annotate_row_events= 0; |
| 61 |
SET GLOBAL binlog_annotate_row_events= 0; |
| 62 |
SET GLOBAL binlog_checksum= NONE; |
| 63 |
SET GLOBAL master_verify_checksum= 0; |
| 64 |
|
| 65 |
--source testdata.inc |
| 66 |
|
| 67 |
--echo #################################################### |
| 68 |
--echo # Test 2: binlog with checksum, no annotated events |
| 69 |
--echo #################################################### |
| 70 |
|
| 71 |
--connection server_1 |
| 72 |
|
| 73 |
SET binlog_annotate_row_events= 0; |
| 74 |
SET GLOBAL binlog_annotate_row_events= 0; |
| 75 |
SET GLOBAL binlog_checksum= CRC32; |
| 76 |
SET GLOBAL master_verify_checksum= 1; |
| 77 |
|
| 78 |
--source testdata.inc |
| 79 |
|
| 80 |
--echo #################################################### |
| 81 |
--echo # Test 3: binlog with checksum and annotated events |
| 82 |
--echo #################################################### |
| 83 |
|
| 84 |
--connection server_1 |
| 85 |
|
| 86 |
SET binlog_annotate_row_events= 1; |
| 87 |
SET GLOBAL binlog_annotate_row_events= 1; |
| 88 |
SET GLOBAL binlog_checksum= CRC32; |
| 89 |
SET GLOBAL master_verify_checksum= 1; |
| 90 |
|
| 91 |
--source testdata.inc |
| 92 |
|
| 93 |
--echo #################################################### |
| 94 |
--echo # Test 4: binlog with annotated events and binlog_row_image=minimal |
| 95 |
--echo #################################################### |
| 96 |
|
| 97 |
--connection server_1 |
| 98 |
|
| 99 |
SET binlog_annotate_row_events= 1; |
| 100 |
SET GLOBAL binlog_annotate_row_events= 1; |
| 101 |
SET GLOBAL binlog_checksum= NONE; |
| 102 |
SET GLOBAL master_verify_checksum= 0; |
| 103 |
SET GLOBAL binlog_row_image= MINIMAL; |
| 104 |
SET binlog_row_image= MINIMAL; |
| 105 |
|
| 106 |
--source testdata.inc |
| 107 |
|
| 108 |
--echo ############################# |
| 109 |
--echo # Final checks for the master |
| 110 |
--echo ############################# |
| 111 |
|
| 112 |
--let $master_datadir= `SELECT @@datadir` |
| 113 |
|
| 114 |
--let SEARCH_RANGE = 500000 |
| 115 |
--let SEARCH_FILE= $master_datadir/master-bin.0* |
| 116 |
--let SEARCH_PATTERN= _to_encrypt.* |
| 117 |
--source include/search_pattern_in_file.inc |
| 118 |
|
| 119 |
--let SEARCH_FILE= $master_datadir/master-bin.0* |
| 120 |
--let SEARCH_PATTERN= COMMIT.* |
| 121 |
--source include/search_pattern_in_file.inc |
| 122 |
|
| 123 |
--let SEARCH_FILE= $master_datadir/master-bin.0* |
| 124 |
--let SEARCH_PATTERN= TIMESTAMP.* |
| 125 |
--source include/search_pattern_in_file.inc |
| 126 |
|
| 127 |
--disable_connect_log |
| 128 |
--source include/save_master_pos.inc |
| 129 |
--enable_connect_log |
| 130 |
|
| 131 |
--echo ############################# |
| 132 |
--echo # Final checks for the slave |
| 133 |
--echo ############################# |
| 134 |
|
| 135 |
# Wait for the IO thread to write everything to relay logs |
| 136 |
|
| 137 |
--connection server_2 |
| 138 |
|
| 139 |
--let $slave_datadir= `SELECT @@datadir` |
| 140 |
|
| 141 |
--disable_connect_log |
| 142 |
--source include/sync_io_with_master.inc |
| 143 |
|
| 144 |
# Check that relay logs are unencrypted |
| 145 |
|
| 146 |
--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* |
| 147 |
--let SEARCH_PATTERN= _to_encrypt.* |
| 148 |
--source include/search_pattern_in_file.inc |
| 149 |
|
| 150 |
--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* |
| 151 |
--let SEARCH_PATTERN= COMMIT.* |
| 152 |
--source include/search_pattern_in_file.inc |
| 153 |
|
| 154 |
--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0* |
| 155 |
--let SEARCH_PATTERN= TIMESTAMP.* |
| 156 |
--source include/search_pattern_in_file.inc |
| 157 |
|
| 158 |
|
| 159 |
# Re-enable SQL thread, let it catch up with IO thread |
| 160 |
# and check slave binary logs |
| 161 |
|
| 162 |
--source include/start_slave.inc |
| 163 |
--source include/sync_slave_sql_with_io.inc |
| 164 |
--enable_connect_log |
| 165 |
|
| 166 |
--let SEARCH_FILE= $slave_datadir/slave-bin.0* |
| 167 |
--let SEARCH_PATTERN= _to_encrypt.* |
| 168 |
--source include/search_pattern_in_file.inc |
| 169 |
|
| 170 |
--let SEARCH_FILE= $slave_datadir/slave-bin.0* |
| 171 |
--let SEARCH_PATTERN= COMMIT.* |
| 172 |
--source include/search_pattern_in_file.inc |
| 173 |
|
| 174 |
--let SEARCH_FILE= $slave_datadir/slave-bin.0* |
| 175 |
--let SEARCH_PATTERN= TIMESTAMP.* |
| 176 |
--source include/search_pattern_in_file.inc |
| 177 |
|
| 178 |
--echo ########## |
| 179 |
--echo # Cleanup |
| 180 |
--echo ########## |
| 181 |
|
| 182 |
--connection server_1 |
| 183 |
SET GLOBAL binlog_annotate_row_events= @binlog_annotate_row_events.save; |
| 184 |
SET GLOBAL binlog_checksum= @binlog_checksum.save; |
| 185 |
SET GLOBAL master_verify_checksum= @master_verify_checksum.save; |
| 186 |
SET GLOBAL binlog_row_image= @binlog_row_image.save; |
| 187 |
|
| 188 |
--disable_connect_log |
| 189 |
--source include/rpl_end.inc |