1#################
2# Initialization
3#################
4include/rpl_init.inc [topology=1->2]
5connection server_2;
6include/stop_slave.inc
7#####################################################
8# Part 1: unencrypted master
9#####################################################
10connection server_1;
11CREATE TABLE table1_no_encryption (
12pk INT AUTO_INCREMENT PRIMARY KEY,
13ts TIMESTAMP NULL,
14b BLOB
15) ENGINE=MyISAM;
16INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
17INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
18FLUSH BINARY LOGS;
19SET binlog_format=ROW;
20INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
21INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
22FOUND 11 /table1_no_encryption/ in master-bin.0*
23#####################################################
24# Part 2: restart master, now with binlog encryption
25#####################################################
26connection default;
27connection server_1;
28CREATE TABLE table2_to_encrypt (
29pk INT AUTO_INCREMENT PRIMARY KEY,
30ts TIMESTAMP NULL,
31b BLOB
32) ENGINE=MyISAM;
33INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt');
34INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
35FLUSH BINARY LOGS;
36SET binlog_format=ROW;
37INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
38INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
39NOT FOUND /table2_to_encrypt/ in master-bin.0*
40#####################################################
41# Part 3: restart master again without encryption
42#####################################################
43connection default;
44connection server_1;
45CREATE TABLE table3_no_encryption (
46pk INT AUTO_INCREMENT PRIMARY KEY,
47ts TIMESTAMP NULL,
48b BLOB
49) ENGINE=MyISAM;
50INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
51INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
52INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
53#####################################################
54# Check: resume replication and check that it works
55#####################################################
56connection server_2;
57include/start_slave.inc
58SHOW TABLES;
59Tables_in_test
60table1_no_encryption
61table2_to_encrypt
62table3_no_encryption
63##########
64# Cleanup
65##########
66connection server_1;
67SELECT COUNT(*) FROM table1_no_encryption;
68COUNT(*)
698
70SELECT COUNT(*) FROM table2_to_encrypt;
71COUNT(*)
728
73SELECT COUNT(*) FROM table3_no_encryption;
74COUNT(*)
754
76DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption;
77connection server_2;
78include/rpl_end.inc
79