~drizzle-trunk/drizzle/development

1 by brian
clean slate
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/master-data/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/master-data/rpl_loaddatalocal.select_outfile' into table t1;
28
--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
29
save_master_pos;
30
connection slave;
31
sync_with_master;
32
select a,count(*) from t1 group by a;
33
connection master;
34
drop table t1;
35
save_master_pos;
36
connection slave;
37
sync_with_master;
38
39
# End of 4.1 tests
40
41
#
42
# Now let us test how well we replicate LOAD DATA LOCAL in situation when
43
# we met duplicates in tables to which we are adding rows.
44
# (It supposed that LOAD DATA LOCAL ignores such errors)
45
#
46
connection master;
47
create table t1(a int);
48
insert into t1 values (1), (2), (2), (3);
49
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
50
eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
51
drop table t1;
52
create table t1(a int primary key);
53
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
54
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
55
--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
56
SELECT * FROM t1 ORDER BY a;
57
save_master_pos;
58
connection slave;
59
sync_with_master;
60
SELECT * FROM t1 ORDER BY a;
61
connection master;
62
drop table t1;
63
save_master_pos;
64
connection slave;
65
sync_with_master;