Debian Codegraph @

mysql-test/suite/rpl/t/rpl_binlog_cache_temp_file_encryption.test

raw
1 # ==== Purpose ====
2 #
3 # 1. Verify that the temporary file of binlog cache is encrypted when
4 # the binlog cache spills to disk if binlog_encryption is on.
5 # 2. Verify that 'SET GLOBAL binlog_encryption' takes effect immediately
6 # on binlog cache temporary file encryption.
7 # 3. Verify that binlog cache is reset at commit/rollback time.
8 #
9 # ==== Implementation ====
10 #
11 # 1. Start the master with binlog_encryption on.
12 # 2. Create a table t1 with a TEXT column.
13 # 3. Execute a trx to insert a big text into the tables to make
14 # binlog cache spill to disk and ensure that the temporary
15 # file of binlog cache is encrypted.
16 # 4. SET GLOBAL binlog_encryption=OFF
17 # 5. Execute a trx to ensure binlog cache temporary file encryption
18 # is disabled.
19 # 6. SET GLOBAL binlog_encryption=ON
20 # 7. Execute a trx to insert a big text into the tables to make
21 # binlog cache spill to disk and ensure that the temporary
22 # file of binlog cache is encrypted.
23 # 8. Commit a trx ensure that binlog cache is reset at commit time.
24 # 9. Rollback a trx ensure that binlog cache is reset at rollback time.
25 # 10. Verify that there is no difference on the table between
26 # master and slave.
27 #
28 # ==== References ====
29 #
30 # Wl#12079 Encrypt binary log caches at rest
31 # Bug#29475234 'BINLOG_ENCRYPTION' VALUE WONT TAKE IMMEDIATE EFFECT ON ENCRYPTING BINLOG CACHES
32
33 # This test script will be run only in non GR set up.
34 --source include/not_group_replication_plugin.inc
35 --source include/master-slave.inc
36 --source include/have_binlog_format_row.inc
37 # Restrict the test runs to only debug builds, since we set DEBUG point in the test.
38 --source include/have_debug.inc
39
40 --let $data_size= `select 0.5 * @@global.binlog_cache_size`
41
42 CREATE TABLE t1 (c1 TEXT) ENGINE=INNODB;
43
44 --let $debug_point= ensure_binlog_cache_temporary_file_is_encrypted
45 --source include/add_debug_point.inc
46
47 eval INSERT INTO t1 VALUES (REPEAT('123', $data_size));
48
49 --let $debug_point= ensure_binlog_cache_temporary_file_is_encrypted
50 --source include/remove_debug_point.inc
51
52 SET GLOBAL binlog_encryption=OFF;
53 --let $debug_point= ensure_binlog_cache_temp_file_encryption_is_disabled
54 --source include/add_debug_point.inc
55
56 eval INSERT INTO t1 VALUES (REPEAT('off', $data_size));
57
58 --let $debug_point= ensure_binlog_cache_temp_file_encryption_is_disabled
59 --source include/remove_debug_point.inc
60
61 SET GLOBAL binlog_encryption=ON;
62 --let $debug_point= ensure_binlog_cache_temporary_file_is_encrypted
63 --source include/add_debug_point.inc
64
65 eval INSERT INTO t1 VALUES (REPEAT('on1', $data_size));
66
67 --let $debug_point= ensure_binlog_cache_temporary_file_is_encrypted
68 --source include/remove_debug_point.inc
69
70 --let $debug_point= ensure_binlog_cache_is_reset
71 --source include/add_debug_point.inc
72
73 INSERT INTO t1 VALUES ("567");
74
75 BEGIN;
76 INSERT INTO t1 VALUES ("789");
77 ROLLBACK;
78
79
80 --let $debug_point= ensure_binlog_cache_is_reset
81 --source include/remove_debug_point.inc
82
83 --source include/sync_slave_sql_with_master.inc
84 --let $diff_tables=master:t1,slave:t1
85 --source include/diff_tables.inc
86
87 # Cleanup
88 --source include/rpl_connection_master.inc
89 DROP TABLE t1;
90
91 --source include/rpl_end.inc