Debian Codegraph @

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

raw
1 ##########################################################################
2 # This test verifies if a slave is able to process a "LOAD DATA INFILE"
3 # event while the "--secure-file-priv" option is set.
4 #
5 # The test is divided in two steps:
6 # 1 - Creates tables and populates them through "LOAD DATA INFILE".
7 # 2 - Compares the master and slave.
8 #
9 # === References ===
10 # Bug#28541204 SECURE-FILE-PRIV BREAKS LOAD DATA INFILE REPLICATION IN
11 # STATEMENT MODE ON 5.7.23
12 ##########################################################################
13
14 # This test does not work with var being a softlink.
15 --source include/not_var_link.inc
16 --source include/have_binlog_format_statement.inc
17 --source include/master-slave.inc
18
19 # Bug#28541204 SECURE-FILE-PRIV BREAKS LOAD DATA INFILE REPLICATION IN
20 # STATEMENT MODE ON 5.7.23
21
22 --echo # Restart the slave with a different secure path.
23 --source include/rpl_connection_slave.inc
24 --let $old_secure_file_path=`SELECT @@GLOBAL.secure_file_priv`
25 --let $datadir=`SELECT @@GLOBAL.datadir`
26 --let $include_silent=1
27 --let $rpl_server_number=2
28 --let $rpl_server_parameters=--secure-file-priv=$datadir
29 --source include/rpl_restart_server.inc
30 --let $include_silent=0
31
32 # Assert that @@GLOBAL.secure_file_priv equals @@GLOBAL.datadir
33 --let $assert_text= Datadir is the new secure file path
34 --let $assert_cond= "[SELECT @@GLOBAL.secure_file_priv]" = "[SELECT @@GLOBAL.datadir]"
35 --source include/assert.inc
36 --source include/start_slave.inc
37
38 ##########################################################################
39 # Loading data
40 ##########################################################################
41 --source include/rpl_connection_master.inc
42
43 create table t2(a int not null auto_increment, b int, primary key(a)) engine=innodb;
44
45
46 start transaction;
47 insert into t2(b) values (1);
48 insert into t2(b) values (2);
49 load data infile '../../std_data/rpl_loaddata.dat' into table t2;
50 load data infile '../../std_data/rpl_loaddata.dat' into table t2;
51 commit;
52
53 ##########################################################################
54 # Checking Consistency
55 ##########################################################################
56 --source include/sync_slave_sql_with_master.inc
57
58 --echo # Restore the old secure path on slave.
59 --let $include_silent=1
60 --let $rpl_server_number=2
61 --let $rpl_server_parameters=--secure-file-priv=$old_secure_file_path
62 --source include/rpl_restart_server.inc
63 --let $include_silent=0
64
65 # Assert that @@GLOBAL.secure_file_priv is restored.
66 --let $assert_text= Old secure file path is restored.
67 --let $assert_cond= "[SELECT @@GLOBAL.secure_file_priv]" = "$old_secure_file_path"
68 --source include/assert.inc
69
70 --source include/start_slave.inc
71
72 let $diff_tables= master:t2, slave:t2;
73 source include/diff_tables.inc;
74
75 ##########################################################################
76 # Clean up
77 ##########################################################################
78 --source include/rpl_connection_master.inc
79
80 drop table t2;
81
82 --source include/sync_slave_sql_with_master.inc
83 --source include/rpl_end.inc