~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

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