~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to mysql-test/extra/rpl_tests/rpl_stm_000001.test

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

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