~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
-- source include/have_binlog_format_mixed_or_statement.inc
2
-- source include/master-slave.inc
3
4
create table t1 (word char(20) not null);
5
load data infile '../std_data_ln/words.dat' into table t1;
6
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
8
select * from t1 limit 10;
9
10
#
11
# Test slave with wrong password
12
#
13
save_master_pos;
14
connection slave;
15
sync_with_master;
16
stop slave;
17
connection master;
18
set password for root@"localhost" = password('foo');
19
connection slave;
20
start slave;
21
connection master;
22
#
23
# Give slave time to do at last one failed connect retry
24
# This one must be short so that the slave will not stop retrying
25
real_sleep 2;
26
set password for root@"localhost" = password('');
27
# Give slave time to connect (will retry every second)
28
sleep 2;
29
30
create table t3(n int);
31
insert into t3 values(1),(2);
32
save_master_pos;
33
connection slave;
34
sync_with_master;
35
select * from t3;
36
select sum(length(word)) from t1;
37
connection master;
38
drop table t1,t3;
39
save_master_pos;
40
connection slave;
41
sync_with_master;
42
43
# Test if the slave SQL thread can be more than 16K behind the slave
44
# I/O thread (> IO_SIZE)
45
46
connection master;
47
# we'll use table-level locking to delay slave SQL thread
48
eval create table t1 (n int) engine=$engine_type;
49
sync_slave_with_master;
50
connection master;
51
reset master;
52
connection slave;
53
stop slave;
54
reset slave;
55
56
connection master;
57
let $1=5000;
58
# Generate 16K of relay log
59
disable_query_log;
60
while ($1)
61
{
62
 eval insert into t1 values($1);
63
 dec $1;
64
}
65
enable_query_log;
66
67
# Try to cause a large relay log lag on the slave by locking t1
68
connection slave;
69
lock tables t1 read;
70
start slave;
71
#hope this is long enough for I/O thread to fetch over 16K relay log data
72
sleep 3;
73
unlock tables;
74
75
#test handling of aborted connection in the middle of update
76
77
connection master;
78
create table t2(id int);
79
insert into t2 values(connection_id());
80
save_master_pos;
81
82
connection master1;
83
# Avoid generating result
84
create temporary table t3(n int);
85
insert into t3 select get_lock('crash_lock%20C', 1) from t2;
86
87
connection master;
88
send update t1 set n = n + get_lock('crash_lock%20C', 2);
89
connection master1;
90
sleep 3;
91
select (@id := id) - id from t2;
92
kill @id;
93
# We don't drop t3 as this is a temporary table
94
drop table t2;
95
connection master;
96
--error 1053,2013
97
reap;
98
connection slave;
99
# The SQL slave thread should now have stopped because the query was killed on
100
# the master (so it has a non-zero error code in the binlog).
101
--source include/wait_for_slave_sql_to_stop.inc
102
103
# The following test can't be done because the result of Pos will differ
104
# on different computers
105
# --replace_result $MASTER_MYPORT MASTER_PORT
106
# show slave status;
107
108
set global sql_slave_skip_counter=1;
109
start slave;
110
select count(*) from t1;
111
connection master1;
112
drop table t1;
113
create table t1 (n int);
114
insert into t1 values(3456);
115
insert into mysql.user (Host, User, Password)
116
 VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
117
select select_priv,user from mysql.user where user = _binary'blafasel2';
118
update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
119
select select_priv,user from mysql.user where user = _binary'blafasel2';
120
save_master_pos;
121
connection slave;
122
sync_with_master;
123
select n from t1;
124
select select_priv,user from mysql.user where user = _binary'blafasel2';
125
connection master1;
126
drop table t1;
127
delete from mysql.user where user="blafasel2";
128
save_master_pos;
129
connection slave;
130
sync_with_master;
131
132
# End of 4.1 tests