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
|
#
# The test checks that basic DDL and DML events are encrypted
# in the binary log on master.
# The test is to be run with all binlog formats
# (combinations for rpl_init.inc take care of that).
#
#
# The test runs with the encrypted master and non-encrypted slave.
# It generates a sequence of events on master, and checks that
# - all events are encrypted on master;
# - slave is able to replicate from the master;
# - relay logs and binary logs are not encrypted on slave.
#
# The same exercise is repeated
# - without annotated binlog events and without binlog checksums;
# - with binlog checksums;
# - with annotated events and binlog checksums;
# - with annotated events, default checksums and minimal binlog row image
#
--source include/long_test.inc
# The test can take very long time with valgrind
--source include/not_valgrind.inc
--source include/have_partition.inc
--source encryption_algorithms.inc
--source include/have_innodb.inc
--enable_connect_log
--echo #################
--echo # Initialization
--echo #################
--disable_connect_log
--let $rpl_topology= 1->2
--source include/rpl_init.inc
--enable_connect_log
# We stop SQL thread because we want to have
# all relay logs at the end of the test flow
--connection server_2
--disable_connect_log
--source include/stop_slave_sql.inc
--enable_connect_log
--connection server_1
SET @binlog_annotate_row_events.save= @@global.binlog_annotate_row_events;
SET @binlog_checksum.save= @@global.binlog_checksum;
SET @master_verify_checksum.save= @@global.master_verify_checksum;
SET @binlog_row_image.save= @@global.binlog_row_image;
--echo ####################################################
--echo # Test 1: simple binlog, no checksum, no annotation
--echo ####################################################
--connection server_1
SET binlog_annotate_row_events= 0;
SET GLOBAL binlog_annotate_row_events= 0;
SET GLOBAL binlog_checksum= NONE;
SET GLOBAL master_verify_checksum= 0;
--source testdata.inc
--echo ####################################################
--echo # Test 2: binlog with checksum, no annotated events
--echo ####################################################
--connection server_1
SET binlog_annotate_row_events= 0;
SET GLOBAL binlog_annotate_row_events= 0;
SET GLOBAL binlog_checksum= CRC32;
SET GLOBAL master_verify_checksum= 1;
--source testdata.inc
--echo ####################################################
--echo # Test 3: binlog with checksum and annotated events
--echo ####################################################
--connection server_1
SET binlog_annotate_row_events= 1;
SET GLOBAL binlog_annotate_row_events= 1;
SET GLOBAL binlog_checksum= CRC32;
SET GLOBAL master_verify_checksum= 1;
--source testdata.inc
--echo ####################################################
--echo # Test 4: binlog with annotated events and binlog_row_image=minimal
--echo ####################################################
--connection server_1
SET binlog_annotate_row_events= 1;
SET GLOBAL binlog_annotate_row_events= 1;
SET GLOBAL binlog_checksum= NONE;
SET GLOBAL master_verify_checksum= 0;
SET GLOBAL binlog_row_image= MINIMAL;
SET binlog_row_image= MINIMAL;
--source testdata.inc
--echo #############################
--echo # Final checks for the master
--echo #############################
--let $master_datadir= `SELECT @@datadir`
--let SEARCH_RANGE = 500000
--let SEARCH_FILE= $master_datadir/master-bin.0*
--let SEARCH_PATTERN= _to_encrypt.*
--source include/search_pattern_in_file.inc
--let SEARCH_FILE= $master_datadir/master-bin.0*
--let SEARCH_PATTERN= COMMIT.*
--source include/search_pattern_in_file.inc
--let SEARCH_FILE= $master_datadir/master-bin.0*
--let SEARCH_PATTERN= TIMESTAMP.*
--source include/search_pattern_in_file.inc
--disable_connect_log
--source include/save_master_pos.inc
--enable_connect_log
--echo #############################
--echo # Final checks for the slave
--echo #############################
# Wait for the IO thread to write everything to relay logs
--connection server_2
--let $slave_datadir= `SELECT @@datadir`
--disable_connect_log
--source include/sync_io_with_master.inc
# Check that relay logs are unencrypted
--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0*
--let SEARCH_PATTERN= _to_encrypt.*
--source include/search_pattern_in_file.inc
--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0*
--let SEARCH_PATTERN= COMMIT.*
--source include/search_pattern_in_file.inc
--let SEARCH_FILE= $slave_datadir/slave-relay-bin.0*
--let SEARCH_PATTERN= TIMESTAMP.*
--source include/search_pattern_in_file.inc
# Re-enable SQL thread, let it catch up with IO thread
# and check slave binary logs
--source include/start_slave.inc
--source include/sync_slave_sql_with_io.inc
--enable_connect_log
--let SEARCH_FILE= $slave_datadir/slave-bin.0*
--let SEARCH_PATTERN= _to_encrypt.*
--source include/search_pattern_in_file.inc
--let SEARCH_FILE= $slave_datadir/slave-bin.0*
--let SEARCH_PATTERN= COMMIT.*
--source include/search_pattern_in_file.inc
--let SEARCH_FILE= $slave_datadir/slave-bin.0*
--let SEARCH_PATTERN= TIMESTAMP.*
--source include/search_pattern_in_file.inc
--echo ##########
--echo # Cleanup
--echo ##########
--connection server_1
SET GLOBAL binlog_annotate_row_events= @binlog_annotate_row_events.save;
SET GLOBAL binlog_checksum= @binlog_checksum.save;
SET GLOBAL master_verify_checksum= @master_verify_checksum.save;
SET GLOBAL binlog_row_image= @binlog_row_image.save;
--disable_connect_log
--source include/rpl_end.inc
|