mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
33fc0d53b5
BitKeeper/etc/gone: auto-union BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-.my_sys.h.swp~f6a4a7f8dae03f18: Auto merged BitKeeper/etc/config: Auto merged acconfig.h: Auto merged acinclude.m4: Auto merged Docs/manual.texi: Auto merged client/mysqlcheck.c: Auto merged client/mysqlshow.c: Auto merged include/myisam.h: Auto merged include/violite.h: Auto merged isam/pack_isam.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/Makefile.am: Auto merged myisam/ft_nlq_search.c: Auto merged myisam/mi_open.c: Auto merged myisam/mi_write.c: Auto merged myisam/sort.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_test.result: Auto merged mysql-test/r/isam.result: Auto merged mysql-test/r/rpl_replicate_do.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/func_test.test: Auto merged mysql-test/t/myisam.test: Auto merged mysql-test/t/rpl_rotate_logs.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/hash.c: Auto merged mysys/tree.c: Auto merged scripts/Makefile.am: Auto merged sql/Makefile.am: Auto merged sql/filesort.cc: Auto merged sql/gen_lex_hash.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/hash_filo.h: Auto merged sql/hostname.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_timefunc.cc: Auto merged sql/lex.h: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/log_event.h: Auto merged sql/mini_client.cc: Auto merged sql/opt_range.cc: Auto merged sql/opt_sum.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.h: Auto merged sql/slave.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/danish/errmsg.txt: Auto merged sql/share/dutch/errmsg.txt: Auto merged sql/share/english/errmsg.txt: Auto merged sql/share/estonian/errmsg.txt: Auto merged sql/share/french/errmsg.txt: Auto merged sql/share/german/errmsg.txt: Auto merged sql/share/greek/errmsg.txt: Auto merged sql/share/hungarian/errmsg.txt: Auto merged sql/share/italian/errmsg.txt: Auto merged sql/share/japanese/errmsg.txt: Auto merged sql/share/korean/errmsg.txt: Auto merged sql/share/norwegian/errmsg.txt: Auto merged sql/table.h: Auto merged sql/unireg.cc: Auto merged sql-bench/server-cfg.sh: Auto merged sql/share/norwegian-ny/errmsg.txt: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/share/romanian/errmsg.txt: Auto merged sql/share/russian/errmsg.txt: Auto merged sql/share/slovak/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/share/swedish/errmsg.txt: Auto merged sql/share/ukrainian/errmsg.txt: Auto merged sql/ha_myisam.cc: Merge with 4.0 Removed some commented code sql/sql_db.cc: Merge with 4.0 Optimized the logging of the drop db call a bit sql/sql_update.cc: Added comment
135 lines
3.6 KiB
Text
135 lines
3.6 KiB
Text
#
|
|
# Test are run with max_binlog_size=2048 to force automatic rotation of the
|
|
# binary log
|
|
# Tests done:
|
|
# - Check that slaves reports correct failures if master.info has strange
|
|
# modes/information
|
|
# - Automatic binary log rotation
|
|
# - Ensure that temporary tables works over flush logs and binary log
|
|
# changes
|
|
# - Test creating a duplicate key error and recover from it
|
|
#
|
|
connect (master,localhost,root,,test,0,master.sock);
|
|
drop table if exists t1, t2, t3, t4;
|
|
connect (slave,localhost,root,,test,0,slave.sock);
|
|
system cat /dev/null > var/slave-data/master.info;
|
|
system chmod 000 var/slave-data/master.info;
|
|
connection slave;
|
|
drop table if exists t1, t2, t3, t4;
|
|
--error 1201
|
|
start slave;
|
|
system chmod 600 var/slave-data/master.info;
|
|
--error 1201
|
|
start slave;
|
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
|
# Will get error 13 on Unix systems becasue file is not readable
|
|
!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
|
|
reset slave;
|
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
|
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
|
|
connection master;
|
|
reset master;
|
|
connection slave;
|
|
start slave;
|
|
connection master;
|
|
|
|
#
|
|
# Test FLUSH LOGS
|
|
#
|
|
create temporary table temp_table (a char(80) not null);
|
|
insert into temp_table values ("testing temporary tables");
|
|
create table t1 (s text);
|
|
insert into t1 values('Could not break slave'),('Tried hard');
|
|
sync_slave_with_master;
|
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
|
show slave status;
|
|
select * from t1;
|
|
connection master;
|
|
flush logs;
|
|
drop table if exists t2;
|
|
create table t2(m int not null auto_increment primary key);
|
|
insert into t2 values (34),(67),(123);
|
|
flush logs;
|
|
show binary logs;
|
|
create table t3 select * from temp_table;
|
|
|
|
sync_slave_with_master;
|
|
|
|
select * from t3;
|
|
connection master;
|
|
drop table temp_table, t3;
|
|
|
|
#
|
|
# Now lets make some duplicate key mess and see if we can recover from it
|
|
#
|
|
|
|
# First insert a value on the slave
|
|
connection slave;
|
|
insert into t2 values(1234);
|
|
|
|
#same value on the master
|
|
connection master;
|
|
save_master_pos;
|
|
set insert_id=1234;
|
|
insert into t2 values(NULL);
|
|
connection slave;
|
|
sync_with_master;
|
|
|
|
wait_for_slave_to_stop;
|
|
|
|
#restart slave skipping one event
|
|
set global sql_slave_skip_counter=1;
|
|
start slave;
|
|
|
|
connection master;
|
|
|
|
#let slave catch up
|
|
sync_slave_with_master;
|
|
connection master;
|
|
purge master logs to 'master-bin.000003';
|
|
show binary logs;
|
|
insert into t2 values (65);
|
|
sync_slave_with_master;
|
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
|
show slave status;
|
|
select * from t2;
|
|
|
|
#
|
|
# Test forcing the replication log to rotate
|
|
#
|
|
|
|
connection master;
|
|
create temporary table temp_table (a char(80) not null);
|
|
insert into temp_table values ("testing temporary tables part 2");
|
|
let $1=100;
|
|
drop table if exists t3;
|
|
create table t3 (n int);
|
|
disable_query_log;
|
|
while ($1)
|
|
{
|
|
#eval means expand $ expressions
|
|
eval insert into t3 values($1 + 4);
|
|
dec $1;
|
|
}
|
|
enable_query_log;
|
|
create table t4 select * from temp_table;
|
|
show binary logs;
|
|
show master status;
|
|
save_master_pos;
|
|
connection slave;
|
|
#stop slave;
|
|
#start slave;
|
|
sync_with_master;
|
|
select * from t4;
|
|
|
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
|
show slave status;
|
|
# because of concurrent insert, the table may not be up to date
|
|
# if we do not lock
|
|
lock tables t3 read;
|
|
select count(*) from t3 where n >= 4;
|
|
unlock tables;
|
|
#clean up
|
|
connection master;
|
|
drop table if exists t1,t2,t3,t4;
|
|
sync_slave_with_master;
|