| 1 |
# See if "LOAD DATA LOCAL INFILE" is well replicated |
| 2 |
# (LOAD DATA LOCAL INFILE is not written to the binlog |
| 3 |
# the same way as LOAD DATA INFILE : Append_blocks are smaller). |
| 4 |
# In MySQL 4.0 <4.0.12 there were 2 bugs with LOAD DATA LOCAL INFILE : |
| 5 |
# - the loaded file was not written entirely to the master's binlog, |
| 6 |
# only the first 4KB, 8KB or 16KB usually. |
| 7 |
# - the loaded file's first line was not written entirely to the |
| 8 |
# master's binlog (1st char was absent) |
| 9 |
--source include/master-slave.inc |
| 10 |
|
| 11 |
create table t1(a int); |
| 12 |
let $1=10000; |
| 13 |
disable_query_log; |
| 14 |
set SQL_LOG_BIN=0; |
| 15 |
while ($1) |
| 16 |
{ |
| 17 |
insert into t1 values(1); |
| 18 |
dec $1; |
| 19 |
} |
| 20 |
set SQL_LOG_BIN=1; |
| 21 |
enable_query_log; |
| 22 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 23 |
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1; |
| 24 |
#This will generate a 20KB file, now test LOAD DATA LOCAL |
| 25 |
truncate table t1; |
| 26 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 27 |
eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1; |
| 28 |
remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile; |
| 29 |
--sync_slave_with_master |
| 30 |
select a,count(*) from t1 group by a; |
| 31 |
connection master; |
| 32 |
drop table t1; |
| 33 |
--sync_slave_with_master |
| 34 |
|
| 35 |
# End of 4.1 tests |
| 36 |
|
| 37 |
# |
| 38 |
# Now let us test how well we replicate LOAD DATA LOCAL in situation when |
| 39 |
# we met duplicates in tables to which we are adding rows. |
| 40 |
# (It supposed that LOAD DATA LOCAL ignores such errors) |
| 41 |
# |
| 42 |
connection master; |
| 43 |
create table t1(a int); |
| 44 |
insert into t1 values (1), (2), (2), (3); |
| 45 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 46 |
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1; |
| 47 |
drop table t1; |
| 48 |
create table t1(a int primary key); |
| 49 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 50 |
eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1; |
| 51 |
remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile; |
| 52 |
SELECT * FROM t1 ORDER BY a; |
| 53 |
--sync_slave_with_master |
| 54 |
SELECT * FROM t1 ORDER BY a; |
| 55 |
connection master; |
| 56 |
drop table t1; |
| 57 |
--sync_slave_with_master |
| 58 |
--source include/rpl_end.inc |