rpl_loaddatalocal.test 2.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# See if "LOAD DATA LOCAL INFILE" is well replicated
# (LOAD DATA LOCAL INFILE is not written to the binlog
# the same way as LOAD DATA INFILE : Append_blocks are smaller).
# In MySQL 4.0 <4.0.12 there were 2 bugs with LOAD DATA LOCAL INFILE :
# - the loaded file was not written entirely to the master's binlog,
# only the first 4KB, 8KB or 16KB usually.
# - the loaded file's first line was not written entirely to the
# master's binlog (1st char was absent)
source include/master-slave.inc;

create table t1(a int);
let $1=10000;
disable_query_log;
set SQL_LOG_BIN=0;
while ($1)
{
17
 insert into t1 values(1);
18 19 20 21
 dec $1;
}
set SQL_LOG_BIN=1;
enable_query_log;
22 23
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
24 25
#This will generate a 20KB file, now test LOAD DATA LOCAL
truncate table t1;
26 27 28
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
29 30 31 32 33 34 35 36 37
save_master_pos;
connection slave;
sync_with_master;
select a,count(*) from t1 group by a;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
unknown's avatar
unknown committed
38

39
# End of 4.1 tests
unknown's avatar
unknown committed
40

unknown's avatar
unknown committed
41 42 43 44 45 46 47 48
#
# Now let us test how well we replicate LOAD DATA LOCAL in situation when
# we met duplicates in tables to which we are adding rows.
# (It supposed that LOAD DATA LOCAL ignores such errors)
#
connection master;
create table t1(a int);
insert into t1 values (1), (2), (2), (3);
49 50
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
unknown's avatar
unknown committed
51 52
drop table t1;
create table t1(a int primary key);
53 54 55
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
unknown's avatar
unknown committed
56 57 58 59 60 61 62 63 64 65
select * from t1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;