Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # This test verifies if the slave fails gracefully when the temporary
4 # file used to load data is removed while it is about to be used.
5 # Similar errors are caught if the temporary directory is removed.
6 #
7 # ==== Implementation ====
8 #
9 # Steps:
10 # 0 - Set debug variable remove_replica_load_file_before_write. This
11 # causes the slave to remove the file.
12 # 1 - Creates a table and populates it through "LOAD DATA INFILE".
13 # 2 - Catches error.
14 #
15 # ==== References ====
16 #
17 # BUG#42861: Assigning invalid directories to --replica-load-tmpdir crashes the slave
18 # BUG#11872422: rpl_slave_load_remove_tmpfile fails sporadically in pb2
19
20 --source include/not_group_replication_plugin.inc
21 --source include/have_binlog_format_statement.inc
22 --source include/have_debug.inc
23 --source include/master-slave.inc
24
25 ##########################################################################
26 # Loading data
27 ##########################################################################
28
29 connection slave;
30
31 --let $debug_point= remove_replica_load_file_before_write
32 --source include/add_debug_point.inc
33
34 connection master;
35
36 create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb;
37
38 start transaction;
39 insert into t1(b) values (1);
40 insert into t1(b) values (2);
41 load data infile '../../std_data/rpl_loaddata.dat' into table t1;
42 commit;
43
44 ##########################################################################
45 # Catch Error
46 ##########################################################################
47 connection slave;
48
49 # windows and linux different error numbers here:
50 # Windows:
51 # - Last_Errno 29 (File not found)
52 # Unix like OS:
53 # - Last_Errno 13 (Can't stat file)
54 # - Last_Errno 1290 (When datadir was set to a symlink when the load
55 # data file is removed the server won't be able to
56 # resolve the realpath, ending up stating that we
57 # have a mismatch)
58 call mtr.add_suppression("LOAD DATA INFILE in the replica SQL Thread can only read from --replica-load-tmpdir");
59 call mtr.add_suppression("The MySQL server is running with the --replica-load-tmpdir option so it cannot execute this statement.*Error_code: MY-001290");
60 --let $slave_sql_errno= 29, 13, 1290
61 --source include/wait_for_slave_sql_error.inc
62
63 ##########################################################################
64 # Clean up
65 ##########################################################################
66 connection master;
67
68 drop table t1;
69
70 --source include/sync_slave_io_with_master.inc
71 --source include/stop_slave_io.inc
72 RESET SLAVE;
73
74 drop table t1;
75
76 call mtr.add_suppression("Replica: Can't get stat of .*");
77 call mtr.add_suppression("Replica SQL for channel '': .*Error .Can.t get stat of.* Error_code: MY-000013");
78 call mtr.add_suppression("Replica.*: File.* not found.*");
79 call mtr.add_suppression("Replica.*: .*Error .File.* not found.* Error_code: MY-000029");
80 call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
81
82 --let $rpl_only_running_threads= 1
83
84 --let $debug_point= remove_replica_load_file_before_write
85 --source include/remove_debug_point.inc
86
87 --source include/rpl_end.inc
88