mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#1012: All changes as one single changeset.
This includes both code and test cases. BitKeeper/deleted/.del-ctype_ucs_binlog.result~280d136b1a0bcf17: Delete: mysql-test/r/ctype_ucs_binlog.result BitKeeper/deleted/.del-rpl_delete_all.result~7c050d592614b3f: Delete: mysql-test/r/rpl_delete_all.result BitKeeper/deleted/.del-rpl000013-slave.opt~18266ad8a2403e8d: Delete: mysql-test/t/rpl000013-slave.opt BitKeeper/deleted/.del-rpl_delete_all.test~700a1490277780e0: Delete: mysql-test/t/rpl_delete_all.test mysql-test/extra/binlog_tests/binlog.test: Import patch wl1012.patch mysql-test/extra/binlog_tests/blackhole.test: Import patch wl1012.patch mysql-test/extra/binlog_tests/ctype_cp932.test: Import patch wl1012.patch mysql-test/extra/binlog_tests/ctype_cp932_binlog.test: Import patch wl1012.patch mysql-test/extra/binlog_tests/ctype_ucs_binlog.test: Import patch wl1012.patch mysql-test/extra/binlog_tests/drop_temp_table.test: Import patch wl1012.patch mysql-test/extra/binlog_tests/insert_select-binlog.test: Import patch wl1012.patch mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_ddl.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_deadlock.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_err_ignoredtable.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_flsh_tbls.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_loaddata_m.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_log.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_max_relay_size.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_multi_query.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_reset_slave.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_stm_000001.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_stm_EE_err.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_stm_charset.test: Import patch wl1012.patch mysql-test/extra/rpl_tests/rpl_user_variables.test: Import patch wl1012.patch mysql-test/r/binlog_stm_binlog.result: Import patch wl1012.patch mysql-test/r/binlog_stm_blackhole.result: Import patch wl1012.patch mysql-test/r/binlog_stm_ctype_cp932.result: Import patch wl1012.patch mysql-test/r/binlog_stm_ctype_ucs.result: Import patch wl1012.patch mysql-test/r/binlog_stm_drop_tmp_tbl.result: Import patch wl1012.patch mysql-test/r/binlog_stm_insert_select.result: Import patch wl1012.patch mysql-test/r/binlog_stm_mix_innodb_myisam.result: Import patch wl1012.patch mysql-test/r/rpl_000012.result: Import patch wl1012.patch mysql-test/r/rpl_000015.result: Import patch wl1012.patch mysql-test/r/rpl_deadlock_innodb.result: Import patch wl1012.patch mysql-test/r/rpl_flushlog_loop.result: Import patch wl1012.patch mysql-test/r/rpl_loaddata_s.result: Import patch wl1012.patch mysql-test/r/rpl_stm_000001.result: Import patch wl1012.patch mysql-test/r/rpl_stm_EE_err.result: Import patch wl1012.patch mysql-test/r/rpl_stm_charset.result: Import patch wl1012.patch mysql-test/r/rpl_stm_ddl.result: Import patch wl1012.patch mysql-test/r/rpl_stm_err_ignoredtable.result: Import patch wl1012.patch mysql-test/r/rpl_stm_flsh_tbls.result: Import patch wl1012.patch mysql-test/r/rpl_stm_loaddata_m.result: Import patch wl1012.patch mysql-test/r/rpl_stm_log.result: Import patch wl1012.patch mysql-test/r/rpl_stm_max_relay_size.result: Import patch wl1012.patch mysql-test/r/rpl_stm_multi_query.result: Import patch wl1012.patch mysql-test/r/rpl_stm_mystery22.result: Import patch wl1012.patch mysql-test/r/rpl_stm_reset_slave.result: Import patch wl1012.patch mysql-test/r/rpl_stm_rewrt_db.result: Import patch wl1012.patch mysql-test/r/rpl_stm_sp.result: Import patch wl1012.patch mysql-test/r/rpl_stm_timezone.result: Import patch wl1012.patch mysql-test/r/rpl_stm_until.result: Import patch wl1012.patch mysql-test/r/rpl_stm_user_variables.result: Import patch wl1012.patch mysql-test/r/rpl_stm_view.result: Import patch wl1012.patch mysql-test/t/binlog_row_binlog-master.opt: Import patch wl1012.patch mysql-test/t/rpl_000012.test: Import patch wl1012.patch mysql-test/t/rpl_000015-slave.sh: Import patch wl1012.patch mysql-test/t/rpl_000015.slave-mi: Import patch wl1012.patch mysql-test/t/rpl_000015.test: Import patch wl1012.patch mysql-test/t/rpl_deadlock_innodb-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_flushlog_loop-master.opt: Import patch wl1012.patch mysql-test/t/rpl_flushlog_loop-master.sh: Import patch wl1012.patch mysql-test/t/rpl_flushlog_loop-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_flushlog_loop-slave.sh: Import patch wl1012.patch mysql-test/t/rpl_flushlog_loop.test: Import patch wl1012.patch mysql-test/t/rpl_loaddata_s-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_loaddata_s.test: Import patch wl1012.patch mysql-test/t/rpl_stm_000001-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_err_ignoredtable-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_loaddata_m-master.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_log-master.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_log-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_mystery22.test: Import patch wl1012.patch mysql-test/t/rpl_stm_rewrt_db-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_rewrt_db.test: Import patch wl1012.patch mysql-test/t/rpl_stm_sp-master.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_sp-slave.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_sp.test: Import patch wl1012.patch mysql-test/t/rpl_stm_timezone-master.opt: Import patch wl1012.patch mysql-test/t/rpl_stm_timezone-slave.opt: Import patch wl1012.patch BUILD/SETUP.sh: Import patch wl1012.patch Makefile.am: Import patch wl1012.patch mysql-test/t/rpl_stm_timezone.test: Import patch wl1012.patch mysql-test/t/rpl_stm_until.test: Import patch wl1012.patch mysql-test/t/rpl_stm_view.test: Import patch wl1012.patch client/Makefile.am: Import patch wl1012.patch client/client_priv.h: Import patch wl1012.patch client/mysqlbinlog.cc: Import patch wl1012.patch configure.in: Import patch wl1012.patch include/Makefile.am: Import patch wl1012.patch include/base64.h: Import patch wl1012.patch include/config-win.h: Import patch wl1012.patch include/my_base.h: Import patch wl1012.patch include/my_global.h: Import patch wl1012.patch mysql-test/Makefile.am: Import patch wl1012.patch mysql-test/mysql-test-run.pl: Import patch wl1012.patch mysql-test/mysql-test-run.sh: Import patch wl1012.patch mysql-test/r/date_formats.result: Import patch wl1012.patch mysql-test/r/flush_block_commit.result: Import patch wl1012.patch mysql-test/r/innodb.result: Import patch wl1012.patch mysql-test/r/rpl000017.result: Import patch wl1012.patch mysql-test/r/rpl_change_master.result: Import patch wl1012.patch mysql-test/r/rpl_commit_after_flush.result: Import patch wl1012.patch mysql-test/r/rpl_create_database.result: Import patch wl1012.patch mysql-test/r/rpl_do_grant.result: Import patch wl1012.patch mysql-test/r/rpl_loaddata.result: Import patch wl1012.patch mysql-test/r/rpl_log_pos.result: Import patch wl1012.patch mysql-test/r/rpl_multi_delete.result: Import patch wl1012.patch mysql-test/r/rpl_multi_update.result: Import patch wl1012.patch mysql-test/r/rpl_openssl.result: Import patch wl1012.patch mysql-test/r/rpl_replicate_do.result: Import patch wl1012.patch mysql-test/r/rpl_rotate_logs.result: Import patch wl1012.patch mysql-test/r/rpl_server_id1.result: Import patch wl1012.patch mysql-test/r/rpl_server_id2.result: Import patch wl1012.patch mysql-test/r/rpl_temporary.result: Import patch wl1012.patch mysql-test/r/user_var-binlog.result: Import patch wl1012.patch mysql-test/t/create_select_tmp.test: Import patch wl1012.patch mysql-test/t/date_formats.test: Import patch wl1012.patch mysql-test/t/disabled.def: Import patch wl1012.patch mysql-test/t/innodb.test: Import patch wl1012.patch mysql-test/t/mysqlbinlog.test: Import patch wl1012.patch mysql-test/t/mysqlbinlog2.test: Import patch wl1012.patch mysql-test/t/rpl000002.test: Import patch wl1012.patch mysql-test/t/rpl000006.test: Import patch wl1012.patch mysql-test/t/rpl000013.test: Import patch wl1012.patch mysql-test/t/rpl000017.test: Import patch wl1012.patch mysql-test/t/rpl_auto_increment.test: Import patch wl1012.patch mysql-test/t/rpl_change_master.test: Import patch wl1012.patch mysql-test/t/rpl_commit_after_flush.test: Import patch wl1012.patch mysql-test/t/rpl_create_database.test: Import patch wl1012.patch mysql-test/t/rpl_do_grant.test: Import patch wl1012.patch mysql-test/t/rpl_drop.test: Import patch wl1012.patch mysql-test/t/rpl_empty_master_crash.test: Import patch wl1012.patch mysql-test/t/rpl_failed_optimize.test: Import patch wl1012.patch mysql-test/t/rpl_heap.test: Import patch wl1012.patch mysql-test/t/rpl_insert_id.test: Import patch wl1012.patch mysql-test/t/rpl_insert_ignore.test: Import patch wl1012.patch mysql-test/t/rpl_loaddata.test: Import patch wl1012.patch mysql-test/t/rpl_log_pos.test: Import patch wl1012.patch mysql-test/t/rpl_multi_delete.test: Import patch wl1012.patch mysql-test/t/rpl_multi_update.test: Import patch wl1012.patch mysql-test/t/rpl_multi_update2.test: Import patch wl1012.patch mysql-test/t/rpl_multi_update3.test: Import patch wl1012.patch mysql-test/t/rpl_openssl.test: Import patch wl1012.patch mysql-test/t/rpl_redirect.test: Import patch wl1012.patch mysql-test/t/rpl_relayrotate.test: Import patch wl1012.patch mysql-test/t/rpl_replicate_do.test: Import patch wl1012.patch mysql-test/t/rpl_rotate_logs.test: Import patch wl1012.patch mysql-test/t/rpl_server_id1.test: Import patch wl1012.patch mysql-test/t/rpl_sp_effects.test: Import patch wl1012.patch mysql-test/t/rpl_temporary.test: Import patch wl1012.patch mysql-test/t/rpl_trigger.test: Import patch wl1012.patch mysql-test/t/sp.test: Import patch wl1012.patch mysql-test/t/user_var-binlog.test: Import patch wl1012.patch mysys/Makefile.am: Import patch wl1012.patch mysys/base64.c: Import patch wl1012.patch sql/Makefile.am: Import patch wl1012.patch sql/ha_innodb.cc: Import patch wl1012.patch sql/ha_innodb.h: Import patch wl1012.patch sql/ha_partition.cc: Import patch wl1012.patch sql/handler.cc: Import patch wl1012.patch sql/handler.h: Import patch wl1012.patch sql/item_sum.cc: Import patch wl1012.patch sql/log.cc: Import patch wl1012.patch sql/log_event.cc: Import patch wl1012.patch sql/log_event.h: Import patch wl1012.patch sql/mysql_priv.h: Import patch wl1012.patch sql/mysqld.cc: Import patch wl1012.patch sql/rpl_filter.h: Import patch wl1012.patch sql/set_var.cc: Import patch wl1012.patch sql/share/errmsg.txt: Import patch wl1012.patch sql/slave.cc: Import patch wl1012.patch sql/slave.h: Import patch wl1012.patch sql/sp.cc: Import patch wl1012.patch sql/sp_head.cc: Import patch wl1012.patch sql/sql_acl.cc: Import patch wl1012.patch sql/sql_base.cc: Import patch wl1012.patch sql/sql_class.cc: Import patch wl1012.patch sql/sql_class.h: Import patch wl1012.patch sql/sql_delete.cc: Import patch wl1012.patch sql/sql_insert.cc: Import patch wl1012.patch sql/sql_lex.h: Import patch wl1012.patch sql/sql_list.h: Import patch wl1012.patch sql/sql_load.cc: Import patch wl1012.patch sql/sql_parse.cc: Import patch wl1012.patch sql/sql_plugin.cc: Import patch wl1012.patch sql/sql_rename.cc: Import patch wl1012.patch sql/sql_repl.h: Import patch wl1012.patch sql/sql_select.cc: Import patch wl1012.patch sql/sql_show.cc: Import patch wl1012.patch sql/sql_table.cc: Import patch wl1012.patch sql/sql_udf.cc: Import patch wl1012.patch sql/sql_union.cc: Import patch wl1012.patch sql/sql_update.cc: Import patch wl1012.patch sql/sql_yacc.yy: Import patch wl1012.patch sql/table.cc: Import patch wl1012.patch sql/table.h: Import patch wl1012.patch storage/innobase/include/lock0lock.h: Import patch wl1012.patch storage/innobase/include/row0mysql.h: Import patch wl1012.patch storage/innobase/include/row0vers.h: Import patch wl1012.patch storage/innobase/lock/lock0lock.c: Import patch wl1012.patch storage/innobase/row/row0mysql.c: Import patch wl1012.patch storage/innobase/row/row0sel.c: Import patch wl1012.patch storage/innobase/row/row0vers.c: Import patch wl1012.patch
This commit is contained in:
47
mysql-test/extra/rpl_tests/rpl000006.test
Normal file
47
mysql-test/extra/rpl_tests/rpl000006.test
Normal file
@ -0,0 +1,47 @@
|
||||
#
|
||||
# Test forced timestamp
|
||||
#
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Don't log table creating to the slave as we want to test LOAD TABLE
|
||||
set SQL_LOG_BIN=0,timestamp=200006;
|
||||
create table t1(t timestamp not null,a char(1));
|
||||
insert into t1 ( a) values ('F');
|
||||
select unix_timestamp(t) from t1;
|
||||
connection slave;
|
||||
load table t1 from master;
|
||||
select unix_timestamp(t) from t1;
|
||||
|
||||
# Delete the created table on master and slave
|
||||
connection master;
|
||||
set SQL_LOG_BIN=1,timestamp=default;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
connection master;
|
||||
|
||||
#
|
||||
# Test copying table with checksum
|
||||
#
|
||||
|
||||
# Don't log table creating to the slave as we want to test LOAD TABLE
|
||||
set SQL_LOG_BIN=0;
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int not null
|
||||
) ENGINE=$engine_type MAX_ROWS=4000 CHECKSUM=1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
load table t1 from master;
|
||||
check table t1;
|
||||
drop table t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
103
mysql-test/extra/rpl_tests/rpl_auto_increment.test
Normal file
103
mysql-test/extra/rpl_tests/rpl_auto_increment.test
Normal file
@ -0,0 +1,103 @@
|
||||
#
|
||||
# Test of auto_increment with offset
|
||||
#
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3;
|
||||
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2;
|
||||
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
|
||||
delete from t1 where b=4;
|
||||
insert into t1 values (NULL,5),(NULL,6);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
|
||||
drop table t1;
|
||||
|
||||
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
|
||||
show variables like "%auto_inc%";
|
||||
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL);
|
||||
insert into t1 values (250),(NULL);
|
||||
select * from t1;
|
||||
insert into t1 values (1000);
|
||||
set @@insert_id=400;
|
||||
insert into t1 values(NULL),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Same test with innodb (as the innodb code is a bit different)
|
||||
#
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL);
|
||||
insert into t1 values (250),(NULL);
|
||||
select * from t1;
|
||||
insert into t1 values (1000);
|
||||
set @@insert_id=400;
|
||||
insert into t1 values(NULL),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL),(NULL);
|
||||
insert into t1 values (500),(NULL),(502),(NULL),(NULL);
|
||||
select * from t1;
|
||||
set @@insert_id=600;
|
||||
--error 1062
|
||||
insert into t1 values(600),(NULL),(NULL);
|
||||
set @@insert_id=600;
|
||||
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that auto-increment works when slave has rows in the table
|
||||
#
|
||||
set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
|
||||
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
|
||||
|
||||
sync_slave_with_master;
|
||||
insert into t1 values(2),(12),(22),(32),(42);
|
||||
connection master;
|
||||
|
||||
insert into t1 values (NULL),(NULL);
|
||||
insert into t1 values (3),(NULL),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# End cleanup
|
||||
sync_slave_with_master;
|
22
mysql-test/extra/rpl_tests/rpl_commit_after_flush.test
Normal file
22
mysql-test/extra/rpl_tests/rpl_commit_after_flush.test
Normal file
@ -0,0 +1,22 @@
|
||||
#################################
|
||||
# Test updated to use a wrapper #
|
||||
#################################
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
|
||||
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
flush tables with read lock;
|
||||
commit;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# cleanup
|
||||
connection master;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
510
mysql-test/extra/rpl_tests/rpl_ddl.test
Normal file
510
mysql-test/extra/rpl_tests/rpl_ddl.test
Normal file
@ -0,0 +1,510 @@
|
||||
######################## rpl_ddl.test ########################
|
||||
# #
|
||||
# DDL statements (sometimes with implicit COMMIT) executed #
|
||||
# by the master and it's propagation into the slave #
|
||||
# #
|
||||
##############################################################
|
||||
|
||||
#
|
||||
# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
|
||||
#
|
||||
# 1. !All! objects to be dropped, renamed, altered ... must be created
|
||||
# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
|
||||
# sequences start.
|
||||
#
|
||||
# 2. Never use a test object, which was direct or indirect affected by a
|
||||
# preceeding test sequence again.
|
||||
# Except table d1.t1 where ONLY DML is allowed.
|
||||
#
|
||||
# If one preceeding test sequence hits a (sometimes not good visible,
|
||||
# because the sql error code of the statement might be 0) bug
|
||||
# and these rules are ignored, a following test sequence might earn ugly
|
||||
# effects like failing 'sync_slave_with_master', crashes of the slave or
|
||||
# abort of the test case etc..
|
||||
#
|
||||
# 3. The assignment of the DDL command to be tested to $my_stmt can
|
||||
# be a bit difficult. "'" must be avoided, because the test
|
||||
# routine "include/rpl_stmt_seq.inc" performs a
|
||||
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
|
||||
#
|
||||
|
||||
###############################################################
|
||||
# Some preparations
|
||||
###############################################################
|
||||
# The sync_slave_with_master is needed to make the xids deterministic.
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
#
|
||||
# 1. DROP all objects, which probably already exist, but must be created here
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
DROP DATABASE IF EXISTS mysqltest2;
|
||||
DROP DATABASE IF EXISTS mysqltest3;
|
||||
--enable_warnings
|
||||
#
|
||||
# 2. CREATE all objects needed
|
||||
# working database is mysqltest1
|
||||
# working (transactional!) is mysqltest1.t1
|
||||
#
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE DATABASE mysqltest2;
|
||||
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
||||
INSERT INTO mysqltest1.t1 SET f1= 0;
|
||||
eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=$engine_type;
|
||||
CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
|
||||
eval CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=$engine_type;
|
||||
INSERT INTO mysqltest1.t7 SET f1= 0;
|
||||
eval CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type;
|
||||
CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT);
|
||||
|
||||
#
|
||||
# 3. master sessions: never do AUTOCOMMIT
|
||||
# slave sessions: never do AUTOCOMMIT
|
||||
#
|
||||
SET AUTOCOMMIT = 0;
|
||||
use mysqltest1;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SET AUTOCOMMIT = 0;
|
||||
use mysqltest1;
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
|
||||
# We don't want to abort the whole test if one statement sent
|
||||
# to the server gets an error, because the following test
|
||||
# sequences are nearly independend of the previous statements.
|
||||
--disable_abort_on_error
|
||||
|
||||
###############################################################
|
||||
# Banal case: (explicit) COMMIT and ROLLBACK
|
||||
# Just for checking if the test sequence is usable
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= COMMIT;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $my_stmt= ROLLBACK;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
###############################################################
|
||||
# Cases with commands very similar to COMMIT
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= SET AUTOCOMMIT=1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SET AUTOCOMMIT=0;
|
||||
|
||||
let $my_stmt= START TRANSACTION;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $my_stmt= BEGIN;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
###############################################################
|
||||
# Cases with (BASE) TABLES and (UPDATABLE) VIEWs
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= DROP TABLE mysqltest1.t2;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TABLES LIKE 't2';
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SHOW TABLES LIKE 't2';
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
# Note: Since this test is executed with a skip-innodb slave, the
|
||||
# slave incorrectly commits the insert. One can *not* have InnoDB on
|
||||
# master and MyISAM on slave and expect that a transactional rollback
|
||||
# after a CREATE TEMPORARY TABLE should work correctly on the slave.
|
||||
# For this to work properly the handler on the slave must be able to
|
||||
# handle transactions (e.g. InnoDB or NDB).
|
||||
let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TABLES LIKE 't23';
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SHOW TABLES LIKE 't23';
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TABLES LIKE 't20';
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SHOW TABLES LIKE 't20';
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
describe mysqltest1.t4;
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
describe mysqltest1.t4;
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE=;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq2.inc
|
||||
|
||||
# Note: Since this test is executed with a skip-innodb slave, the
|
||||
# slave incorrectly commits the insert. One can *not* have InnoDB on
|
||||
# master and MyISAM on slave and expect that a transactional rollback
|
||||
# after a CREATE TEMPORARY TABLE should work correctly on the slave.
|
||||
# For this to work properly the handler on the slave must be able to
|
||||
# handle transactions (e.g. InnoDB or NDB).
|
||||
let $engine='';
|
||||
let $eng_type='';
|
||||
|
||||
let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT);
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT * FROM mysqltest1.t7;
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SELECT * FROM mysqltest1.t7;
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
###############################################################
|
||||
# Cases with LOCK/UNLOCK
|
||||
###############################################################
|
||||
|
||||
# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an
|
||||
# INSERT into this table.
|
||||
let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
UNLOCK TABLES;
|
||||
|
||||
# No prior locking
|
||||
let $my_stmt= UNLOCK TABLES;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
# With prior read locking
|
||||
# Note that this test generate an error since the rpl_stmt_seq.inc
|
||||
# tries to insert into t1.
|
||||
LOCK TABLES mysqltest1.t1 READ;
|
||||
let $my_stmt= UNLOCK TABLES;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
# With prior write locking
|
||||
LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
|
||||
let $my_stmt= UNLOCK TABLES;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
###############################################################
|
||||
# Cases with INDEXES
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW INDEX FROM mysqltest1.t6;
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SHOW INDEX FROM mysqltest1.t6;
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW INDEX FROM mysqltest1.t5;
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SHOW INDEX FROM mysqltest1.t5;
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
###############################################################
|
||||
# Cases with DATABASE
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= DROP DATABASE mysqltest2;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW DATABASES LIKE "mysqltest2";
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SHOW DATABASES LIKE "mysqltest2";
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
let $my_stmt= CREATE DATABASE mysqltest3;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW DATABASES LIKE "mysqltest3";
|
||||
connection slave;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave --------' as "";
|
||||
--enable_query_log
|
||||
SHOW DATABASES LIKE "mysqltest3";
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to master -------' as "";
|
||||
--enable_query_log
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
###############################################################
|
||||
# Cases with stored procedures
|
||||
###############################################################
|
||||
let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--vertical_results
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
connection master;
|
||||
--horizontal_results
|
||||
|
||||
let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--vertical_results
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
connection master;
|
||||
--horizontal_results
|
||||
|
||||
let $my_stmt= DROP PROCEDURE p1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--vertical_results
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
connection master;
|
||||
--horizontal_results
|
||||
|
||||
###############################################################
|
||||
# Cases with VIEWs
|
||||
###############################################################
|
||||
let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW CREATE VIEW v1;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SHOW CREATE VIEW v1;
|
||||
connection master;
|
||||
|
||||
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW CREATE VIEW v1;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SHOW CREATE VIEW v1;
|
||||
connection master;
|
||||
|
||||
let $my_stmt= DROP VIEW IF EXISTS v1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--error 1146
|
||||
SHOW CREATE VIEW v1;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
--error 1146
|
||||
SHOW CREATE VIEW v1;
|
||||
connection master;
|
||||
|
||||
###############################################################
|
||||
# Cases with TRIGGERs
|
||||
###############################################################
|
||||
let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TRIGGERS;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SHOW TRIGGERS;
|
||||
connection master;
|
||||
|
||||
let $my_stmt= DROP TRIGGER trg1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TRIGGERS;
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SHOW TRIGGERS;
|
||||
connection master;
|
||||
|
||||
###############################################################
|
||||
# Cases with USERs
|
||||
###############################################################
|
||||
let $my_stmt= CREATE USER user1@localhost;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT user FROM mysql.user WHERE user = 'user1';
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SELECT user FROM mysql.user WHERE user = 'user1';
|
||||
connection master;
|
||||
|
||||
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
connection master;
|
||||
|
||||
let $my_stmt= DROP USER rename1@localhost;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
--disable_query_log
|
||||
SELECT '-------- switch to slave -------' as "";
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
connection master;
|
||||
|
||||
###############################################################
|
||||
# Cleanup
|
||||
###############################################################
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
DROP DATABASE IF EXISTS mysqltest2;
|
||||
DROP DATABASE IF EXISTS mysqltest3;
|
||||
--enable_warnings
|
||||
|
||||
|
112
mysql-test/extra/rpl_tests/rpl_deadlock.test
Normal file
112
mysql-test/extra/rpl_tests/rpl_deadlock.test
Normal file
@ -0,0 +1,112 @@
|
||||
# See if slave restarts the transaction after failing on an InnoDB deadlock error.
|
||||
|
||||
# Note: testing what happens when too many retries is possible, but
|
||||
# needs large waits when running with --debug, so we don't do it.
|
||||
# The same way, this test may not test what is expected when run
|
||||
# under Valgrind, timings are too short then (with --valgrind I
|
||||
# (Guilhem) have seen the test manage to provoke lock wait timeout
|
||||
# error but not deadlock error; that is ok as code deals with the two
|
||||
# errors in exactly the same way.
|
||||
# We don't 'show status like 'slave_retried_transactions'' because this
|
||||
# is not repeatable (depends on sleeps).
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t3 (a INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
|
||||
show variables like 'slave_transaction_retries';
|
||||
sync_slave_with_master;
|
||||
|
||||
show create table t1;
|
||||
show create table t2;
|
||||
show variables like 'slave_transaction_retries';
|
||||
stop slave;
|
||||
|
||||
# 1) Test deadlock
|
||||
|
||||
connection master;
|
||||
begin;
|
||||
# Let's keep BEGIN and the locked statement in two different relay logs.
|
||||
let $1=200;
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t3 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
insert into t3 select * from t2 for update;
|
||||
insert into t1 values(1);
|
||||
commit;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
begin;
|
||||
# Let's make our transaction large so that it's slave who is chosen as
|
||||
# victim
|
||||
let $1=1000;
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t4 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
select * from t1 for update;
|
||||
start slave;
|
||||
--real_sleep 3 # hope that slave is blocked now
|
||||
insert into t2 values(22); # provoke deadlock, slave should be victim
|
||||
commit;
|
||||
sync_with_master;
|
||||
select * from t1; # check that slave succeeded finally
|
||||
select * from t2;
|
||||
# check that no error is reported
|
||||
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
show slave status;
|
||||
|
||||
# 2) Test lock wait timeout
|
||||
|
||||
stop slave;
|
||||
change master to master_log_pos=536; # the BEGIN log event
|
||||
begin;
|
||||
select * from t2 for update; # hold lock
|
||||
start slave;
|
||||
--real_sleep 10 # slave should have blocked, and be retrying
|
||||
commit;
|
||||
sync_with_master;
|
||||
select * from t1; # check that slave succeeded finally
|
||||
select * from t2;
|
||||
# check that no error is reported
|
||||
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
show slave status;
|
||||
|
||||
# Now we repeat 2), but with BEGIN in the same relay log as
|
||||
# COMMIT (to see if seeking into hot log is ok).
|
||||
|
||||
set global max_relay_log_size=0;
|
||||
|
||||
# This is really copy-paste of 2) of above
|
||||
stop slave;
|
||||
change master to master_log_pos=536;
|
||||
begin;
|
||||
select * from t2 for update;
|
||||
start slave;
|
||||
--real_sleep 10
|
||||
commit;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
show slave status;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2,t3,t4;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
19
mysql-test/extra/rpl_tests/rpl_delete_no_where.test
Normal file
19
mysql-test/extra/rpl_tests/rpl_delete_no_where.test
Normal file
@ -0,0 +1,19 @@
|
||||
# Test to see if a DELETE which triggers a fast deletion of all rows
|
||||
# (not internally row-per-row but more like a TRUNCATE, MyISAM
|
||||
# supports that), is replicated (BUG#13576).
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval create table t1 (a int, b int) engine=$engine_type;
|
||||
insert into t1 values(1,1);
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
delete from t1;
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
|
||||
# cleanup
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
62
mysql-test/extra/rpl_tests/rpl_err_ignoredtable.test
Normal file
62
mysql-test/extra/rpl_tests/rpl_err_ignoredtable.test
Normal file
@ -0,0 +1,62 @@
|
||||
# Test for
|
||||
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
|
||||
# still checks that it has the same error as on the master.
|
||||
|
||||
# Requires statement logging
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection master;
|
||||
create table t1 (a int primary key);
|
||||
# generate an error that goes to the binlog
|
||||
--error 1062
|
||||
insert into t1 values (1),(1);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# as the t1 table is ignored on the slave, the slave should be able to sync
|
||||
sync_with_master;
|
||||
# The port number is different when doing the release build with
|
||||
# Do-compile, hence we have to replace the port number here accordingly
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
show slave status;
|
||||
# check that the table has been ignored, because otherwise the test is nonsense
|
||||
show tables like 't1';
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# Now test that even critical errors (connection killed)
|
||||
# are ignored if rules allow it.
|
||||
# The "kill" idea was copied from rpl000001.test.
|
||||
|
||||
connection master1;
|
||||
select get_lock('crash_lock%20C', 10);
|
||||
|
||||
connection master;
|
||||
create table t2 (a int primary key);
|
||||
insert into t2 values(1);
|
||||
create table t3 (id int);
|
||||
insert into t3 values(connection_id());
|
||||
send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
|
||||
|
||||
connection master1;
|
||||
real_sleep 2;
|
||||
select (@id := id) - id from t3;
|
||||
kill @id;
|
||||
drop table t2,t3;
|
||||
connection master;
|
||||
--error 0,1053,2013
|
||||
reap;
|
||||
connection master1;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# SQL slave thread should not have stopped (because table of the killed
|
||||
# query is in the ignore list).
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
|
19
mysql-test/extra/rpl_tests/rpl_failed_optimize.test
Normal file
19
mysql-test/extra/rpl_tests/rpl_failed_optimize.test
Normal file
@ -0,0 +1,19 @@
|
||||
-- source include/master-slave.inc
|
||||
|
||||
#
|
||||
# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
|
||||
# Replication should work when OPTIMIZE TABLE timeouts, and
|
||||
# when OPTIMIZE TABLE is executed on a non-existing table
|
||||
#
|
||||
|
||||
eval CREATE TABLE t1 ( a int ) ENGINE=$engine_type;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
connection master1;
|
||||
OPTIMIZE TABLE t1;
|
||||
|
||||
OPTIMIZE TABLE non_existing;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
50
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
Normal file
50
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
Normal file
@ -0,0 +1,50 @@
|
||||
# depends on the binlog output
|
||||
# Test of replicating FLUSH TABLES to make
|
||||
# RENAME TABLE work with MERGE tables on the slave.
|
||||
# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
|
||||
#
|
||||
-- source include/master-slave.inc
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (10);
|
||||
create table t2 (a int);
|
||||
create table t3 (a int) engine=merge union(t1);
|
||||
create table t4 (a int);
|
||||
# We force the slave to open t3 (because we want to try confusing him) with this :
|
||||
insert into t4 select * from t3;
|
||||
rename table t1 to t5, t2 to t1;
|
||||
# RENAME may have confused the master (this is a known bug): so FLUSH tables,
|
||||
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
|
||||
flush no_write_to_binlog tables;
|
||||
# Check that it's not in the binlog.
|
||||
--replace_result $SERVER_VERSION SERVER_VERSION
|
||||
--replace_column 2 # 5 #
|
||||
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
||||
# Check that the master is not confused.
|
||||
select * from t3;
|
||||
# This FLUSH should go into the binlog to not confuse the slave.
|
||||
flush tables;
|
||||
# Check that it's in the binlog.
|
||||
--replace_result $SERVER_VERSION SERVER_VERSION
|
||||
--replace_column 2 # 5 #
|
||||
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# Check that the slave is not confused.
|
||||
select * from t3;
|
||||
# Note that all this confusion may cause warnings 'table xx is open on rename'
|
||||
# in the .err files; these are not fatal and are not reported by mysql-test-run.
|
||||
|
||||
stop slave;
|
||||
connection master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
flush tables with read lock;
|
||||
start slave;
|
||||
sleep 1;
|
||||
--error 1192
|
||||
stop slave;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
32
mysql-test/extra/rpl_tests/rpl_foreign_key.test
Normal file
32
mysql-test/extra/rpl_tests/rpl_foreign_key.test
Normal file
@ -0,0 +1,32 @@
|
||||
# Check the replication of the FOREIGN_KEY_CHECKS variable.
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=$engine_type;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
INSERT INTO t1 VALUES (10);
|
||||
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
|
||||
INSERT INTO t2 VALUES (5,0);
|
||||
INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID());
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
SET TIMESTAMP=1000000000;
|
||||
CREATE TABLE t3 ( a INT UNIQUE );
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
--error 1062
|
||||
INSERT INTO t3 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
|
78
mysql-test/extra/rpl_tests/rpl_insert_id.test
Normal file
78
mysql-test/extra/rpl_tests/rpl_insert_id.test
Normal file
@ -0,0 +1,78 @@
|
||||
# See if queries that use both auto_increment and LAST_INSERT_ID()
|
||||
# are replicated well
|
||||
|
||||
# We also check how the foreign_key_check variable is replicated
|
||||
|
||||
-- source include/master-slave.inc
|
||||
#should work for both SBR and RBR
|
||||
|
||||
connection master;
|
||||
create table t1(a int auto_increment, key(a));
|
||||
create table t2(b int auto_increment, c int, key(b));
|
||||
insert into t1 values (1),(2),(3);
|
||||
insert into t1 values (null);
|
||||
insert into t2 values (null,last_insert_id());
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
connection master;
|
||||
#check if multi-line inserts,
|
||||
#which set last_insert_id to the first id inserted,
|
||||
#are replicated the same way
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
--disable_warnings
|
||||
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
|
||||
eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
|
||||
--enable_warnings
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
insert into t1 values (10);
|
||||
insert into t1 values (null),(null),(null);
|
||||
insert into t2 values (5,0);
|
||||
insert into t2 values (null,last_insert_id());
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
connection master;
|
||||
|
||||
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
|
||||
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
create table t1(a int auto_increment, key(a));
|
||||
create table t2(b int auto_increment, c int, key(b));
|
||||
insert into t1 values (10);
|
||||
insert into t1 values (null),(null),(null);
|
||||
insert into t2 values (5,0);
|
||||
insert into t2 (c) select * from t1;
|
||||
select * from t2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
#
|
||||
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
|
||||
# FOREIGN_KEY_CHECKS
|
||||
#
|
||||
connection master;
|
||||
SET TIMESTAMP=1000000000;
|
||||
CREATE TABLE t1 ( a INT UNIQUE );
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
--error 1062
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
71
mysql-test/extra/rpl_tests/rpl_insert_ignore.test
Normal file
71
mysql-test/extra/rpl_tests/rpl_insert_ignore.test
Normal file
@ -0,0 +1,71 @@
|
||||
# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB"
|
||||
# The bug was that if on master, INSERT IGNORE ignored some
|
||||
# rows, and the table was InnoDB with auto_inc column, then on slave
|
||||
# some rows received an auto_inc bigger than on master.
|
||||
# Slave needs to be started with --innodb to store table in InnoDB.
|
||||
# Same test for MyISAM (which had no bug).
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
unique (b)
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned, # to force INSERT SELECT to have a certain order
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 4);
|
||||
|
||||
# An alternation of values which will conflict in t1 and will not.
|
||||
|
||||
INSERT INTO t2 VALUES (1, 1);
|
||||
INSERT INTO t2 VALUES (2, 2);
|
||||
INSERT INTO t2 VALUES (3, 5);
|
||||
INSERT INTO t2 VALUES (4, 3);
|
||||
INSERT INTO t2 VALUES (5, 4);
|
||||
INSERT INTO t2 VALUES (6, 6);
|
||||
|
||||
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
|
||||
|
||||
# Compare results
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# Now do the same for MyISAM
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
unique (b)
|
||||
) ENGINE=$engine_type2;
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (3, 3);
|
||||
INSERT INTO t1 VALUES (4, 4);
|
||||
|
||||
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
156
mysql-test/extra/rpl_tests/rpl_loaddata.test
Normal file
156
mysql-test/extra/rpl_tests/rpl_loaddata.test
Normal file
@ -0,0 +1,156 @@
|
||||
# Requires statement logging
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
# See if replication of a "LOAD DATA in an autoincrement column"
|
||||
# Honours autoincrement values
|
||||
# i.e. if the master and slave have the same sequence
|
||||
#
|
||||
# check replication of load data for temporary tables with additional
|
||||
# parameters
|
||||
#
|
||||
# check if duplicate entries trigger an error (they should unless IGNORE or
|
||||
# REPLACE was used on the master) (bug 571).
|
||||
#
|
||||
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
|
||||
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection slave;
|
||||
reset master;
|
||||
connection master;
|
||||
|
||||
create table t1(a int not null auto_increment, b int, primary key(a) );
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
|
||||
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
|
||||
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
|
||||
|
||||
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
|
||||
insert into t3 select * from t2;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
select * from t1;
|
||||
select * from t3;
|
||||
# We want to be sure that LOAD DATA is in the slave's binlog.
|
||||
# But we can't simply read this binlog, because as the slave has not been
|
||||
# restarted for this test, the file_id is uncertain (would cause test
|
||||
# failures). So instead, we test if the binlog looks long enough to
|
||||
# contain LOAD DATA. Since 5.0.3 we assume that binlog of 1292 is ok.
|
||||
# If LOAD DATA was not logged, the binlog would be shorter.
|
||||
show master status;
|
||||
|
||||
connection master;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
create table t1(a int, b int, unique(b));
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# See if slave stops when there's a duplicate entry for key error in LOAD DATA
|
||||
|
||||
insert into t1 values(1,10);
|
||||
|
||||
connection master;
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# The SQL slave thread should be stopped now.
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
|
||||
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
|
||||
# takes us directly to the end of the relay log).
|
||||
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
# Trigger error again to test CHANGE MASTER
|
||||
|
||||
connection master;
|
||||
set sql_log_bin=0;
|
||||
delete from t1;
|
||||
set sql_log_bin=1;
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# The SQL slave thread should be stopped now.
|
||||
# Exec_Master_Log_Pos should point to the start of Execute event
|
||||
# for last load data.
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
|
||||
stop slave;
|
||||
change master to master_user='test';
|
||||
change master to master_user='root';
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
# Trigger error again to test RESET SLAVE
|
||||
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
connection master;
|
||||
set sql_log_bin=0;
|
||||
delete from t1;
|
||||
set sql_log_bin=1;
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# The SQL slave thread should be stopped now.
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
|
||||
stop slave;
|
||||
reset slave;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
|
||||
unique(day)) engine=$engine_type; # no transactions
|
||||
--error 1062
|
||||
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
'\n##\n' starting by '>' ignore 1 lines;
|
||||
select * from t2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
select * from t2;
|
||||
|
||||
# verify that if no error on slave, this is an error
|
||||
|
||||
alter table t2 drop key day;
|
||||
connection master;
|
||||
delete from t2;
|
||||
--error 1062
|
||||
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
'\n##\n' starting by '>' ignore 1 lines;
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
drop table t2;
|
||||
connection master;
|
||||
drop table t2;
|
||||
|
||||
# End of 4.1 tests
|
28
mysql-test/extra/rpl_tests/rpl_loaddata_m.test
Normal file
28
mysql-test/extra/rpl_tests/rpl_loaddata_m.test
Normal file
@ -0,0 +1,28 @@
|
||||
# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
|
||||
# exist.
|
||||
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
|
||||
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
connection slave;
|
||||
stop slave; # don't need slave for this test
|
||||
|
||||
# Test logging on master
|
||||
|
||||
connection master;
|
||||
# 'test' is the current database
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
create table t1(a int, b int, unique(b));
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
# Starting from 5.0.3 LOAD DATA is replicated much in the same way as ordinary
|
||||
# query so "show binlog ..." should show two events (before 5.0.3 no events
|
||||
# were returned).
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102;
|
||||
drop database mysqltest;
|
119
mysql-test/extra/rpl_tests/rpl_log.test
Normal file
119
mysql-test/extra/rpl_tests/rpl_log.test
Normal file
@ -0,0 +1,119 @@
|
||||
# Requires statement logging
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Clean up old slave's binlogs.
|
||||
# The slave is started with --log-slave-updates
|
||||
# and this test does SHOW BINLOG EVENTS on the slave's
|
||||
# binlog. But previous tests can influence the current test's
|
||||
# binlog (e.g. a temporary table in the previous test has not
|
||||
# been explicitly deleted, and at the beginning of the current
|
||||
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
|
||||
# We wait for the slave to have written all he wants to the binlog
|
||||
# (otherwise RESET MASTER may come too early).
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
stop slave;
|
||||
reset master;
|
||||
reset slave;
|
||||
# We are going to read the slave's binlog which contains file_id (for some LOAD
|
||||
# DATA INFILE); to make it repeatable (not influenced by other tests), we need
|
||||
# to stop and start the slave, to be sure file_id will start from 1.
|
||||
# This can be done with 'server_stop slave', but
|
||||
# this would require the manager, so most of the time the test will be skipped
|
||||
# :(
|
||||
# To workaround this, I (Guilhem) add a (empty) rpl_log-slave.opt (because when
|
||||
# mysql-test-run finds such a file it restarts the slave before doing the
|
||||
# test). That's not very elegant but I could find no better way, sorry.
|
||||
|
||||
let $VERSION=`select version()`;
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
create table t1(n int not null auto_increment primary key);
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
create table t1 (word char(20) not null);
|
||||
load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
|
||||
select count(*) from t1;
|
||||
drop table t1;
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102 limit 1;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102 limit 2;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102 limit 2,1;
|
||||
flush logs;
|
||||
|
||||
# We need an extra update before doing save_master_pos.
|
||||
# Otherwise, an unlikely scenario may occur:
|
||||
# * When the master's binlog_dump thread reads the end of master-bin.001,
|
||||
# it send the rotate event which is at this end, plus a fake rotate event
|
||||
# because it's starting to read a new binlog.
|
||||
# save_master_pos will record the position of the first of the two rotate
|
||||
# (because the fake one is not in the master's binlog anyway).
|
||||
# * Later the slave waits for the position of the first rotate event,
|
||||
# and it may quickly stop (in 'slave stop') without having received the fake
|
||||
# one.
|
||||
# So, depending on a few milliseconds, we end up with 2 rotate events in the
|
||||
# relay log or one, which influences the output of SHOW SLAVE STATUS, making
|
||||
# it not predictable and causing random test failures.
|
||||
# To make it predictable, we do a useless update now, but which has the
|
||||
# interest of making the slave catch both rotate events.
|
||||
|
||||
create table t5 (a int);
|
||||
drop table t5;
|
||||
|
||||
# Sync slave and force it to start on another binary log
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
|
||||
# to go into the relay log (the master always sends a fake one when replication
|
||||
# starts).
|
||||
start slave;
|
||||
sync_with_master;
|
||||
flush logs;
|
||||
stop slave;
|
||||
connection master;
|
||||
|
||||
# Create some entries for second log
|
||||
|
||||
create table t1 (n int);
|
||||
insert into t1 values (1);
|
||||
drop table t1;
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events;
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events in 'master-bin.000002';
|
||||
show binary logs;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
show binary logs;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events in 'slave-bin.000001' from 4;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events in 'slave-bin.000002' from 4;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
# Need to recode the following
|
||||
|
||||
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
|
||||
|
||||
--error 1220
|
||||
show binlog events in 'slave-bin.000005' from 4;
|
97
mysql-test/extra/rpl_tests/rpl_max_relay_size.test
Normal file
97
mysql-test/extra/rpl_tests/rpl_max_relay_size.test
Normal file
@ -0,0 +1,97 @@
|
||||
# Test of options max_binlog_size and max_relay_log_size and
|
||||
# how they act (if max_relay_log_size == 0, use max_binlog_size
|
||||
# for relay logs too).
|
||||
# Test of manual relay log rotation with FLUSH LOGS.
|
||||
|
||||
# Requires statement logging
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection slave;
|
||||
stop slave;
|
||||
connection master;
|
||||
# Generate a big enough master's binlog to cause relay log rotations
|
||||
|
||||
create table t1 (a int);
|
||||
let $1=800;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
# eval means expand $ expressions
|
||||
eval insert into t1 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
reset slave;
|
||||
set global max_binlog_size=8192;
|
||||
set global max_relay_log_size=8192-1; # mapped to 4096
|
||||
select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=(5*4096);
|
||||
select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=0;
|
||||
select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
# Tests below are mainly to ensure that we have not coded with wrong assumptions
|
||||
|
||||
stop slave;
|
||||
reset slave;
|
||||
# test of relay log rotation when the slave is stopped
|
||||
# (to make sure it does not crash).
|
||||
flush logs;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
reset slave;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
# test of relay log rotation when the slave is started
|
||||
flush logs;
|
||||
# We have now easy way to be sure that the SQL thread has now deleted the
|
||||
# log we just closed. But a trick to achieve this is do an update on the master.
|
||||
connection master;
|
||||
create table t1 (a int);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
# one more rotation, to be sure Relay_Log_Space is correctly updated
|
||||
flush logs;
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
connection master;
|
||||
# test that the absence of relay logs does not make a master crash
|
||||
flush logs;
|
||||
-- replace_column 3 <Binlog_Ignore_DB>
|
||||
show master status;
|
29
mysql-test/extra/rpl_tests/rpl_multi_query.test
Normal file
29
mysql-test/extra/rpl_tests/rpl_multi_query.test
Normal file
@ -0,0 +1,29 @@
|
||||
# Test for BUG#8436: verify that a multi-query (i.e. one query
|
||||
# containing several queries (assuming client has
|
||||
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
|
||||
# one binlog event containing all queries)
|
||||
|
||||
|
||||
# PS doesn't support multi-statements
|
||||
--disable_ps_protocol
|
||||
-- source include/master-slave.inc
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
create database mysqltest;
|
||||
|
||||
delimiter /;
|
||||
create table mysqltest.t1 ( n int);
|
||||
insert into mysqltest.t1 values(1)/
|
||||
insert into mysqltest.t1 values(2);
|
||||
insert into mysqltest.t1 values(3);
|
||||
insert into mysqltest.t1 values(4);
|
||||
insert into mysqltest.t1 values(5)/
|
||||
delimiter ;/
|
||||
sync_slave_with_master;
|
||||
select * from mysqltest.t1;
|
||||
connection master;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102;
|
||||
drop database mysqltest;
|
||||
sync_slave_with_master;
|
30
mysql-test/extra/rpl_tests/rpl_multi_update.test
Normal file
30
mysql-test/extra/rpl_tests/rpl_multi_update.test
Normal file
@ -0,0 +1,30 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
sync_slave_with_master;
|
62
mysql-test/extra/rpl_tests/rpl_multi_update2.test
Normal file
62
mysql-test/extra/rpl_tests/rpl_multi_update2.test
Normal file
@ -0,0 +1,62 @@
|
||||
# Let's verify that multi-update is not always skipped by slave if
|
||||
# some replicate-* rules exist.
|
||||
# (BUG#7011)
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#13236 multi-update with subquery & --replicate-ignore-table
|
||||
#
|
||||
reset master;
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (0);
|
||||
UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
|
||||
select * from t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
select * from t1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
220
mysql-test/extra/rpl_tests/rpl_multi_update3.test
Normal file
220
mysql-test/extra/rpl_tests/rpl_multi_update3.test
Normal file
@ -0,0 +1,220 @@
|
||||
-- source include/master-slave.inc
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Let's verify that multi-update with a subselect does not cause the slave to crash
|
||||
# (BUG#10442)
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Test for BUG#9361:
|
||||
# Subselects should work inside multi-updates
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 1 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a1 char(30),
|
||||
a2 int,
|
||||
a3 int,
|
||||
a4 char(30),
|
||||
a5 char(30)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
b1 int,
|
||||
b2 char(30)
|
||||
);
|
||||
|
||||
# Insert one row per table
|
||||
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
|
||||
INSERT INTO t2 VALUES (1, 'baz');
|
||||
|
||||
# This should update the row in t1
|
||||
UPDATE t1 a, t2
|
||||
SET a.a1 = 'No'
|
||||
WHERE a.a2 =
|
||||
(SELECT b1
|
||||
FROM t2
|
||||
WHERE b2 = 'baz')
|
||||
AND a.a3 IS NULL
|
||||
AND a.a4 = 'foo'
|
||||
AND a.a5 = 'bar';
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Second test for BUG#9361
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 2 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
i INT,
|
||||
j INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
i INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t3 (
|
||||
j INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
|
||||
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
|
||||
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
|
||||
|
||||
UPDATE t1 AS a
|
||||
INNER JOIN t2 AS b
|
||||
ON a.i = b.i
|
||||
INNER JOIN t3 AS c
|
||||
ON a.j = c.j AND b.k = c.k
|
||||
SET a.x = b.x,
|
||||
a.y = b.y,
|
||||
a.z = (
|
||||
SELECT sum(z)
|
||||
FROM t3
|
||||
WHERE y = 34
|
||||
)
|
||||
WHERE b.x = 23;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# BUG#12618
|
||||
#
|
||||
# TEST: Replication of a statement containing a join in a multi-update.
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
idp int(11) NOT NULL default '0',
|
||||
idpro int(11) default NULL,
|
||||
price decimal(19,4) default NULL,
|
||||
PRIMARY KEY (idp)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
idpro int(11) NOT NULL default '0',
|
||||
price decimal(19,4) default NULL,
|
||||
nbprice int(11) default NULL,
|
||||
PRIMARY KEY (idpro)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,'3.0000'),
|
||||
(2,2,'1.0000'),
|
||||
(3,1,'1.0000'),
|
||||
(4,1,'4.0000'),
|
||||
(5,3,'2.0000'),
|
||||
(6,2,'4.0000');
|
||||
|
||||
INSERT INTO t2 VALUES
|
||||
(1,'0.0000',0),
|
||||
(2,'0.0000',0),
|
||||
(3,'0.0000',0);
|
||||
|
||||
# This update sets t2 to the minimal prices for each product
|
||||
update
|
||||
t2
|
||||
join
|
||||
( select idpro, min(price) as min_price, count(*) as nbr_price
|
||||
from t1
|
||||
where idpro>0 and price>0
|
||||
group by idpro
|
||||
) as table_price
|
||||
on t2.idpro = table_price.idpro
|
||||
set t2.price = table_price.min_price,
|
||||
t2.nbprice = table_price.nbr_price;
|
||||
|
||||
select "-- MASTER AFTER JOIN --" as "";
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
select "-- SLAVE AFTER JOIN --" as "";
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
# End of 4.1 tests
|
75
mysql-test/extra/rpl_tests/rpl_relayrotate.test
Normal file
75
mysql-test/extra/rpl_tests/rpl_relayrotate.test
Normal file
@ -0,0 +1,75 @@
|
||||
# When the relay log gets rotated while the I/O thread
|
||||
# is reading a transaction, the transaction spans on two or more
|
||||
# relay logs. If STOP SLAVE occurs while the SQL thread is
|
||||
# executing a part of the transaction in the non-first relay logs,
|
||||
# we test if START SLAVE will resume in the beginning of the
|
||||
# transaction (i.e., step back to the first relay log)
|
||||
|
||||
# The slave is started with max_binlog_size=16384 bytes,
|
||||
# to force many rotations (approximately 30 rotations)
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection slave;
|
||||
stop slave;
|
||||
connection master;
|
||||
--disable_warnings
|
||||
eval create table t1 (a int) engine=$engine_type;
|
||||
--enable_warnings
|
||||
let $1=8000;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
# eval means expand $ expressions
|
||||
eval insert into t1 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
# This will generate a 500kB master's binlog,
|
||||
# which corresponds to 30 slave's relay logs.
|
||||
enable_query_log;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
reset slave;
|
||||
start slave;
|
||||
# We wait 1 sec for the SQL thread to be somewhere in
|
||||
# the middle of the transaction, hopefully not in
|
||||
# the first relay log, and hopefully before the COMMIT.
|
||||
# Usually it stops when the SQL thread is around the 15th relay log.
|
||||
# We cannot use MASTER_POS_WAIT() as master's position
|
||||
# increases only when the slave executes the COMMIT.
|
||||
# Note that except when using Valgrind, 1 second is enough for the I/O slave
|
||||
# thread to fetch the whole master's binlog.
|
||||
sleep 1;
|
||||
stop slave;
|
||||
# We suppose the SQL thread stopped before COMMIT.
|
||||
# If so the transaction was rolled back
|
||||
# and the table is now empty.
|
||||
# Now restart
|
||||
start slave;
|
||||
# And see if the table contains '8000'
|
||||
# which proves that the transaction restarted at
|
||||
# the right place.
|
||||
# We must wait for the transaction to commit before
|
||||
# reading, with a sync_with_master.
|
||||
sync_with_master;
|
||||
select max(a) from t1;
|
||||
connection master;
|
||||
|
||||
# The following DROP is a very important cleaning task:
|
||||
# imagine the next test is run with --skip-innodb: it will do
|
||||
# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
|
||||
# some data in the InnoDB datafile (because at that time mysqld
|
||||
# does not know about InnoDB : --skip-innodb). So if later in the
|
||||
# test suite a test wants to create an InnoDB table called t1, it
|
||||
# will fail with
|
||||
# InnoDB: Error: table t1 already exists in InnoDB internal
|
||||
# InnoDB: data dictionary. Have you deleted the .frm file etc
|
||||
drop table t1;
|
||||
# wait until this drop is executed on slave
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
51
mysql-test/extra/rpl_tests/rpl_reset_slave.test
Normal file
51
mysql-test/extra/rpl_tests/rpl_reset_slave.test
Normal file
@ -0,0 +1,51 @@
|
||||
# TBF - difference in row level logging
|
||||
# Temp tables are not replicated in rbr, but it is still good to hit rbr with everthing
|
||||
|
||||
# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the
|
||||
# --master-* options from mysqld, as this is what is going to be used next time
|
||||
# slave threads will be started). In bug 985, it displayed old values (of before
|
||||
# RESET SLAVE).
|
||||
# See if slave crashes when doing a CREATE TEMPORARY TABLE twice, separated by
|
||||
# RESET SLAVE.
|
||||
|
||||
-- source include/master-slave.inc
|
||||
connection master;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
stop slave;
|
||||
change master to master_user='test';
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
reset slave;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||
show slave status;
|
||||
|
||||
# test of crash with temp tables & RESET SLAVE
|
||||
# (test to see if RESET SLAVE clears temp tables in memory and disk)
|
||||
stop slave;
|
||||
reset slave;
|
||||
start slave;
|
||||
connection master;
|
||||
create temporary table t1 (a int);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
stop slave;
|
||||
reset slave;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
show status like 'slave_open_temp_tables';
|
84
mysql-test/extra/rpl_tests/rpl_row_001.test
Normal file
84
mysql-test/extra/rpl_tests/rpl_row_001.test
Normal file
@ -0,0 +1,84 @@
|
||||
-- source include/master-slave.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
CREATE TABLE t1 (word CHAR(20) NOT NULL);
|
||||
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
|
||||
SELECT * FROM t1 LIMIT 10;
|
||||
|
||||
#
|
||||
# Test slave with wrong password
|
||||
#
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
STOP SLAVE;
|
||||
connection master;
|
||||
SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
connection master;
|
||||
#
|
||||
# Give slave time to do at last one failed connect retry
|
||||
# This one must be short so that the slave will not stop retrying
|
||||
real_sleep 2;
|
||||
SET PASSWORD FOR root@"localhost" = PASSWORD('');
|
||||
# Give slave time to connect (will retry every second)
|
||||
sleep 2;
|
||||
|
||||
CREATE TABLE t3(n INT);
|
||||
INSERT INTO t3 VALUES(1),(2);
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t3;
|
||||
SELECT SUM(LENGTH(word)) FROM t1;
|
||||
connection master;
|
||||
DROP TABLE t1,t3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# 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
|
||||
eval CREATE TABLE t1 (n INT) ENGINE=$engine_type;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
connection master;
|
||||
let $1=5000;
|
||||
# Generate 16K of relay log
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 VALUES($1);
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
save_master_pos;
|
||||
|
||||
# Try to cause a large relay log lag on the slave by locking t1
|
||||
connection slave;
|
||||
LOCK TABLES t1 READ;
|
||||
START SLAVE;
|
||||
UNLOCK TABLES;
|
||||
sync_with_master;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (n INT);
|
||||
INSERT INTO t1 VALUES(3456);
|
||||
sync_slave_with_master;
|
||||
SELECT n FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
40
mysql-test/extra/rpl_tests/rpl_row_EE_err.test
Normal file
40
mysql-test/extra/rpl_tests/rpl_row_EE_err.test
Normal file
@ -0,0 +1,40 @@
|
||||
# The test is not relevant when testing replication of error codes for
|
||||
# statements that are not replicated. The test below could be changed
|
||||
# to rely on the replication of error codes for statements that are not
|
||||
# replicated row-based.
|
||||
|
||||
# This test does not work the same for row based as the insert in the second part is not replicated as a call but rather as a table map and row right. Have added a slave stop so the test will complete, other wise it just continues to loop waiting for a slave stop that never comes. 8/22/2005 JBM
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
# See if an EE_ error in one event of the master's binlog stops replication
|
||||
# (it should not: in this configuration the EE_ error is probably not
|
||||
# critical). Example: you do a DROP TABLE on a table which has no MYI file
|
||||
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
|
||||
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval create table t1 (a int) engine=$engine_type;
|
||||
flush tables;
|
||||
system rm ./var/master-data/test/t1.MYI ;
|
||||
drop table if exists t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# Now a real error.
|
||||
|
||||
connection master;
|
||||
eval create table t1 (a int, unique(a)) engine=$engine_type;
|
||||
set sql_log_bin=0;
|
||||
insert into t1 values(2);
|
||||
set sql_log_bin=1;
|
||||
save_master_pos;
|
||||
--error 1062
|
||||
insert into t1 values(1),(2);
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
stop slave;
|
||||
wait_for_slave_to_stop;
|
80
mysql-test/extra/rpl_tests/rpl_row_UUID.test
Normal file
80
mysql-test/extra/rpl_tests/rpl_row_UUID.test
Normal file
@ -0,0 +1,80 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/18/2005 #
|
||||
#############################################################################
|
||||
# TEST: To test the UUID() in rbr #
|
||||
#############################################################################
|
||||
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
|
||||
# Section 1 test
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=$engine_type;
|
||||
INSERT INTO test.t1 VALUES(1,UUID(),UUID());
|
||||
delimiter |;
|
||||
create procedure test.p1()
|
||||
begin
|
||||
INSERT INTO test.t1 VALUES(2,UUID(),UUID());
|
||||
INSERT INTO test.t1 VALUES(3,UUID(),UUID());
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
CALL test.p1();
|
||||
|
||||
# Now the same thing with a function
|
||||
|
||||
delimiter |;
|
||||
create function test.fn1(x int)
|
||||
returns int
|
||||
begin
|
||||
insert into t1 values (4+x,UUID(),UUID());
|
||||
insert into t1 values (5+x,UUID(),UUID());
|
||||
return 0;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
# test both in SELECT and in INSERT
|
||||
select fn1(0);
|
||||
create table t2 (a int);
|
||||
insert into t2 values(fn1(2));
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
|
||||
# Dump the databases and so we can see if they match
|
||||
# Another method would be to use SELECT INTO OUTFILE on master,
|
||||
# then LOAD DATA INFILE in slave, and use a query to compare.
|
||||
# This would have the advantage that it would not assume
|
||||
# the system has a 'diff'
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_UUID_slave.sql
|
||||
|
||||
connection master;
|
||||
# Let's cleanup
|
||||
|
||||
DROP PROCEDURE test.p1;
|
||||
DROP TABLE test.t1;
|
||||
|
||||
# Let's compare. Note: If they match test will pass, if they do not match
|
||||
# the test will show that the diff statement failed and not reject file
|
||||
# will be created. You will need to go to the mysql-test dir and diff
|
||||
# the files your self to see what is not matching :-)
|
||||
|
||||
--exec diff ./var/tmp/rpl_row_UUID_master.sql ./var/tmp/rpl_row_UUID_slave.sql;
|
||||
|
||||
# Cleanup dump files.
|
||||
# Long-term "system rm" is not portable; we could live without
|
||||
# this cleanup as no other test will use these files and they'll
|
||||
# be removed at next testsuite run.
|
||||
|
||||
# End of 5.0 test case
|
182
mysql-test/extra/rpl_tests/rpl_row_charset.test
Normal file
182
mysql-test/extra/rpl_tests/rpl_row_charset.test
Normal file
@ -0,0 +1,182 @@
|
||||
# Replication of character sets.
|
||||
# This test will fail if the server/client does not support enough charsets.
|
||||
|
||||
# Requires statement logging
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
-- source include/master-slave.inc
|
||||
--disable_warnings
|
||||
set timestamp=1000000000;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
--enable_warnings
|
||||
|
||||
create database mysqltest2 character set latin2;
|
||||
set @@character_set_server=latin5;
|
||||
create database mysqltest3;
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest2;
|
||||
show create database mysqltest3;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest2;
|
||||
show create database mysqltest3;
|
||||
|
||||
connection master;
|
||||
set @@collation_server=armscii8_bin;
|
||||
drop database mysqltest3;
|
||||
create database mysqltest3;
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest3;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest3;
|
||||
|
||||
connection master;
|
||||
use mysqltest2;
|
||||
create table t1 (a int auto_increment primary key, b varchar(100));
|
||||
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
|
||||
insert into t1 (b) values(@@character_set_server);
|
||||
insert into t1 (b) values(@@collation_server);
|
||||
# character_set_database and collation_database are not tested as they
|
||||
# needn't be replicated (Bar said in Jan 2005).
|
||||
insert into t1 (b) values(@@character_set_client);
|
||||
# collation_client does not exist
|
||||
insert into t1 (b) values(@@character_set_connection);
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
select "--- --muller--" as "";
|
||||
connection master;
|
||||
set character_set_client=latin1, collation_connection=latin1_german1_ci;
|
||||
truncate table t1;
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
|
||||
set collation_connection=latin1_german2_ci;
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
# Presently charset info is not logged with LOAD DATA but it will
|
||||
# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
|
||||
# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
|
||||
# here.
|
||||
|
||||
# See if user var is prefixed with collation in binlog and replicated well.
|
||||
# Note: replication of user variables is broken as far as derivation is
|
||||
# concerned. That's because when we store a user variable in the binlog,
|
||||
# we lose its derivation. So later on the slave, it's impossible to
|
||||
# know if the collation was explicit or not, so we use DERIVATION_NONE,
|
||||
# which provokes error messages (like 'Illegal mix of collation') when
|
||||
# we replay the master's INSERT/etc statements.
|
||||
|
||||
|
||||
select "--- --INSERT--" as "";
|
||||
connection master;
|
||||
set @a= _cp850 'M<>ller' collate cp850_general_ci;
|
||||
truncate table t1;
|
||||
insert into t1 (b) values(collation(@a));
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
connection master;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Check that we can change global.collation_server (since 5.0.3)
|
||||
|
||||
select "--- --global--" as "";
|
||||
set global character_set_server=latin2;
|
||||
set global character_set_server=latin1; # back
|
||||
connection master;
|
||||
set global character_set_server=latin2;
|
||||
set global character_set_server=latin1; # back
|
||||
|
||||
# Check that SET ONE_SHOT is really one shot
|
||||
|
||||
select "--- --oneshot--" as "";
|
||||
set one_shot @@character_set_server=latin5;
|
||||
set @@max_join_size=1000;
|
||||
select @@character_set_server;
|
||||
select @@character_set_server;
|
||||
set @@character_set_server=latin5;
|
||||
select @@character_set_server;
|
||||
select @@character_set_server;
|
||||
|
||||
# ONE_SHOT on not charset/collation stuff is not allowed
|
||||
-- error 1382
|
||||
set one_shot max_join_size=10;
|
||||
|
||||
# Test of wrong character set numbers;
|
||||
error 1115;
|
||||
set character_set_client=9999999;
|
||||
error 1273;
|
||||
set collation_server=9999998;
|
||||
|
||||
# This one was contributed by Sergey Petrunia (BUG#3943)
|
||||
|
||||
select "--- --3943--" as "";
|
||||
use test;
|
||||
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
|
||||
SET CHARACTER_SET_CLIENT=koi8r,
|
||||
CHARACTER_SET_CONNECTION=cp1251,
|
||||
CHARACTER_SET_RESULTS=koi8r;
|
||||
INSERT INTO t1 (c1, c2) VALUES ('<27><>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||||
select hex(c1), hex(c2) from t1;
|
||||
sync_slave_with_master;
|
||||
select hex(c1), hex(c2) from t1;
|
||||
|
||||
connection master;
|
||||
# Let's have a look at generated SETs.
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#6676: Derivation of variables must be correct on slave
|
||||
#
|
||||
select "--- --6676--" as "";
|
||||
connection master;
|
||||
eval create table `t1` (
|
||||
`pk` varchar(10) not null default '',
|
||||
primary key (`pk`)
|
||||
) engine=$engine_type default charset=latin1;
|
||||
set @p=_latin1 'test';
|
||||
update t1 set pk='test' where pk=@p;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
22
mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
Normal file
22
mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
Normal file
@ -0,0 +1,22 @@
|
||||
# See if INSERT DELAYED gets replicated
|
||||
# Only in row-based, as we do SHOW BINLOG EVENTS
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection master;
|
||||
let $VERSION=`select version()`;
|
||||
eval create table t1(a int not null primary key) engine=$engine_type;
|
||||
insert delayed into t1 values (1),(2),(3);
|
||||
flush tables;
|
||||
select * from t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
96
mysql-test/extra/rpl_tests/rpl_row_func003.test
Normal file
96
mysql-test/extra/rpl_tests/rpl_row_func003.test
Normal file
@ -0,0 +1,96 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/15/2005 #
|
||||
# Update: 08/29/2005 Comment out sleep. Only needed for debugging #
|
||||
#############################################################################
|
||||
# Note: Many lines are commented out in this test case. These were used for #
|
||||
# creating the test case and debugging and are being left for #
|
||||
# debugging, but they can not be used for the regular testing as the #
|
||||
# Time changes and is not deteministic, so instead we dump both the #
|
||||
# master and slave and diff the dumps. If the dumps differ then the #
|
||||
# test case will fail. To run during diff failuers, comment out the #
|
||||
# diff. #
|
||||
# Test: Tests MySQL stored function using RAND() and a flow control. The #
|
||||
# test inserts rows into a givin table with the function used in #
|
||||
# the insert statement. Depending on the RAND() value returned #
|
||||
# inside the function one set of text is returned. In addition, #
|
||||
# it uses a transaction to see the effect a rollback has on master #
|
||||
# Vs slave. #
|
||||
#############################################################################
|
||||
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP FUNCTION IF EXISTS test.f1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
|
||||
--enable_warnings
|
||||
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
create function test.f1() RETURNS CHAR(16)
|
||||
BEGIN
|
||||
DECLARE tmp CHAR(16);
|
||||
DECLARE var_name FLOAT;
|
||||
SET var_name = RAND();
|
||||
IF var_name > .6
|
||||
THEN SET tmp = 'Texas';
|
||||
ELSE SET tmp = 'MySQL';
|
||||
END IF;
|
||||
RETURN tmp;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
|
||||
sleep 6;
|
||||
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
|
||||
sleep 6;
|
||||
|
||||
#Select in this test are used for debugging
|
||||
#select * from test.t1;
|
||||
#connection slave;
|
||||
#select * from test.t1;
|
||||
|
||||
connection master;
|
||||
SET AUTOCOMMIT=0;
|
||||
START TRANSACTION;
|
||||
INSERT INTO test.t1 VALUES (null,test.f1());
|
||||
ROLLBACK;
|
||||
SET AUTOCOMMIT=1;
|
||||
#select * from test.t1;
|
||||
#sleep 6;
|
||||
|
||||
#connection slave;
|
||||
#select * from test.t1;
|
||||
|
||||
#connection master;
|
||||
|
||||
#used for debugging
|
||||
#show binlog events;
|
||||
|
||||
# time to dump the databases and so we can see if they match
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func003_slave.sql
|
||||
|
||||
# First lets cleanupi
|
||||
DROP FUNCTION test.f1;
|
||||
DROP TABLE test.t1;
|
||||
|
||||
|
||||
# the test will show that the diff statement failed and no reject file
|
||||
# will be created. You will need to go to the mysql-test dir and diff
|
||||
# the files yourself to see what is not matching :-) File are located
|
||||
# in mysql-test/var/tmp
|
||||
|
||||
exec diff ./var/tmp/func003_master.sql ./var/tmp/func003_slave.sql;
|
||||
|
||||
|
||||
# End of 5.0 test case
|
159
mysql-test/extra/rpl_tests/rpl_row_multi_update3.test
Normal file
159
mysql-test/extra/rpl_tests/rpl_row_multi_update3.test
Normal file
@ -0,0 +1,159 @@
|
||||
-- source include/master-slave.inc
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Let's verify that multi-update with a subselect does not cause the slave to crash
|
||||
# (BUG#10442)
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Test for BUG#9361:
|
||||
# Subselects should work inside multi-updates
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 1 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a1 char(30),
|
||||
a2 int,
|
||||
a3 int,
|
||||
a4 char(30),
|
||||
a5 char(30)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
b1 int,
|
||||
b2 char(30)
|
||||
);
|
||||
|
||||
# Insert one row per table
|
||||
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
|
||||
INSERT INTO t2 VALUES (1, 'baz');
|
||||
|
||||
# This should update the row in t1
|
||||
UPDATE t1 a, t2
|
||||
SET a.a1 = 'No'
|
||||
WHERE a.a2 =
|
||||
(SELECT b1
|
||||
FROM t2
|
||||
WHERE b2 = 'baz')
|
||||
AND a.a3 IS NULL
|
||||
AND a.a4 = 'foo'
|
||||
AND a.a5 = 'bar';
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Second test for BUG#9361
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 2 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
i INT,
|
||||
j INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
i INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t3 (
|
||||
j INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
|
||||
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
|
||||
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
|
||||
|
||||
UPDATE t1 AS a
|
||||
INNER JOIN t2 AS b
|
||||
ON a.i = b.i
|
||||
INNER JOIN t3 AS c
|
||||
ON a.j = c.j AND b.k = c.k
|
||||
SET a.x = b.x,
|
||||
a.y = b.y,
|
||||
a.z = (
|
||||
SELECT sum(z)
|
||||
FROM t3
|
||||
WHERE y = 34
|
||||
)
|
||||
WHERE b.x = 23;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2, t3;
|
239
mysql-test/extra/rpl_tests/rpl_row_sp002.test
Normal file
239
mysql-test/extra/rpl_tests/rpl_row_sp002.test
Normal file
@ -0,0 +1,239 @@
|
||||
#############################################################################
|
||||
# This test is being created to test out the non deterministic items with #
|
||||
# row based replication. #
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/09/2005 #
|
||||
# Updated: Aug/29/2005 #
|
||||
#############################################################################
|
||||
# Test: Contains two stored procedures test one that insert data into tables#
|
||||
# and use the LAST_INSERTED_ID() on tables with FOREIGN KEY(a) #
|
||||
# REFERENCES ON DELETE CASCADE. This test also has a delete sp that #
|
||||
# should cause a delete cascade. #
|
||||
# The second test has a sp that will either insert rows or delete from#
|
||||
# the table depending on the CASE outcome. The test uses this SP in a#
|
||||
# transaction first rolling back and then commiting, #
|
||||
#############################################################################
|
||||
# Mod Date: 08/22/2005 #
|
||||
# TEST: Added test to include UPDATE CASCADE on table with FK per Trudy #
|
||||
#############################################################################
|
||||
|
||||
|
||||
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP PROCEDURE IF EXISTS test.p3;
|
||||
DROP TABLE IF EXISTS test.t3;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type;
|
||||
eval CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
create procedure test.p1(IN i CHAR(6))
|
||||
begin
|
||||
INSERT INTO test.t1 (t) VALUES (i);
|
||||
INSERT INTO test.t2 VALUES (NULL,LAST_INSERT_ID());
|
||||
end|
|
||||
create procedure test.p2(IN i INT)
|
||||
begin
|
||||
DELETE FROM test.t1 where a < i;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
let $message=< -- test 1 call p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
call test.p1('texas');
|
||||
call test.p1('Live');
|
||||
call test.p1('next');
|
||||
call test.p1('to');
|
||||
call test.p1('OK');
|
||||
call test.p1('MySQL');
|
||||
|
||||
let $message=< -- test 1 select master after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 select slave after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 call p2 & select master -- >;
|
||||
--source include/show_msg.inc
|
||||
connection master;
|
||||
call test.p2(4);
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 select slave after p2 -- >;
|
||||
--source include/show_msg.inc
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
connection master;
|
||||
#show binlog events;
|
||||
let $message=< -- End test 1 Begin test 2 -- >;
|
||||
--source include/show_msg.inc
|
||||
# End test 1 Begin test 2
|
||||
|
||||
--disable_warnings
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT, t CHAR(6), PRIMARY KEY(a)) ENGINE=$engine_type;
|
||||
eval CREATE TABLE test.t2 (a INT, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON UPDATE CASCADE, PRIMARY KEY(a)) ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.p1(IN nm INT, IN ch CHAR(6))
|
||||
BEGIN
|
||||
INSERT INTO test.t1 (a,t) VALUES (nm, ch);
|
||||
INSERT INTO test.t2 VALUES (nm, LAST_INSERT_ID());
|
||||
END|
|
||||
CREATE PROCEDURE test.p2(IN i INT)
|
||||
BEGIN
|
||||
UPDATE test.t1 SET a = i*10 WHERE a = i;
|
||||
END|
|
||||
delimiter ;|
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
CALL test.p1(1,'texas');
|
||||
CALL test.p1(2,'Live');
|
||||
CALL test.p1(3,'next');
|
||||
CALL test.p1(4,'to');
|
||||
CALL test.p1(5,'OK');
|
||||
CALL test.p1(6,'MySQL');
|
||||
|
||||
let $message=< -- test 2 select Master after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 2 select Slave after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 2 call p2 & select Master -- >;
|
||||
--source include/show_msg.inc
|
||||
connection master;
|
||||
CALL test.p2(2);
|
||||
CALL test.p2(4);
|
||||
CALL test.p2(6);
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 select Slave after p2 -- >;
|
||||
--source include/show_msg.inc
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
connection master;
|
||||
#show binlog events;
|
||||
let $message=< -- End test 2 Begin test 3 -- >;
|
||||
--source include/show_msg.inc
|
||||
# End test 2 begin test 3
|
||||
|
||||
eval CREATE TABLE test.t3 (a INT AUTO_INCREMENT KEY, t CHAR(6))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.p3(IN n INT)
|
||||
begin
|
||||
CASE n
|
||||
WHEN 2 THEN
|
||||
DELETE from test.t3;
|
||||
ELSE
|
||||
INSERT INTO test.t3 VALUES (NULL,'NONE');
|
||||
END CASE;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
SET AUTOCOMMIT=0;
|
||||
START TRANSACTION;
|
||||
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
let $n=50;
|
||||
while ($n)
|
||||
{
|
||||
eval call test.p3($n);
|
||||
dec $n;
|
||||
}
|
||||
-- enable_result_log
|
||||
-- enable_query_log
|
||||
|
||||
ROLLBACK;
|
||||
select * from test.t3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from test.t3;
|
||||
|
||||
connection master;
|
||||
START TRANSACTION;
|
||||
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
let $n=50;
|
||||
while ($n>3)
|
||||
{
|
||||
eval call test.p3($n);
|
||||
dec $n;
|
||||
}
|
||||
-- enable_result_log
|
||||
-- enable_query_log
|
||||
|
||||
COMMIT;
|
||||
select * from test.t3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from test.t3;
|
||||
|
||||
connection master;
|
||||
#show binlog events from 1626;
|
||||
|
||||
|
||||
# First lets cleanup
|
||||
SET AUTOCOMMIT=1;
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP PROCEDURE IF EXISTS test.p3;
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
DROP TABLE IF EXISTS test.t3;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.0 test case
|
72
mysql-test/extra/rpl_tests/rpl_row_sp003.test
Normal file
72
mysql-test/extra/rpl_tests/rpl_row_sp003.test
Normal file
@ -0,0 +1,72 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/13/2005 Created from Bug 12335 #
|
||||
#############################################################################
|
||||
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
|
||||
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.p1()
|
||||
BEGIN
|
||||
INSERT INTO test.t1 VALUES (4);
|
||||
SELECT get_lock("test", 100);
|
||||
UPDATE test.t1 set a=a+4 WHERE a=4;
|
||||
END|
|
||||
CREATE PROCEDURE test.p2()
|
||||
BEGIN
|
||||
UPDATE test.t1 SET a=a+1;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
SELECT get_lock("test", 200);
|
||||
|
||||
connection master1;
|
||||
send CALL test.p1();
|
||||
|
||||
connection master;
|
||||
# To make sure tha the call on master1 arrived at the get_lock
|
||||
sleep 1;
|
||||
CALL test.p2();
|
||||
SELECT release_lock("test");
|
||||
SELECT * FROM test.t1;
|
||||
#show binlog events;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
CALL test.p2();
|
||||
CALL test.p1();
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM test.t1;
|
||||
connection master;
|
||||
#show binlog events from 719;
|
||||
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.0 test case
|
90
mysql-test/extra/rpl_tests/rpl_row_sp006.test
Normal file
90
mysql-test/extra/rpl_tests/rpl_row_sp006.test
Normal file
@ -0,0 +1,90 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/15/2005 #
|
||||
# Updated: 08/29/2005 to remove sleeps #
|
||||
#############################################################################
|
||||
# Test: This test uses two SPs, one to populate a table, and another to use #
|
||||
# Cursors, CURRENT_DATE(), loop control, date math and logic control #
|
||||
# to populate a table with data from the first table. #
|
||||
#############################################################################
|
||||
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
create database if not exists mysqltest1;
|
||||
DROP PROCEDURE IF EXISTS mysqltest1.p1;
|
||||
DROP PROCEDURE IF EXISTS mysqltest1.p2;
|
||||
DROP TABLE IF EXISTS mysqltest1.t2;
|
||||
DROP TABLE IF EXISTS mysqltest1.t1;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
|
||||
eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE mysqltest1.p1()
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT 0;
|
||||
DECLARE spa CHAR(16);
|
||||
DECLARE spb INT;
|
||||
DECLARE cur1 CURSOR FOR SELECT name,
|
||||
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
|
||||
FROM mysqltest1.t1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
||||
|
||||
OPEN cur1;
|
||||
|
||||
SET AUTOCOMMIT=0;
|
||||
REPEAT
|
||||
FETCH cur1 INTO spa, spb;
|
||||
IF NOT done THEN
|
||||
START TRANSACTION;
|
||||
INSERT INTO mysqltest1.t2 VALUES (spa,spb);
|
||||
COMMIT;
|
||||
END IF;
|
||||
UNTIL done END REPEAT;
|
||||
|
||||
SET AUTOCOMMIT=1;
|
||||
CLOSE cur1;
|
||||
END|
|
||||
CREATE PROCEDURE mysqltest1.p2()
|
||||
BEGIN
|
||||
INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
CALL mysqltest1.p2();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
CALL mysqltest1.p1();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > ./var/tmp/sp006_slave.sql
|
||||
|
||||
|
||||
DROP PROCEDURE IF EXISTS mysqltest1.p1;
|
||||
DROP PROCEDURE IF EXISTS mysqltest1.p2;
|
||||
DROP TABLE IF EXISTS mysqltest1.t1;
|
||||
DROP TABLE IF EXISTS mysqltest1.t2;
|
||||
|
||||
# Lets compare. Note: If they match test will pass, if they do not match
|
||||
# the test will show that the diff statement failed and not reject file
|
||||
# will be created. You will need to go to the mysql-test dir and diff
|
||||
# the files your self to see what is not matching :-) Failed test
|
||||
# Dump files will be located in mysql-test/var/tmp.
|
||||
|
||||
exec diff ./var/tmp/sp006_master.sql ./var/tmp/sp006_slave.sql;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.1 test case
|
70
mysql-test/extra/rpl_tests/rpl_row_sp007.test
Normal file
70
mysql-test/extra/rpl_tests/rpl_row_sp007.test
Normal file
@ -0,0 +1,70 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/15/2005 #
|
||||
# Updated: 08/29/2005 Remove sleeps #
|
||||
#############################################################################
|
||||
# TEST: SP that creates table, starts tranaction inserts. Save point, insert#
|
||||
# rollback to save point and then commits. #
|
||||
#############################################################################
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
delimiter |;
|
||||
eval CREATE PROCEDURE test.p1(IN i INT)
|
||||
BEGIN
|
||||
DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=$engine_type;
|
||||
START TRANSACTION;
|
||||
INSERT INTO test.t1 VALUES(i);
|
||||
savepoint t1_save;
|
||||
INSERT INTO test.t1 VALUES (14);
|
||||
ROLLBACK to savepoint t1_save;
|
||||
COMMIT;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
let $message=< ---- Master selects-- >;
|
||||
--source include/show_msg.inc
|
||||
CALL test.p1(12);
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
|
||||
let $message=< ---- Slave selects-- >;
|
||||
--source include/show_msg.inc
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
let $message=< ---- Master selects-- >;
|
||||
--source include/show_msg.inc
|
||||
connection master;
|
||||
CALL test.p1(13);
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
let $message=< ---- Slave selects-- >;
|
||||
--source include/show_msg.inc
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
connection master;
|
||||
#show binlog events;
|
||||
|
||||
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
|
||||
# End of 5.0 test case
|
129
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
Normal file
129
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
Normal file
@ -0,0 +1,129 @@
|
||||
# Test how replication of tables work when the definition on the
|
||||
# master and slave differs.
|
||||
|
||||
# Consider making these part of the basic RBR tests.
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t5 (a INT, b INT, c INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t6 (a INT, b INT, c INT) ENGINE=$engine_type;
|
||||
|
||||
# Table used to detect that slave is running
|
||||
eval CREATE TABLE t9 (a INT PRIMARY KEY) ENGINE=$engine_type;
|
||||
|
||||
sync_slave_with_master;
|
||||
# On the slave, we add one column last in table 't1',
|
||||
ALTER TABLE t1 ADD x INT DEFAULT 42;
|
||||
# ... add one column in the middle of table 't2', and
|
||||
ALTER TABLE t2 ADD x INT DEFAULT 42 AFTER a;
|
||||
# ... add one column first in table 't3'.
|
||||
ALTER TABLE t3 ADD x INT DEFAULT 42 FIRST;
|
||||
# ... change the type of the single column in table 't4'
|
||||
ALTER TABLE t4 MODIFY a FLOAT;
|
||||
# ... change the type of the middle column of table 't5'
|
||||
ALTER TABLE t5 MODIFY b FLOAT;
|
||||
# ... change the type of the last column of table 't6'
|
||||
ALTER TABLE t6 MODIFY c FLOAT;
|
||||
|
||||
# Each of these should generate an error and stop the slave
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (1);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--vertical_results
|
||||
SHOW SLAVE STATUS;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (2);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t2 VALUES (2,4);
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--vertical_results
|
||||
SHOW SLAVE STATUS;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (3);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t3 VALUES (3,6);
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--vertical_results
|
||||
SHOW SLAVE STATUS;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (4);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t4 VALUES (4);
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--vertical_results
|
||||
SHOW SLAVE STATUS;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (5);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t5 VALUES (5,10,25);
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--vertical_results
|
||||
SHOW SLAVE STATUS;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (6);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t6 VALUES (6,12,36);
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--vertical_results
|
||||
SHOW SLAVE STATUS;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t9;
|
||||
--enable_warnings
|
||||
sync_slave_with_master;
|
131
mysql-test/extra/rpl_tests/rpl_stm_000001.test
Normal file
131
mysql-test/extra/rpl_tests/rpl_stm_000001.test
Normal file
@ -0,0 +1,131 @@
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
create table t1 (word char(20) not null);
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
|
||||
select * from t1 limit 10;
|
||||
|
||||
#
|
||||
# Test slave with wrong password
|
||||
#
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
stop slave;
|
||||
connection master;
|
||||
set password for root@"localhost" = password('foo');
|
||||
connection slave;
|
||||
start slave;
|
||||
connection master;
|
||||
#
|
||||
# Give slave time to do at last one failed connect retry
|
||||
# This one must be short so that the slave will not stop retrying
|
||||
real_sleep 2;
|
||||
set password for root@"localhost" = password('');
|
||||
# Give slave time to connect (will retry every second)
|
||||
sleep 2;
|
||||
|
||||
create table t3(n int);
|
||||
insert into t3 values(1),(2);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from t3;
|
||||
select sum(length(word)) from t1;
|
||||
connection master;
|
||||
drop table t1,t3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# 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
|
||||
eval create table t1 (n int) engine=$engine_type;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
reset master;
|
||||
connection slave;
|
||||
stop slave;
|
||||
reset slave;
|
||||
|
||||
connection master;
|
||||
let $1=5000;
|
||||
# Generate 16K of relay log
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values($1);
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
|
||||
# Try to cause a large relay log lag on the slave by locking t1
|
||||
connection slave;
|
||||
lock tables t1 read;
|
||||
start slave;
|
||||
#hope this is long enough for I/O thread to fetch over 16K relay log data
|
||||
sleep 3;
|
||||
unlock tables;
|
||||
|
||||
#test handling of aborted connection in the middle of update
|
||||
|
||||
connection master;
|
||||
create table t2(id int);
|
||||
insert into t2 values(connection_id());
|
||||
save_master_pos;
|
||||
|
||||
connection master1;
|
||||
# Avoid generating result
|
||||
create temporary table t3(n int);
|
||||
insert into t3 select get_lock('crash_lock%20C', 1) from t2;
|
||||
|
||||
connection master;
|
||||
send update t1 set n = n + get_lock('crash_lock%20C', 2);
|
||||
connection master1;
|
||||
sleep 3;
|
||||
select (@id := id) - id from t2;
|
||||
kill @id;
|
||||
# We don't drop t3 as this is a temporary table
|
||||
drop table t2;
|
||||
connection master;
|
||||
--error 1053,2013
|
||||
reap;
|
||||
connection slave;
|
||||
# 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).
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
# The following test can't be done because the result of Pos will differ
|
||||
# on different computers
|
||||
# --replace_result $MASTER_MYPORT MASTER_PORT
|
||||
# show slave status;
|
||||
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
select count(*) from t1;
|
||||
connection master1;
|
||||
drop table t1;
|
||||
create table t1 (n int);
|
||||
insert into t1 values(3456);
|
||||
insert into mysql.user (Host, User, Password)
|
||||
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
|
||||
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';
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select n from t1;
|
||||
select select_priv,user from mysql.user where user = _binary'blafasel2';
|
||||
connection master1;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
38
mysql-test/extra/rpl_tests/rpl_stm_EE_err.test
Normal file
38
mysql-test/extra/rpl_tests/rpl_stm_EE_err.test
Normal file
@ -0,0 +1,38 @@
|
||||
# The test is not relevant when testing replication of error codes for
|
||||
# statements that are not replicated. The test below could be changed
|
||||
# to rely on the replication of error codes for statements that are not
|
||||
# replicated row-based.
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
# See if an EE_ error in one event of the master's binlog stops replication
|
||||
# (it should not: in this configuration the EE_ error is probably not
|
||||
# critical). Example: you do a DROP TABLE on a table which has no MYI file
|
||||
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
|
||||
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval create table t1 (a int) engine=$engine_type;
|
||||
flush tables;
|
||||
system rm ./var/master-data/test/t1.MYI ;
|
||||
drop table if exists t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# Now a real error.
|
||||
|
||||
connection master;
|
||||
eval create table t1 (a int, unique(a)) engine=$engine_type;
|
||||
set sql_log_bin=0;
|
||||
insert into t1 values(2);
|
||||
set sql_log_bin=1;
|
||||
save_master_pos;
|
||||
--error 1062
|
||||
insert into t1 values(1),(2);
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
# End of 4.1 tests
|
176
mysql-test/extra/rpl_tests/rpl_stm_charset.test
Normal file
176
mysql-test/extra/rpl_tests/rpl_stm_charset.test
Normal file
@ -0,0 +1,176 @@
|
||||
# Replication of character sets.
|
||||
# This test will fail if the server/client does not support enough charsets.
|
||||
|
||||
# Requires statement logging
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
set timestamp=1000000000;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
--enable_warnings
|
||||
|
||||
create database mysqltest2 character set latin2;
|
||||
set @@character_set_server=latin5;
|
||||
create database mysqltest3;
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest2;
|
||||
show create database mysqltest3;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest2;
|
||||
show create database mysqltest3;
|
||||
|
||||
connection master;
|
||||
set @@collation_server=armscii8_bin;
|
||||
drop database mysqltest3;
|
||||
create database mysqltest3;
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest3;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest3;
|
||||
|
||||
connection master;
|
||||
use mysqltest2;
|
||||
create table t1 (a int auto_increment primary key, b varchar(100));
|
||||
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
|
||||
insert into t1 (b) values(@@character_set_server);
|
||||
insert into t1 (b) values(@@collation_server);
|
||||
# character_set_database and collation_database are not tested as they
|
||||
# needn't be replicated (Bar said in Jan 2005).
|
||||
insert into t1 (b) values(@@character_set_client);
|
||||
# collation_client does not exist
|
||||
insert into t1 (b) values(@@character_set_connection);
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
connection master;
|
||||
set character_set_client=latin1, collation_connection=latin1_german1_ci;
|
||||
truncate table t1;
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
|
||||
set collation_connection=latin1_german2_ci;
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
# Presently charset info is not logged with LOAD DATA but it will
|
||||
# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
|
||||
# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
|
||||
# here.
|
||||
|
||||
# See if user var is prefixed with collation in binlog and replicated well.
|
||||
# Note: replication of user variables is broken as far as derivation is
|
||||
# concerned. That's because when we store a user variable in the binlog,
|
||||
# we lose its derivation. So later on the slave, it's impossible to
|
||||
# know if the collation was explicit or not, so we use DERIVATION_NONE,
|
||||
# which provokes error messages (like 'Illegal mix of collation') when
|
||||
# we replay the master's INSERT/etc statements.
|
||||
connection master;
|
||||
set @a= _cp850 'M<>ller' collate cp850_general_ci;
|
||||
truncate table t1;
|
||||
insert into t1 (b) values(collation(@a));
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
connection master;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 102;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Check that we can change global.collation_server (since 5.0.3)
|
||||
|
||||
set global character_set_server=latin2;
|
||||
set global character_set_server=latin1; # back
|
||||
connection master;
|
||||
set global character_set_server=latin2;
|
||||
set global character_set_server=latin1; # back
|
||||
|
||||
# Check that SET ONE_SHOT is really one shot
|
||||
|
||||
set one_shot @@character_set_server=latin5;
|
||||
set @@max_join_size=1000;
|
||||
select @@character_set_server;
|
||||
select @@character_set_server;
|
||||
set @@character_set_server=latin5;
|
||||
select @@character_set_server;
|
||||
select @@character_set_server;
|
||||
|
||||
# ONE_SHOT on not charset/collation stuff is not allowed
|
||||
-- error 1382
|
||||
set one_shot max_join_size=10;
|
||||
|
||||
# Test of wrong character set numbers;
|
||||
error 1115;
|
||||
set character_set_client=9999999;
|
||||
error 1273;
|
||||
set collation_server=9999998;
|
||||
|
||||
# This one was contributed by Sergey Petrunia (BUG#3943)
|
||||
|
||||
use test;
|
||||
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
|
||||
SET CHARACTER_SET_CLIENT=koi8r,
|
||||
CHARACTER_SET_CONNECTION=cp1251,
|
||||
CHARACTER_SET_RESULTS=koi8r;
|
||||
INSERT INTO t1 (c1, c2) VALUES ('<27><>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||||
select hex(c1), hex(c2) from t1;
|
||||
sync_slave_with_master;
|
||||
select hex(c1), hex(c2) from t1;
|
||||
|
||||
connection master;
|
||||
# Let's have a look at generated SETs.
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#6676: Derivation of variables must be correct on slave
|
||||
#
|
||||
connection master;
|
||||
eval create table `t1` (
|
||||
`pk` varchar(10) not null default '',
|
||||
primary key (`pk`)
|
||||
) engine=$engine_type default charset=latin1;
|
||||
set @p=_latin1 'test';
|
||||
update t1 set pk='test' where pk=@p;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
46
mysql-test/extra/rpl_tests/rpl_trig004.test
Normal file
46
mysql-test/extra/rpl_tests/rpl_trig004.test
Normal file
@ -0,0 +1,46 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/09/2005 #
|
||||
#############################################################################
|
||||
# TEST: Use after insert and before inset triggers and stored procdures to #
|
||||
# Update and insert data #
|
||||
#############################################################################
|
||||
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
--error 0,1360
|
||||
DROP TRIGGER test.t1_bi_t2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
|
||||
|
||||
eval CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
|
||||
eval CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
|
||||
|
||||
|
||||
delimiter //;
|
||||
CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
|
||||
delimiter ;//
|
||||
|
||||
INSERT INTO test.t2 VALUES (1, 0.0);
|
||||
--error 0,1062
|
||||
INSERT INTO test.t2 VALUES (1, 0.0);
|
||||
|
||||
#show binlog events;
|
||||
select * from test.t1;
|
||||
select * from test.t2;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from test.t1;
|
||||
select * from test.t2;
|
||||
|
||||
connection master;
|
||||
|
||||
DROP TRIGGER test.t1_bi_t2;
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
# End of 5.0 test case
|
54
mysql-test/extra/rpl_tests/rpl_user_variables.test
Normal file
54
mysql-test/extra/rpl_tests/rpl_user_variables.test
Normal file
@ -0,0 +1,54 @@
|
||||
# row-based and statement binlog difference in result files
|
||||
#
|
||||
# Test of replicating user variables
|
||||
#
|
||||
-- source include/master-slave.inc
|
||||
# Disable PS as the log positions differs
|
||||
--disable_ps_protocol
|
||||
|
||||
|
||||
# Clean up old slave's binlogs.
|
||||
# The slave is started with --log-slave-updates
|
||||
# and this test does SHOW BINLOG EVENTS on the slave's
|
||||
# binlog. But previous tests can influence the current test's
|
||||
# binlog (e.g. a temporary table in the previous test has not
|
||||
# been explicitly deleted, or it has but the slave hasn't had
|
||||
# enough time to catch it before STOP SLAVE,
|
||||
# and at the beginning of the current
|
||||
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
|
||||
# We wait for the slave to have written all he wants to the binlog
|
||||
# (otherwise RESET MASTER may come too early).
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
reset master;
|
||||
connection master;
|
||||
|
||||
create table t1(n char(30));
|
||||
set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
|
||||
set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
|
||||
set @n1:=null;
|
||||
set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
|
||||
insert into t1 values (@i1), (@i2), (@i3), (@i4);
|
||||
insert into t1 values (@r1), (@r2);
|
||||
insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
|
||||
insert into t1 values (@n1);
|
||||
insert into t1 values (@n2); # not explicitely set before
|
||||
insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
|
||||
insert into t1 values (@a+(@b:=@a+1));
|
||||
set @q:='abc';
|
||||
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
|
||||
set @a:=5;
|
||||
insert into t1 values (@a),(@a);
|
||||
# To flush the pending event, we add the following statement. RBR can
|
||||
# concatenate the result of several statements, which SBR cannot.
|
||||
select * from t1 where n = '<nonexistant>';
|
||||
connection master1; # see if variable is reset in binlog when thread changes
|
||||
insert into t1 values (@a),(@a),(@a*5);
|
||||
select * from t1;
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
stop slave;
|
Reference in New Issue
Block a user