2000-12-07 15:54:59 +01:00
|
|
|
source include/master-slave.inc;
|
2003-01-06 00:48:59 +01:00
|
|
|
|
2001-01-03 01:15:48 +01:00
|
|
|
create table t1 (word char(20) not null);
|
2006-01-24 08:30:54 +01:00
|
|
|
load data infile '../std_data_ln/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;
|
2003-02-17 01:14:37 +01:00
|
|
|
select * from t1 limit 10;
|
2002-08-08 02:12:02 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test slave with wrong password
|
|
|
|
#
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2002-10-25 01:46:14 +02:00
|
|
|
stop slave;
|
2002-08-08 02:12:02 +02:00
|
|
|
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;
|
2002-10-25 01:46:14 +02:00
|
|
|
start slave;
|
2002-08-08 02:12:02 +02:00
|
|
|
connection master;
|
2002-08-18 15:04:26 +02:00
|
|
|
#
|
2002-08-08 02:12:02 +02:00
|
|
|
# Give slave time to do at last one failed connect retry
|
2002-08-18 15:04:26 +02:00
|
|
|
# This one must be short so that the slave will not stop retrying
|
|
|
|
real_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
|
|
|
|
2005-03-02 17:52:38 +01:00
|
|
|
# Test if the slave SQL thread can be more than 16K behind the slave
|
|
|
|
# I/O thread (> IO_SIZE)
|
|
|
|
|
|
|
|
connection master;
|
|
|
|
# we'll use table-level locking to delay slave SQL thread
|
|
|
|
create table t1 (n int) engine=myisam;
|
|
|
|
sync_slave_with_master;
|
2001-04-12 00:29:15 +02:00
|
|
|
connection master;
|
|
|
|
reset master;
|
|
|
|
connection slave;
|
2002-10-25 01:46:14 +02:00
|
|
|
stop slave;
|
2001-04-12 00:29:15 +02:00
|
|
|
reset slave;
|
|
|
|
|
2001-04-11 04:56:54 +02:00
|
|
|
connection master;
|
2002-01-29 21:50:09 +01:00
|
|
|
let $1=5000;
|
2005-03-02 17:52:38 +01:00
|
|
|
# Generate 16K of relay log
|
2002-01-29 21:50:09 +01:00
|
|
|
disable_query_log;
|
2001-04-11 04:56:54 +02:00
|
|
|
while ($1)
|
|
|
|
{
|
2005-03-02 17:52:38 +01:00
|
|
|
eval insert into t1 values($1);
|
2001-04-11 04:56:54 +02:00
|
|
|
dec $1;
|
|
|
|
}
|
2002-01-29 21:50:09 +01:00
|
|
|
enable_query_log;
|
|
|
|
|
2005-03-02 17:52:38 +01:00
|
|
|
# Try to cause a large relay log lag on the slave by locking t1
|
2002-01-29 21:50:09 +01:00
|
|
|
connection slave;
|
2005-03-02 17:52:38 +01:00
|
|
|
lock tables t1 read;
|
2002-10-25 01:46:14 +02:00
|
|
|
start slave;
|
2002-01-29 21:50:09 +01:00
|
|
|
#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
|
|
|
unlock tables;
|
|
|
|
|
2005-03-02 17:52:38 +01:00
|
|
|
#test handling of aborted connection in the middle of update
|
|
|
|
|
2002-01-29 21:50:09 +01:00
|
|
|
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;
|
2005-12-14 18:42:08 +01:00
|
|
|
--error 1053,2013
|
2001-04-11 04:56:54 +02: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 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
|
2004-08-24 12:58:12 +02:00
|
|
|
# --replace_result $MASTER_MYPORT MASTER_PORT
|
2001-04-18 01:53:21 +02:00
|
|
|
# show slave status;
|
|
|
|
|
2002-07-23 17:31:22 +02:00
|
|
|
set global sql_slave_skip_counter=1;
|
2002-10-25 01:46:14 +02:00
|
|
|
start slave;
|
2001-04-11 04:56:54 +02:00
|
|
|
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"));
|
2004-07-08 15:54:07 +02: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-11 04:56:54 +02:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
|
|
|
select n from t1;
|
2004-07-08 15:54:07 +02:00
|
|
|
select select_priv,user from mysql.user where user = _binary'blafasel2';
|
2001-04-11 04:56:54 +02:00
|
|
|
connection master1;
|
|
|
|
drop table t1;
|
Add new option "check-testcases" to mysql-test-run.pl
Cleanup the sideeffects from most of the testcases with sideeffects.
mysql-test/mysql-test-run.pl:
Add option "check-testcases" to mysql-test-run.pl
Will execute "include/check-testcase.test" once before each tescase and record the output into "var/tmp/check-testcase.result"
After the teastcase it will run again and this time compare the output with previously recorded file.
mysql-test/r/analyze.result:
Drop table t1 at end of test
mysql-test/r/create_select_tmp.result:
Drop table t1 at end of test
mysql-test/r/ctype_cp932.result:
Drop table t1 at end of test
mysql-test/r/ctype_recoding.result:
Drop table t1 at end of test
mysql-test/r/grant2.result:
Drop user mysqltest_2 and mysqltest_A@'%'
mysql-test/r/join_outer.result:
Drop view v1 to cleanup
mysql-test/r/ps_1general.result:
Drop table t1 at end of test
mysql-test/r/query_cache.result:
Drop function "f1"
mysql-test/r/read_only.result:
Reset the "read_only" flag
mysql-test/r/rpl000001.result:
Remove user "blafasel2"
mysql-test/r/rpl000017.result:
Remove user "replicate"
mysql-test/r/rpl_failed_optimize.result:
Drop table t1 to cleanup
mysql-test/r/rpl_flush_tables.result:
Drop tables t3, t4, t5
mysql-test/r/rpl_ignore_revoke.result:
Delete user "user_foo"
mysql-test/r/rpl_insert_id.result:
Drop table t1 to cleanup
mysql-test/r/rpl_loaddata.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_loaddata_rule_m.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_loaddata_rule_s.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_misc_functions.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_multi_update3.result:
Drop tyable t1 and t2 to cleanup
mysql-test/r/rpl_replicate_do.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_skip_error.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_slave_status.result:
Drop tyable t1 to cleanup
mysql-test/r/sp-prelocking.result:
Drop view v1 and tables t1, t2, t3 and t4 to cleanup
mysql-test/r/sp-security.result:
Delete users to cleanup
Delete remaining traces in tables_priv and procs_priv
mysql-test/r/subselect_innodb.result:
Drop procedure p1 to cleanup
mysql-test/r/trigger-compat.result:
Drop trigger wl2818_trg1 and wl2818_trg2.
Drop table t1, t2
Drop database mysqltest_db1
And the users "mysqltest_dfn@localhost" and "mysqltest_inv@localhost"
mysql-test/r/type_bit.result:
Drop tables t1 and t2 to cleanup
mysql-test/r/variables.result:
Set GLOBAL max_join_size to 10 as it originally was in variables-master.opt
mysql-test/r/view_grant.result:
Dop user "test@localhost" to cleanup
mysql-test/t/analyze.test:
Drop table t1 to cleanup
mysql-test/t/create_select_tmp.test:
Drop table t1 to cleanup
mysql-test/t/ctype_cp932.test:
Drop table t1 to cleanup
mysql-test/t/ctype_recoding.test:
Drop table t1 to cleanup
mysql-test/t/fulltext_var.test:
Restore the original ft_boolean_syntax
mysql-test/t/grant2.test:
Drop users "mysqltest_2" and "mysqltest_A@'%'" to cleanup
mysql-test/t/innodb_cache.test:
Reset query_cache_size to original value
mysql-test/t/join_outer.test:
Drop view v1 to cleanup
mysql-test/t/ps_1general.test:
Drop table t1 to cleanup
mysql-test/t/query_cache.test:
Drop function "f1" to cleanup
mysql-test/t/read_only.test:
Reset the readonly flag
mysql-test/t/rpl000001.test:
Delete user "blafasel2" to cleanup
mysql-test/t/rpl000017.test:
Delete user "replicate" to cleanup
mysql-test/t/rpl_failed_optimize.test:
Drop table t1 to cleanup
mysql-test/t/rpl_flush_tables.test:
Droip table t3, t4 and t5 to cleanup
mysql-test/t/rpl_ignore_revoke.test:
Delet user "user_foo" to cleanup
mysql-test/t/rpl_insert_id.test:
drop table t1 to cleanup
mysql-test/t/rpl_loaddata.test:
Drop table t1 to cleanup
mysql-test/t/rpl_loaddata_rule_m.test:
Drop table t1 to cleanup
mysql-test/t/rpl_loaddata_rule_s.test:
Drop table t1 to cleanup
mysql-test/t/rpl_misc_functions.test:
Drop table t1 to cleanup
mysql-test/t/rpl_multi_update3.test:
Drop table t1 and t2 to cleanup
mysql-test/t/rpl_replicate_do.test:
Drop table t1 to cleanup
mysql-test/t/rpl_skip_error.test:
Drop table t1 to cleanup
mysql-test/t/rpl_slave_status.test:
Drop table t1 to cleanup
mysql-test/t/sp-prelocking.test:
Drop table t1, t2 t3 and t4 to cleanup
Drop view v1
mysql-test/t/sp-security.test:
Delete test users from mysql.user, mysql.db, mysql.procs_priv and mysql.tables_priv
Drop table t1 to cleanup
mysql-test/t/subselect_innodb.test:
Drop procedure p1 to cleanup
mysql-test/t/trigger-compat.test:
Drop trigger wl2818_trg1 and wl2818_trg2 to cleanup
Drop table t1, t2
Drop users
drop database mysqltest_db1
mysql-test/t/type_bit.test:
drop table t1 and t2 to cleanup
mysql-test/t/variables-master.opt:
Increase max_join_size to 100.
mysql-test/t/variables.test:
Set max_join_size to 10, which was the original value in variables-master.opt
mysql-test/t/view_grant.test:
Drop the user "test@localhost"
mysql-test/include/check-testcase.test:
New BitKeeper file ``mysql-test/include/check-testcase.test''
2006-01-26 17:54:34 +01:00
|
|
|
delete from mysql.user where user="blafasel2";
|
2001-04-11 04:56:54 +02:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2005-07-28 02:22:47 +02:00
|
|
|
|
|
|
|
# End of 4.1 tests
|