rpl000001.test 3.08 KB
Newer Older
1
source include/master-slave.inc;
2
drop table if exists t1,t2,t3;
3 4
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
5
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
sasha@mysql.sashanet.com's avatar
sasha@mysql.sashanet.com committed
6
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
7
select * from t1 limit 10;
8 9 10 11 12 13 14 15 16

#
# Test slave with wrong password
#
save_master_pos;
connection slave;
sync_with_master;
slave stop;
connection master;
17
set password for root@"localhost" = password('foo');
18 19 20
connection slave;
slave start;
connection master;
21
#
22
# Give slave time to do at last one failed connect retry
23 24
# This one must be short so that the slave will not stop retrying
real_sleep 2;
25
set password for root@"localhost" = password('');
26 27 28
# Give slave time to connect (will retry every second)
sleep 2;

29 30
create table t3(n int);
insert into t3 values(1),(2);
31
save_master_pos;
32
connection slave;
33
sync_with_master;
34
select * from t3;
35
select sum(length(word)) from t1;
36
connection master;
37
drop table t1,t3;
38 39 40
save_master_pos;
connection slave;
sync_with_master;
41

42
#test handling of aborted connection in the middle of update
43 44 45
connection master;
reset master;
connection slave;
46
slave stop;
47 48
reset slave;

49 50
connection master;
create table t1(n int);
51 52 53 54
#we want the log to exceed 16K to test deal with the log that is bigger than
#IO_SIZE
let $1=5000;
disable_query_log;
55 56
while ($1)
{
57
 eval insert into t1 values($1+get_lock("hold_slave",10)*0);
58 59
 dec $1;
}
60 61
enable_query_log;

62
# Try to cause a large relay log lag on the slave 
63 64 65 66
connection slave;
select get_lock("hold_slave",10);
slave start;
#hope this is long enough for I/O thread to fetch over 16K relay log data
67
sleep 3;
68 69 70 71
select release_lock("hold_slave");
unlock tables;

connection master;
72 73 74
create table t2(id int);
insert into t2 values(connection_id());
save_master_pos;
75 76

connection master1;
77 78 79
# Avoid generating result
create temporary table t3(n int);
insert into t3 select get_lock('crash_lock%20C', 1) from t2;
80 81

connection master;
82
send update t1 set n = n + get_lock('crash_lock%20C', 2);
83
connection master1;
84
sleep 3;
85 86
select (@id := id) - id from t2;
kill @id;
87
# We don't drop t3 as this is a temporary table
88 89 90 91 92
drop table t2;
connection master;
--error 1053;
reap;
connection slave;
93
sync_with_master;
94
#give the slave a chance to exit
95
wait_for_slave_to_stop;
96 97

# The following test can't be done because the result of Pos will differ
98
# on different computers
99 100 101
# --replace_result 9306 9999 3334 9999 3335 9999
# show slave status;

102
set global sql_slave_skip_counter=1;
103 104 105 106 107 108
slave start;
select count(*) from t1;
connection master1;
drop table t1;
create table t1 (n int);
insert into t1 values(3456);
109
insert into mysql.user (Host, User, Password)
110
 VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
111
select select_priv,user from mysql.user where user = 'blafasel2';
112
update mysql.user set Select_priv = "Y" where User="blafasel2";
113
select select_priv,user from mysql.user where user = 'blafasel2';
114 115 116 117
save_master_pos;
connection slave;
sync_with_master;
select n from t1;
118
select select_priv,user from mysql.user where user = 'blafasel2';
119 120 121 122 123
connection master1;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;