rpl000001.test 2.22 KB
Newer Older
1
eval_result;
2
source include/master-slave.inc;
3 4
connection master;
use test;
5
drop table if exists t1,t3;
6 7
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
sasha@mysql.sashanet.com's avatar
sasha@mysql.sashanet.com committed
8 9
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
select * from t1;
10 11
set password = password('foo');
set password = password('');
12 13
create table t3(n int);
insert into t3 values(1),(2);
14
save_master_pos;
15
connection slave;
16
sync_with_master;
17
use test;
18
select * from t3;
19
select sum(length(word)) from t1;
20
connection master;
21
drop table t1,t3;
22 23 24
save_master_pos;
connection slave;
sync_with_master;
25

26
#test handling of aborted connection in the middle of update
27 28 29 30 31
connection master;
reset master;
connection slave;
reset slave;

32 33 34
connection master;
drop table if exists t1,t2;
create table t1(n int);
35
let $1=10;
36 37 38 39 40 41 42 43
while ($1)
{
 eval insert into t1 values($1);
 dec $1;
}
create table t2(id int);
insert into t2 values(connection_id());
save_master_pos;
44 45 46 47

connection master1;
#avoid generating result
create temporary table t1_temp(n int);
48
insert into t1_temp select get_lock('crash_lock%20C', 1) from t2;
49 50

connection master;
51
send update t1 set n = n + get_lock('crash_lock%20C', 2);
52
connection master1;
53
sleep 2;
54 55 56 57 58 59 60 61
select (@id := id) - id from t2;
kill @id;
drop table t2;
connection master;
--error 1053;
reap;
connection slave;
sync_with_master ;
62 63
#give the slave a chance to exit
sleep 0.5;
64 65

# The following test can't be done because the result of Pos will differ
66
# on different computers
67 68 69
# --replace_result 9306 9999 3334 9999 3335 9999
# show slave status;

70 71 72 73 74 75 76
set sql_slave_skip_counter=1;
slave start;
select count(*) from t1;
connection master1;
drop table t1;
create table t1 (n int);
insert into t1 values(3456);
77 78
use mysql;
insert into user (Host, User, Password)
79
 VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
80 81 82 83
select select_priv,user from mysql.user where user = 'blafasel2';
update user set Select_priv = "Y" where User="blafasel2";
select select_priv,user from mysql.user where user = 'blafasel2';
use test;
84 85 86 87
save_master_pos;
connection slave;
sync_with_master;
select n from t1;
88
select select_priv,user from mysql.user where user = 'blafasel2';
89 90 91 92 93 94
connection master1;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;

95