2000-12-07 15:54:59 +01:00
|
|
|
source include/master-slave.inc;
|
2002-08-08 02:12:02 +02:00
|
|
|
drop table if exists t1,t2,t3;
|
2001-01-03 01:15:48 +01:00
|
|
|
create table t1 (word char(20) not null);
|
|
|
|
load data infile '../../std_data/words.dat' into table t1;
|
2002-02-08 02:21:34 +01:00
|
|
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
2001-10-23 21:28:03 +02:00
|
|
|
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
|
|
|
|
select * from t1;
|
2002-08-08 02:12:02 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test slave with wrong password
|
|
|
|
#
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
|
|
|
slave stop;
|
|
|
|
connection master;
|
2001-11-27 01:33:15 +01:00
|
|
|
set password for root@"localhost" = password('foo');
|
2002-08-08 02:12:02 +02:00
|
|
|
connection slave;
|
|
|
|
slave start;
|
|
|
|
connection master;
|
|
|
|
# Give slave time to do at last one failed connect retry
|
|
|
|
sleep 2;
|
2001-11-27 01:33:15 +01:00
|
|
|
set password for root@"localhost" = password('');
|
2002-08-08 02:12:02 +02:00
|
|
|
# Give slave time to connect (will retry every second)
|
|
|
|
sleep 2;
|
|
|
|
|
2001-04-18 01:53:21 +02:00
|
|
|
create table t3(n int);
|
|
|
|
insert into t3 values(1),(2);
|
2001-01-17 13:47:33 +01:00
|
|
|
save_master_pos;
|
2000-11-18 07:35:40 +01:00
|
|
|
connection slave;
|
2001-01-17 13:47:33 +01:00
|
|
|
sync_with_master;
|
2001-04-18 01:53:21 +02:00
|
|
|
select * from t3;
|
2001-01-17 13:47:33 +01:00
|
|
|
select sum(length(word)) from t1;
|
2001-01-03 01:15:48 +01:00
|
|
|
connection master;
|
2001-04-18 01:53:21 +02:00
|
|
|
drop table t1,t3;
|
2001-01-17 13:47:33 +01:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2001-04-12 00:29:15 +02:00
|
|
|
|
2001-04-11 04:56:54 +02:00
|
|
|
#test handling of aborted connection in the middle of update
|
2001-04-12 00:29:15 +02:00
|
|
|
connection master;
|
|
|
|
reset master;
|
|
|
|
connection slave;
|
2002-01-29 21:50:09 +01:00
|
|
|
slave stop;
|
2001-04-12 00:29:15 +02:00
|
|
|
reset slave;
|
|
|
|
|
2001-04-11 04:56:54 +02:00
|
|
|
connection master;
|
|
|
|
create table t1(n int);
|
2002-01-29 21:50:09 +01:00
|
|
|
#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;
|
2001-04-11 04:56:54 +02:00
|
|
|
while ($1)
|
|
|
|
{
|
2002-01-29 21:50:09 +01:00
|
|
|
eval insert into t1 values($1+get_lock("hold_slave",10)*0);
|
2001-04-11 04:56:54 +02:00
|
|
|
dec $1;
|
|
|
|
}
|
2002-01-29 21:50:09 +01:00
|
|
|
enable_query_log;
|
|
|
|
|
2002-08-08 02:12:02 +02:00
|
|
|
# Try to cause a large relay log lag on the slave
|
2002-01-29 21:50:09 +01:00
|
|
|
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
|
2002-08-08 02:12:02 +02:00
|
|
|
sleep 3;
|
2002-01-29 21:50:09 +01:00
|
|
|
select release_lock("hold_slave");
|
|
|
|
unlock tables;
|
|
|
|
|
|
|
|
connection master;
|
2001-04-11 04:56:54 +02:00
|
|
|
create table t2(id int);
|
|
|
|
insert into t2 values(connection_id());
|
|
|
|
save_master_pos;
|
2001-04-12 21:46:19 +02:00
|
|
|
|
|
|
|
connection master1;
|
2002-08-08 02:12:02 +02:00
|
|
|
# Avoid generating result
|
|
|
|
create temporary table t3(n int);
|
|
|
|
insert into t3 select get_lock('crash_lock%20C', 1) from t2;
|
2001-04-12 21:46:19 +02:00
|
|
|
|
|
|
|
connection master;
|
2001-10-05 21:18:18 +02:00
|
|
|
send update t1 set n = n + get_lock('crash_lock%20C', 2);
|
2001-04-11 04:56:54 +02:00
|
|
|
connection master1;
|
2002-08-08 02:12:02 +02:00
|
|
|
sleep 3;
|
2001-04-11 04:56:54 +02:00
|
|
|
select (@id := id) - id from t2;
|
|
|
|
kill @id;
|
2002-08-08 02:12:02 +02:00
|
|
|
# We don't drop t3 as this is a temporary table
|
2001-04-11 04:56:54 +02:00
|
|
|
drop table t2;
|
|
|
|
connection master;
|
|
|
|
--error 1053;
|
|
|
|
reap;
|
|
|
|
connection slave;
|
2002-08-08 02:12:02 +02:00
|
|
|
sync_with_master;
|
2001-04-12 00:29:15 +02:00
|
|
|
#give the slave a chance to exit
|
2002-01-29 21:50:09 +01:00
|
|
|
wait_for_slave_to_stop;
|
2001-04-18 01:53:21 +02:00
|
|
|
|
|
|
|
# The following test can't be done because the result of Pos will differ
|
2001-04-18 03:23:14 +02:00
|
|
|
# on different computers
|
2001-04-18 01:53:21 +02:00
|
|
|
# --replace_result 9306 9999 3334 9999 3335 9999
|
|
|
|
# show slave status;
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
set global sql_slave_skip_counter=1;
|
2001-04-11 04:56:54 +02:00
|
|
|
slave start;
|
|
|
|
select count(*) from t1;
|
|
|
|
connection master1;
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (n int);
|
|
|
|
insert into t1 values(3456);
|
2002-08-08 02:12:02 +02:00
|
|
|
insert into mysql.user (Host, User, Password)
|
2001-09-18 03:58:15 +02:00
|
|
|
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
|
2001-05-16 21:19:40 +02:00
|
|
|
select select_priv,user from mysql.user where user = 'blafasel2';
|
2002-08-08 02:12:02 +02:00
|
|
|
update mysql.user set Select_priv = "Y" where User="blafasel2";
|
2001-05-16 21:19:40 +02:00
|
|
|
select select_priv,user from mysql.user where user = 'blafasel2';
|
2001-04-11 04:56:54 +02:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
|
|
|
select n from t1;
|
2001-05-16 21:19:40 +02:00
|
|
|
select select_priv,user from mysql.user where user = 'blafasel2';
|
2001-04-11 04:56:54 +02:00
|
|
|
connection master1;
|
|
|
|
drop table t1;
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|