| 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_slave_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 --slave-load-tmpdir crashes the slave |
| 18 |
# BUG#11872422: rpl_slave_load_remove_tmpfile fails sporadically in pb2 |
| 19 |
|
| 20 |
--source include/have_binlog_format_statement.inc |
| 21 |
--source include/have_innodb.inc |
| 22 |
--source include/have_debug.inc |
| 23 |
--source include/not_embedded.inc |
| 24 |
--source include/not_var_link.inc |
| 25 |
--source include/master-slave.inc |
| 26 |
|
| 27 |
########################################################################## |
| 28 |
# Loading data |
| 29 |
########################################################################## |
| 30 |
|
| 31 |
connection slave; |
| 32 |
SET @saved_dbug = @@GLOBAL.debug_dbug; |
| 33 |
SET @@global.debug_dbug= '+d,remove_slave_load_file_before_write'; |
| 34 |
|
| 35 |
connection master; |
| 36 |
|
| 37 |
create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; |
| 38 |
|
| 39 |
start transaction; |
| 40 |
insert into t1(b) values (1); |
| 41 |
insert into t1(b) values (2); |
| 42 |
load data infile '../../std_data/rpl_loaddata.dat' into table t1; |
| 43 |
commit; |
| 44 |
|
| 45 |
########################################################################## |
| 46 |
# Catch Error |
| 47 |
########################################################################## |
| 48 |
connection slave; |
| 49 |
|
| 50 |
# windows and linux different error numbers here: |
| 51 |
# Windows: |
| 52 |
# - Last_Errno 29 (File not found) |
| 53 |
# Unix like OS: |
| 54 |
# - Last_Errno 13 (Can't stat file) |
| 55 |
--let $slave_sql_errno= 29, 13 |
| 56 |
--source include/wait_for_slave_sql_error.inc |
| 57 |
|
| 58 |
########################################################################## |
| 59 |
# Clean up |
| 60 |
########################################################################## |
| 61 |
connection master; |
| 62 |
|
| 63 |
drop table t1; |
| 64 |
|
| 65 |
--source include/sync_slave_io_with_master.inc |
| 66 |
--source include/stop_slave_io.inc |
| 67 |
RESET SLAVE; |
| 68 |
|
| 69 |
drop table t1; |
| 70 |
|
| 71 |
call mtr.add_suppression("Slave: Can't get stat of .*"); |
| 72 |
call mtr.add_suppression("Slave SQL: Error .Can.t get stat of.* error.* 13"); |
| 73 |
call mtr.add_suppression("Slave: File.* not found.*"); |
| 74 |
call mtr.add_suppression("Slave SQL: Error .File.* not found.* error.* 29"); |
| 75 |
--let $rpl_only_running_threads= 1 |
| 76 |
|
| 77 |
SET @@GLOBAL.debug_dbug = @saved_dbug; |
| 78 |
|
| 79 |
--source include/rpl_end.inc |
| 80 |
|