summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/binlog_encryption/encrypted_master_lost_key.result
blob: 5c934af15e40905bd0720457140589dc68bd0ce7 (plain)
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
#################
# Initialization
#################
include/rpl_init.inc [topology=1->2]
connection server_2;
include/stop_slave.inc
#####################################################
# Pre-test 1: Initial key value
#####################################################
connection server_1;
CREATE TABLE table1_to_encrypt (
pk INT AUTO_INCREMENT PRIMARY KEY,
ts TIMESTAMP NULL,
b BLOB
) ENGINE=MyISAM;
INSERT INTO table1_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt');
INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt;
SET binlog_format=ROW;
INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt;
INSERT INTO table1_to_encrypt SELECT NULL,NOW(),b FROM table1_to_encrypt;
NOT FOUND /table1_to_encrypt/ in master-bin.0*
#######################################################
# Pre-test 2: restart master with a different key value
#######################################################
connection default;
connection server_1;
CREATE TABLE table2_to_encrypt (
pk INT AUTO_INCREMENT PRIMARY KEY,
ts TIMESTAMP NULL,
b BLOB
) ENGINE=MyISAM;
INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt');
INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
SET binlog_format=ROW;
INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
NOT FOUND /table2_to_encrypt/ in master-bin.0*
#####################################################
# Pre-test 3: restart master again with the right key
#####################################################
connection default;
connection server_1;
CREATE TABLE table3_to_encrypt (
pk INT AUTO_INCREMENT PRIMARY KEY,
ts TIMESTAMP NULL,
b BLOB
) ENGINE=MyISAM;
INSERT INTO table3_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt');
INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt;
INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt;
FLUSH BINARY LOGS;
INSERT INTO table3_to_encrypt SELECT NULL,NOW(),b FROM table3_to_encrypt;
#####################################################
# Test 1: Check that if master has an encrypted
#         binary log which it cannot decrypt, it 
#         still feeds events to the slave, and SQL 
#         thread produces an expected error upon 
#         receiving these unreadable events .
#         This behavior is confirmed in MDEV-11323
#####################################################
connection server_2;
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
START SLAVE SQL_THREAD;
include/wait_for_slave_sql_error.inc [errno=1594]
SHOW TABLES;
Tables_in_test
table1_to_encrypt
SELECT COUNT(*) FROM table1_to_encrypt;
COUNT(*)
8
#####################################################
# Test 2: check that replication works if it starts
#         from a good binary log
#####################################################
connection server_2;
include/stop_slave.inc
RESET SLAVE ALL;
DROP DATABASE test;
CREATE DATABASE test;
USE test;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=<MASTER_PORT>, MASTER_USER='root', MASTER_LOG_FILE='master-bin.000003';
include/start_slave.inc
SHOW TABLES;
Tables_in_test
table3_to_encrypt
#####################################################
# Test 3: check that replication works if we purge
#         master logs up to the good one
#####################################################
connection server_2;
connection server_1;
PURGE BINARY LOGS TO 'master-bin.000003';
connection server_2;
include/stop_slave.inc
RESET SLAVE ALL;
DROP DATABASE test;
CREATE DATABASE test;
USE test;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=<MASTER_PORT>, MASTER_USER='root';
include/start_slave.inc
SHOW TABLES;
Tables_in_test
table3_to_encrypt
##########
# Cleanup
##########
connection server_1;
DROP TABLE table1_to_encrypt, table2_to_encrypt, table3_to_encrypt;
connection server_2;
include/rpl_end.inc