2003-03-02 18:20:32 +01:00
|
|
|
# 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)
|
|
|
|
{
|
2006-01-24 08:30:54 +01:00
|
|
|
insert into t1 values(1);
|
2003-03-02 18:20:32 +01:00
|
|
|
dec $1;
|
|
|
|
}
|
|
|
|
set SQL_LOG_BIN=1;
|
|
|
|
enable_query_log;
|
2007-12-12 18:19:24 +01:00
|
|
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
|
|
|
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
|
|
|
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
|
2003-03-02 18:20:32 +01:00
|
|
|
#This will generate a 20KB file, now test LOAD DATA LOCAL
|
|
|
|
truncate table t1;
|
2007-12-12 18:19:24 +01:00
|
|
|
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
|
|
|
eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
|
|
|
|
--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
|
2003-03-02 18:20:32 +01:00
|
|
|
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;
|
2005-03-16 04:32:47 +03:00
|
|
|
|
2005-07-28 03:22:47 +03:00
|
|
|
# End of 4.1 tests
|
2005-07-28 17:09:54 +03:00
|
|
|
|
2005-03-16 04:32:47 +03:00
|
|
|
#
|
|
|
|
# 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);
|
2007-12-12 18:19:24 +01:00
|
|
|
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
|
|
|
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
|
2005-03-16 04:32:47 +03:00
|
|
|
drop table t1;
|
|
|
|
create table t1(a int primary key);
|
2007-12-12 18:19:24 +01:00
|
|
|
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
|
|
|
eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
|
|
|
|
--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
|
2006-05-02 22:56:53 +02:00
|
|
|
SELECT * FROM t1 ORDER BY a;
|
2005-03-16 04:32:47 +03:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2006-05-02 22:56:53 +02:00
|
|
|
SELECT * FROM t1 ORDER BY a;
|
2005-03-16 04:32:47 +03:00
|
|
|
connection master;
|
|
|
|
drop table t1;
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2009-03-16 16:21:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Bug22504 load data infile sql statement in replication architecture get error
|
|
|
|
#
|
|
|
|
--echo ==== Bug22504 Initialize ====
|
|
|
|
|
|
|
|
--echo [on master]
|
|
|
|
--connection master
|
|
|
|
|
|
|
|
SET sql_mode='ignore_space';
|
|
|
|
CREATE TABLE t1(a int);
|
|
|
|
insert into t1 values (1), (2), (3), (4);
|
|
|
|
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
|
|
|
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
|
|
|
|
truncate table t1;
|
|
|
|
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
|
|
|
|
eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
|
|
|
|
--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
|
|
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
|
|
|
|
--echo [on slave]
|
|
|
|
sync_slave_with_master;
|
|
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
|
|
|
|
--echo ==== Clean up ====
|
|
|
|
|
|
|
|
--echo [on master]
|
|
|
|
connection master;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
--echo [on slave]
|
|
|
|
sync_slave_with_master;
|
|
|
|
|