| 1 |
################# |
| 2 |
# Initialization |
| 3 |
################# |
| 4 |
include/rpl_init.inc [topology=1->2] |
| 5 |
connection server_2; |
| 6 |
include/stop_slave.inc |
| 7 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 8 |
include/start_slave.inc |
| 9 |
connection server_1; |
| 10 |
connection server_2; |
| 11 |
include/stop_slave.inc |
| 12 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 13 |
##################################################### |
| 14 |
# Part 1: unencrypted master |
| 15 |
##################################################### |
| 16 |
connection server_1; |
| 17 |
call mtr.add_suppression("Got fatal error 1236 from master when reading data from binary log: 'Could not decrypt binlog: encryption key error;"); |
| 18 |
CREATE TABLE table1_no_encryption ( |
| 19 |
pk INT AUTO_INCREMENT PRIMARY KEY, |
| 20 |
ts TIMESTAMP NULL, |
| 21 |
b BLOB |
| 22 |
) ENGINE=MyISAM; |
| 23 |
INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); |
| 24 |
INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; |
| 25 |
FLUSH BINARY LOGS; |
| 26 |
SET binlog_format=ROW; |
| 27 |
INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; |
| 28 |
INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; |
| 29 |
NOT FOUND /table1_no_encryption/ in master-bin.0* |
| 30 |
##################################################### |
| 31 |
# Part 2: restart master, now with binlog encryption |
| 32 |
##################################################### |
| 33 |
connection default; |
| 34 |
connection server_1; |
| 35 |
CREATE TABLE table2_to_encrypt ( |
| 36 |
pk INT AUTO_INCREMENT PRIMARY KEY, |
| 37 |
ts TIMESTAMP NULL, |
| 38 |
b BLOB |
| 39 |
) ENGINE=MyISAM; |
| 40 |
INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt'); |
| 41 |
INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; |
| 42 |
FLUSH BINARY LOGS; |
| 43 |
SET binlog_format=ROW; |
| 44 |
INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; |
| 45 |
INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt; |
| 46 |
NOT FOUND /table2_to_encrypt/ in master-bin.0* |
| 47 |
##################################################### |
| 48 |
# Part 3: restart master again without encryption |
| 49 |
##################################################### |
| 50 |
connection default; |
| 51 |
connection server_1; |
| 52 |
CREATE TABLE table3_no_encryption ( |
| 53 |
pk INT AUTO_INCREMENT PRIMARY KEY, |
| 54 |
ts TIMESTAMP NULL, |
| 55 |
b BLOB |
| 56 |
) ENGINE=MyISAM; |
| 57 |
INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); |
| 58 |
INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; |
| 59 |
INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; |
| 60 |
##################################################### |
| 61 |
# Check: resume replication and check how it goes |
| 62 |
##################################################### |
| 63 |
connection server_2; |
| 64 |
start slave; |
| 65 |
connection server_1; |
| 66 |
connection server_2; |
| 67 |
include/wait_for_slave_io_error.inc [errno=1236] |
| 68 |
SHOW TABLES; |
| 69 |
Tables_in_test |
| 70 |
table1_no_encryption |
| 71 |
include/stop_slave_sql.inc |
| 72 |
include/reset_slave.inc |
| 73 |
Warnings: |
| 74 |
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos' |
| 75 |
########## |
| 76 |
# Cleanup |
| 77 |
########## |
| 78 |
connection server_1; |
| 79 |
reset master; |
| 80 |
SELECT COUNT(*) FROM table1_no_encryption; |
| 81 |
COUNT(*) |
| 82 |
8 |
| 83 |
SELECT COUNT(*) FROM table2_to_encrypt; |
| 84 |
COUNT(*) |
| 85 |
8 |
| 86 |
SELECT COUNT(*) FROM table3_no_encryption; |
| 87 |
COUNT(*) |
| 88 |
4 |
| 89 |
DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption; |
| 90 |
connection server_2; |
| 91 |
include/start_slave.inc |
| 92 |
include/rpl_end.inc |