2000-12-07 07:54:59 -07:00
|
|
|
source include/master-slave.inc;
|
2003-01-06 01:48:59 +02:00
|
|
|
|
2001-01-03 02:15:48 +02:00
|
|
|
create table t1 (word char(20) not null);
|
|
|
|
load data infile '../../std_data/words.dat' into table t1;
|
2002-02-08 03:21:34 +02:00
|
|
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
2001-10-23 13:28:03 -06:00
|
|
|
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
|
2003-02-17 02:14:37 +02:00
|
|
|
select * from t1 limit 10;
|
2002-08-08 03:12:02 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test slave with wrong password
|
|
|
|
#
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2002-10-24 17:46:14 -06:00
|
|
|
stop slave;
|
2002-08-08 03:12:02 +03:00
|
|
|
connection master;
|
2001-11-27 02:33:15 +02:00
|
|
|
set password for root@"localhost" = password('foo');
|
2002-08-08 03:12:02 +03:00
|
|
|
connection slave;
|
2002-10-24 17:46:14 -06:00
|
|
|
start slave;
|
2002-08-08 03:12:02 +03:00
|
|
|
connection master;
|
2002-08-18 16:04:26 +03:00
|
|
|
#
|
2002-08-08 03:12:02 +03:00
|
|
|
# Give slave time to do at last one failed connect retry
|
2002-08-18 16:04:26 +03:00
|
|
|
# This one must be short so that the slave will not stop retrying
|
|
|
|
real_sleep 2;
|
2001-11-27 02:33:15 +02:00
|
|
|
set password for root@"localhost" = password('');
|
2002-08-08 03:12:02 +03:00
|
|
|
# Give slave time to connect (will retry every second)
|
|
|
|
sleep 2;
|
|
|
|
|
2001-04-18 02:53:21 +03:00
|
|
|
create table t3(n int);
|
|
|
|
insert into t3 values(1),(2);
|
2001-01-17 05:47:33 -07:00
|
|
|
save_master_pos;
|
2000-11-17 23:35:40 -07:00
|
|
|
connection slave;
|
2001-01-17 05:47:33 -07:00
|
|
|
sync_with_master;
|
2001-04-18 02:53:21 +03:00
|
|
|
select * from t3;
|
2001-01-17 05:47:33 -07:00
|
|
|
select sum(length(word)) from t1;
|
2001-01-03 02:15:48 +02:00
|
|
|
connection master;
|
2001-04-18 02:53:21 +03:00
|
|
|
drop table t1,t3;
|
2001-01-17 05:47:33 -07:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2001-04-11 16:29:15 -06:00
|
|
|
|
2001-04-10 20:56:54 -06:00
|
|
|
#test handling of aborted connection in the middle of update
|
2001-04-11 16:29:15 -06:00
|
|
|
connection master;
|
|
|
|
reset master;
|
|
|
|
connection slave;
|
2002-10-24 17:46:14 -06:00
|
|
|
stop slave;
|
2001-04-11 16:29:15 -06:00
|
|
|
reset slave;
|
|
|
|
|
2001-04-10 20:56:54 -06:00
|
|
|
connection master;
|
|
|
|
create table t1(n int);
|
2002-01-29 13:50:09 -07: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-10 20:56:54 -06:00
|
|
|
while ($1)
|
|
|
|
{
|
2002-01-29 13:50:09 -07:00
|
|
|
eval insert into t1 values($1+get_lock("hold_slave",10)*0);
|
2001-04-10 20:56:54 -06:00
|
|
|
dec $1;
|
|
|
|
}
|
2002-01-29 13:50:09 -07:00
|
|
|
enable_query_log;
|
|
|
|
|
2002-08-08 03:12:02 +03:00
|
|
|
# Try to cause a large relay log lag on the slave
|
2002-01-29 13:50:09 -07:00
|
|
|
connection slave;
|
|
|
|
select get_lock("hold_slave",10);
|
2003-10-30 12:57:26 +02:00
|
|
|
explain extended select get_lock("hold_slave",10);
|
2002-10-24 17:46:14 -06:00
|
|
|
start slave;
|
2002-01-29 13:50:09 -07:00
|
|
|
#hope this is long enough for I/O thread to fetch over 16K relay log data
|
2002-08-08 03:12:02 +03:00
|
|
|
sleep 3;
|
2002-01-29 13:50:09 -07:00
|
|
|
select release_lock("hold_slave");
|
2003-10-30 12:57:26 +02:00
|
|
|
explain extended select release_lock("hold_slave");
|
2002-01-29 13:50:09 -07:00
|
|
|
unlock tables;
|
|
|
|
|
|
|
|
connection master;
|
2001-04-10 20:56:54 -06:00
|
|
|
create table t2(id int);
|
|
|
|
insert into t2 values(connection_id());
|
|
|
|
save_master_pos;
|
2001-04-12 13:46:19 -06:00
|
|
|
|
|
|
|
connection master1;
|
2002-08-08 03:12:02 +03: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 13:46:19 -06:00
|
|
|
|
|
|
|
connection master;
|
2001-10-05 13:18:18 -06:00
|
|
|
send update t1 set n = n + get_lock('crash_lock%20C', 2);
|
2001-04-10 20:56:54 -06:00
|
|
|
connection master1;
|
2002-08-08 03:12:02 +03:00
|
|
|
sleep 3;
|
2001-04-10 20:56:54 -06:00
|
|
|
select (@id := id) - id from t2;
|
|
|
|
kill @id;
|
2002-08-08 03:12:02 +03:00
|
|
|
# We don't drop t3 as this is a temporary table
|
2001-04-10 20:56:54 -06:00
|
|
|
drop table t2;
|
|
|
|
connection master;
|
2005-08-31 17:16:05 +02:00
|
|
|
--error 1053
|
2001-04-10 20:56:54 -06:00
|
|
|
reap;
|
|
|
|
connection slave;
|
2003-06-16 15:49:54 +02:00
|
|
|
# The SQL slave thread should now have stopped because the query was killed on
|
|
|
|
# the master (so it has a non-zero error code in the binlog).
|
2002-01-29 13:50:09 -07:00
|
|
|
wait_for_slave_to_stop;
|
2001-04-18 02:53:21 +03:00
|
|
|
|
|
|
|
# The following test can't be done because the result of Pos will differ
|
2001-04-18 04:23:14 +03:00
|
|
|
# on different computers
|
2004-08-24 12:58:12 +02:00
|
|
|
# --replace_result $MASTER_MYPORT MASTER_PORT
|
2001-04-18 02:53:21 +03:00
|
|
|
# show slave status;
|
|
|
|
|
2002-07-23 18:31:22 +03:00
|
|
|
set global sql_slave_skip_counter=1;
|
2002-10-24 17:46:14 -06:00
|
|
|
start slave;
|
2001-04-10 20:56:54 -06:00
|
|
|
select count(*) from t1;
|
|
|
|
connection master1;
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (n int);
|
|
|
|
insert into t1 values(3456);
|
2002-08-08 03:12:02 +03:00
|
|
|
insert into mysql.user (Host, User, Password)
|
2001-09-18 04:58:15 +03:00
|
|
|
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
|
2004-07-08 18:54:07 +05:00
|
|
|
select select_priv,user from mysql.user where user = _binary'blafasel2';
|
|
|
|
update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
|
|
|
|
select select_priv,user from mysql.user where user = _binary'blafasel2';
|
2001-04-10 20:56:54 -06:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
|
|
|
select n from t1;
|
2004-07-08 18:54:07 +05:00
|
|
|
select select_priv,user from mysql.user where user = _binary'blafasel2';
|
2001-04-10 20:56:54 -06:00
|
|
|
connection master1;
|
|
|
|
drop table t1;
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2005-07-28 03:22:47 +03:00
|
|
|
|
|
|
|
# End of 4.1 tests
|