初版
This commit is contained in:
14
build/lib/mysql/mysql-test/suite/rpl/t/disabled.def
Normal file
14
build/lib/mysql/mysql-test/suite/rpl/t/disabled.def
Normal file
@@ -0,0 +1,14 @@
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
rpl_row_create_table : Bug#11759274 Feb 27 2010 andrei failed different way than earlier with bug#45576
|
||||
rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
|
||||
20
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000010.test
Normal file
20
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000010.test
Normal file
@@ -0,0 +1,20 @@
|
||||
# This tests the offset off by 22 mystery bug
|
||||
# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
create table t1 (n int not null auto_increment primary key);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(2);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select n from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
18
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000011.test
Normal file
18
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000011.test
Normal file
@@ -0,0 +1,18 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
create table t1 (n int);
|
||||
insert into t1 values(1);
|
||||
sync_slave_with_master;
|
||||
stop slave;
|
||||
start slave;
|
||||
connection master;
|
||||
insert into t1 values(2);
|
||||
#let slave catch up
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
51
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000013.test
Normal file
51
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000013.test
Normal file
@@ -0,0 +1,51 @@
|
||||
# This test is to verify that DROP TEMPORARY TABLE
|
||||
# is automatically binlogged and sent to slave
|
||||
# when a temp table is dropped by disconnection
|
||||
# of a master's conection.
|
||||
# So it does not apply to row-based, where we neither need
|
||||
# nor do this automatic binlogging. And if we run this test
|
||||
# in row-based, it hangs waiting for an offset which is never
|
||||
# reached (the "sync_with_master 1"), logically.
|
||||
|
||||
--source include/have_binlog_format_mixed_or_statement.inc
|
||||
source include/master-slave.inc;
|
||||
--sync_slave_with_master
|
||||
connection master;
|
||||
|
||||
create table t2(n int);
|
||||
create temporary table t1 (n int);
|
||||
insert into t1 values(1),(2),(3);
|
||||
insert into t2 select * from t1;
|
||||
connection master1;
|
||||
create temporary table t1 (n int);
|
||||
insert into t1 values (4),(5);
|
||||
insert into t2 select * from t1 as t10;
|
||||
save_master_pos;
|
||||
disconnect master;
|
||||
connection slave;
|
||||
#add 1 to catch drop table
|
||||
sync_with_master 1;
|
||||
connection master1;
|
||||
insert into t2 values(6);
|
||||
save_master_pos;
|
||||
disconnect master1;
|
||||
connection slave;
|
||||
# same trick to go one more event
|
||||
sync_with_master 1;
|
||||
select * from t2;
|
||||
show status like 'Slave_open_temp_tables';
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
connect (master2,localhost,root,,);
|
||||
connection master2;
|
||||
|
||||
# We will get a warning for t1 as this is a temporary table that doesn't
|
||||
# exist in this connection.
|
||||
|
||||
drop table if exists t1,t2;
|
||||
--sync_slave_with_master
|
||||
|
||||
|
||||
--source include/rpl_end.inc
|
||||
# End of 4.1 tests
|
||||
48
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000017.test
Normal file
48
build/lib/mysql/mysql-test/suite/rpl/t/rpl_000017.test
Normal file
@@ -0,0 +1,48 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Unknown.
|
||||
#
|
||||
# ==== Notes ====
|
||||
#
|
||||
# This test uses the -slave.opt file to start the slave with
|
||||
# --skip-slave-start.
|
||||
|
||||
--source include/not_windows.inc
|
||||
|
||||
--let $rpl_skip_start_slave= 1
|
||||
--source include/master-slave.inc
|
||||
|
||||
--connection slave
|
||||
--let $slave_datadir= `SELECT @@datadir`
|
||||
|
||||
--remove_file $slave_datadir/master.info
|
||||
--write_file $slave_datadir/master.info
|
||||
master-bin.000001
|
||||
4
|
||||
127.0.0.1
|
||||
replicate
|
||||
aaaaaaaaaaaaaaab
|
||||
$MASTER_MYPORT
|
||||
1
|
||||
0
|
||||
EOF
|
||||
|
||||
connection master;
|
||||
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
|
||||
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
|
||||
connection slave;
|
||||
--source include/start_slave.inc
|
||||
|
||||
connection master;
|
||||
create table t1(n int);
|
||||
insert into t1 values(24);
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
delete from mysql.user where user="replicate";
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
|
||||
--source include/force_restart.inc
|
||||
3
build/lib/mysql/mysql-test/suite/rpl/t/rpl_EE_err.test
Normal file
3
build/lib/mysql/mysql-test/suite/rpl/t/rpl_EE_err.test
Normal file
@@ -0,0 +1,3 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
let $engine_type=myisam;
|
||||
-- source extra/rpl_tests/rpl_EE_err.test
|
||||
39
build/lib/mysql/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
Normal file
39
build/lib/mysql/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
Normal file
@@ -0,0 +1,39 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/18/2005 #
|
||||
#############################################################################
|
||||
# TEST: To test the LOAD DATA INFILE in rbr #
|
||||
#############################################################################
|
||||
|
||||
# Includes
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Begin clean up test section
|
||||
--disable_warnings
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
|
||||
# Section 1 test
|
||||
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
|
||||
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
|
||||
DELETE FROM test.t1 WHERE a = 'abashed';
|
||||
DELETE FROM test.t1;
|
||||
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
|
||||
|
||||
|
||||
SELECT * FROM test.t1 ORDER BY a DESC;
|
||||
save_master_pos;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM test.t1 ORDER BY a DESC;
|
||||
|
||||
# Cleanup
|
||||
#show binlog events;
|
||||
connection master;
|
||||
DROP TABLE test.t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.0 test case
|
||||
|
||||
--source include/rpl_end.inc
|
||||
70
build/lib/mysql/mysql-test/suite/rpl/t/rpl_alter.test
Normal file
70
build/lib/mysql/mysql-test/suite/rpl/t/rpl_alter.test
Normal file
@@ -0,0 +1,70 @@
|
||||
source include/master-slave.inc;
|
||||
create database mysqltest;
|
||||
|
||||
create table mysqltest.t1 ( n int);
|
||||
alter table mysqltest.t1 add m int;
|
||||
insert into mysqltest.t1 values (1,2);
|
||||
create table mysqltest.t2 (n int);
|
||||
insert into mysqltest.t2 values (45);
|
||||
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from mysqltest.t2;
|
||||
select * from mysqltest.t3;
|
||||
|
||||
connection master;
|
||||
drop database mysqltest;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo
|
||||
--echo # BUG#56226 Table map set to 0 after altering MyISAM table
|
||||
--echo
|
||||
connection master;
|
||||
SET SESSION binlog_format='ROW';
|
||||
USE test;
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT) ENGINE MyISAM;
|
||||
CREATE TABLE t2 (a VARCHAR(255), b VARCHAR(255)) ENGINE MyISAM;
|
||||
|
||||
--delimiter //
|
||||
CREATE TRIGGER trg_t1ai
|
||||
AFTER INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t2 (a) VALUES (NEW.a);
|
||||
END;//
|
||||
--delimiter ;
|
||||
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
ALTER TABLE t2 CHANGE b c VARCHAR(255);
|
||||
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
INSERT INTO t1 (a) VALUES(2);
|
||||
let _info= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start, Info, 2);
|
||||
# Table map id should not be 0.
|
||||
if (`SELECT 'table_id: 0 (test.t1)' = '$_info'`)
|
||||
{
|
||||
--echo test.t1's table map id is 0;
|
||||
--die test.t1's table map id is 0;
|
||||
}
|
||||
let _info= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start, Info, 3);
|
||||
if (`SELECT 'table_id: 0 (test.t2)' = '$_info'`)
|
||||
{
|
||||
--echo test.t2's table map id is 0;
|
||||
--die test.t2's table map id is 0;
|
||||
}
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
--let $diff_tables= master:t1, slave:t1
|
||||
--source include/diff_tables.inc
|
||||
--let $diff_tables= master:t2, slave:t2
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
15
build/lib/mysql/mysql-test/suite/rpl/t/rpl_alter_db.test
Normal file
15
build/lib/mysql/mysql-test/suite/rpl/t/rpl_alter_db.test
Normal file
@@ -0,0 +1,15 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
--echo ==== Verify that alter database does not stop replication ====
|
||||
|
||||
create database temp_db;
|
||||
use temp_db; # to be different from initial `test' db of mysqltest client
|
||||
alter database collate latin1_bin;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo ==== Clean up ====
|
||||
connection master;
|
||||
drop database temp_db;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,8 @@
|
||||
#####################################
|
||||
# Wrapper for rpl_auto_increment.test#
|
||||
#####################################
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
let $engine_type=innodb;
|
||||
let $engine_type2=myisam;
|
||||
-- source extra/rpl_tests/rpl_auto_increment.test
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Test of auto_increment
|
||||
# BUG#11932
|
||||
#
|
||||
# Bug reported that master and slave get out of sync after TRUNCATE
|
||||
# TABLE.
|
||||
#
|
||||
# Test supplied by Are Casilla
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
connection master;
|
||||
drop database if exists test1;
|
||||
--enable_warnings
|
||||
create database test1;
|
||||
use test1;
|
||||
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`fname` varchar(100) default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `t1` VALUES (1, 'blablabla');
|
||||
|
||||
CREATE TABLE `t2` (
|
||||
`id` int(10) NOT NULL auto_increment,
|
||||
`comment` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=3 ;
|
||||
|
||||
INSERT INTO `t2` VALUES (1, 'testtest 1');
|
||||
INSERT INTO `t2` VALUES (2, 'test 2');
|
||||
|
||||
DELIMITER $;
|
||||
CREATE PROCEDURE simpleproc3 ()
|
||||
NOT DETERMINISTIC
|
||||
BEGIN
|
||||
INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
|
||||
INSERT INTO t1 (fname) VALUES('test');
|
||||
END
|
||||
$
|
||||
DELIMITER ;$
|
||||
|
||||
CALL simpleproc3();
|
||||
|
||||
select * from t2;
|
||||
|
||||
TRUNCATE TABLE `t1`;
|
||||
CALL simpleproc3();
|
||||
|
||||
select * from t1;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
use test1;
|
||||
select * from t1;
|
||||
|
||||
connection master;
|
||||
drop database test1;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,56 @@
|
||||
# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting
|
||||
# using a trig in SP
|
||||
|
||||
# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive,
|
||||
# if one statement in a SP generated AUTO_INCREMENT value by the top
|
||||
# statement, all statements after it would be considered generated
|
||||
# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID
|
||||
# value might be associated with these statement, which could cause
|
||||
# duplicate entry error and stop the slave.
|
||||
|
||||
# Test if the slave can replicate from such a buggy master
|
||||
|
||||
# The bug33029-slave-relay-bin.000001 file is the
|
||||
# slave-replay-bin.000003 file generated by run the
|
||||
# rpl_auto_increment_bug33029.test with clean up statements at the end
|
||||
# of the test case removed on a buggy 5.0 server
|
||||
|
||||
--let $rpl_skip_start_slave= 1
|
||||
--let $rpl_skip_change_master= 1
|
||||
source include/master-slave.inc;
|
||||
|
||||
--echo ==== Initialize ====
|
||||
--connection slave
|
||||
|
||||
# Need to restore this at the end; CHANGE MASTER modifies it (see the
|
||||
# manual for CHANGE MASTER).
|
||||
SET @old_relay_log_purge= @@global.relay_log_purge;
|
||||
|
||||
# the relay log contains create t1, t2 tables and load data infile
|
||||
--let $fake_relay_log = $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001
|
||||
--source include/setup_fake_relay_log.inc
|
||||
|
||||
--echo ==== Test ====
|
||||
start slave sql_thread;
|
||||
--let $slave_param= Exec_Master_Log_Pos
|
||||
--let $slave_param_value= 3776
|
||||
--source include/wait_for_slave_param.inc
|
||||
|
||||
|
||||
echo # Result on slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
stop slave sql_thread;
|
||||
--source include/cleanup_fake_relay_log.inc
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP FUNCTION f1;
|
||||
|
||||
SET @@global.relay_log_purge= @old_relay_log_purge;
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,62 @@
|
||||
# Test of auto-increment.
|
||||
#
|
||||
# BUG#11754117-45670
|
||||
# Multipart primary key with the autoincrement part not first in it
|
||||
# is replication unsafe.
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_mixed.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
|
||||
|
||||
--connection master
|
||||
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
|
||||
--error ER_WRONG_AUTO_KEY
|
||||
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
|
||||
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
|
||||
|
||||
set @@binlog_format=statement;
|
||||
--echo *** autoincrement field is not the first in PK warning must be there: ***
|
||||
insert into tm set b=null, a=1;
|
||||
show warnings;
|
||||
--echo *** no warning when autoincrement is the first in PK
|
||||
insert into ti set b=null, a=1;
|
||||
show warnings;
|
||||
|
||||
delimiter //;
|
||||
create function multi_part_pk_with_autoinc (arg int)
|
||||
returns int
|
||||
begin
|
||||
insert into tm set b=null, a=arg;
|
||||
return arg;
|
||||
end//
|
||||
delimiter ;//
|
||||
|
||||
select multi_part_pk_with_autoinc (3);
|
||||
--echo *** No warnings in 5.1 because of Bug11749859-39934 ***
|
||||
show warnings;
|
||||
|
||||
set @@binlog_format=mixed;
|
||||
insert into tm set b=null, a=2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
if (`select count(*) <> 3 from tm`)
|
||||
{
|
||||
--echo Wrong result from SELECT on the slave side.
|
||||
select * from tm;
|
||||
--die
|
||||
}
|
||||
|
||||
# cleanup
|
||||
|
||||
--connection master
|
||||
|
||||
drop table tm, ti;
|
||||
drop function multi_part_pk_with_autoinc;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,211 @@
|
||||
#
|
||||
# Bug45677
|
||||
# This test verifies the following two properties:
|
||||
# P1) insert/update in an autoinc column causes statement to
|
||||
# be logged in row format if binlog_format=mixed.
|
||||
# P2) if binlog_format=mixed, and a trigger or function contains
|
||||
# two or more inserts/updates in a table that has an autoinc
|
||||
# column, then the slave should not go out of sync, even if
|
||||
# there are concurrent transactions.
|
||||
#
|
||||
# Property (P1) is tested by executing an insert and an update on
|
||||
# a table that has an autoinc column, and verifying that these
|
||||
# statements result in row events in the binlog.
|
||||
# Property (P2) is tested by setting up the test scenario and
|
||||
# verifying that the tables are identical on master and slave.
|
||||
#
|
||||
|
||||
source include/have_binlog_format_mixed.inc;
|
||||
source include/have_innodb.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
--echo # Test case1: INVOKES A TRIGGER with after insert action
|
||||
let $trigger_action = after insert;
|
||||
source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
|
||||
|
||||
--echo # Test case2: INVOKES A TRIGGER with before insert action
|
||||
let $trigger_action = before insert;
|
||||
source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
|
||||
|
||||
--echo # Test case3: INVOKES A TRIGGER with after update action
|
||||
let $trigger_action = after update;
|
||||
source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
|
||||
|
||||
--echo # Test case4: INVOKES A TRIGGER with before update action
|
||||
let $trigger_action = before update;
|
||||
source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
|
||||
|
||||
--echo # Test case5: INVOKES A TRIGGER with after delete action
|
||||
let $trigger_action = after delete;
|
||||
source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
|
||||
|
||||
--echo # Test case6: INVOKES A TRIGGER with before delete action
|
||||
let $trigger_action = before delete;
|
||||
source extra/rpl_tests/rpl_auto_increment_invoke_trigger.test;
|
||||
|
||||
--echo # Test case7: CALLS A FUNCTION which INVOKES A TRIGGER with after insert action
|
||||
let $insert_action = after insert;
|
||||
source extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test;
|
||||
|
||||
--echo # Test case8: CALLS A FUNCTION which INVOKES A TRIGGER with before insert action
|
||||
let $insert_action = before insert;
|
||||
source extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test;
|
||||
|
||||
--echo # Test case9: INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS with after insert action
|
||||
let $insert_action = after insert;
|
||||
source extra/rpl_tests/rpl_auto_increment_insert_view.test;
|
||||
|
||||
--echo # Test case10: INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS with before insert action
|
||||
let $insert_action = before insert;
|
||||
source extra/rpl_tests/rpl_auto_increment_insert_view.test;
|
||||
|
||||
--echo # Test case11: INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES INTO A TABLE WITH AUTOINC COLUMN
|
||||
connection master;
|
||||
create table t1(a int) engine=innodb;
|
||||
create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
|
||||
delimiter //;
|
||||
CREATE FUNCTION f1_two_inserts() RETURNS INTEGER
|
||||
BEGIN
|
||||
INSERT INTO t2(a) values(2);
|
||||
INSERT INTO t2(a) values(2);
|
||||
RETURN 1;
|
||||
END//
|
||||
delimiter ;//
|
||||
begin;
|
||||
insert into t1(a) values(f1_two_inserts());
|
||||
|
||||
connection master1;
|
||||
#The default autocommit is set to 1, so the statement is auto committed
|
||||
insert into t2(a) values(4),(5);
|
||||
|
||||
connection master;
|
||||
commit;
|
||||
insert into t1(a) values(f1_two_inserts());
|
||||
commit;
|
||||
|
||||
connection master;
|
||||
--echo #Test result for INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES on master
|
||||
select * from t2 ORDER BY i1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
--echo #Test result for INVOKES A FUNCTION TO INSERT TWO OR MORE VALUES on slave
|
||||
select * from t2 ORDER BY i1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop function f1_two_inserts;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo # Test case12: INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES OF A TABLE WITH AUTOINC COLUMN
|
||||
connection master;
|
||||
create table t1(a int) engine=innodb;
|
||||
create table t2(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
|
||||
delimiter //;
|
||||
CREATE FUNCTION f1_two_updates() RETURNS INTEGER
|
||||
BEGIN
|
||||
update t2 set a = a + 5 where b = 1;
|
||||
update t2 set a = a + 5 where b = 2;
|
||||
update t2 set a = a + 5 where b = 3;
|
||||
update t2 set a = a + 5 where b = 4;
|
||||
RETURN 1;
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
connection master1;
|
||||
#The default autocommit is set to 1, so the statement is auto committed
|
||||
insert into t2(a,b) values(1,1);
|
||||
insert into t2(a,b) values(2,2);
|
||||
insert into t2(a,b) values(3,3);
|
||||
insert into t2(a,b) values(4,4);
|
||||
insert into t1(a) values(f1_two_updates());
|
||||
|
||||
connection master;
|
||||
begin;
|
||||
insert into t1(a) values(f1_two_updates());
|
||||
commit;
|
||||
|
||||
connection master;
|
||||
--echo #Test result for INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES on master
|
||||
select * from t2 ORDER BY i1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
--echo #Test result for INVOKES A FUNCTION TO UPDATE TWO OR MORE VALUES on slave
|
||||
select * from t2 ORDER BY i1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop function f1_two_updates;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo # Test case13: UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT
|
||||
connection master;
|
||||
create table t1(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
|
||||
create table t2(i1 int not null auto_increment, a int, b int, primary key(i1)) engine=innodb;
|
||||
begin;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
insert into t1(a,b) values(1,1),(2,2);
|
||||
insert into t2(a,b) values(1,1),(2,2);
|
||||
update t1,t2 set t1.a=t1.a+5, t2.a=t2.a+5 where t1.b=t2.b;
|
||||
insert into t1(a,b) values(3,3);
|
||||
insert into t2(a,b) values(3,3);
|
||||
commit;
|
||||
--echo # To verify if it works fine when these statements are not be marked as unsafe
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo #Test if the results are consistent on master and slave
|
||||
--echo #for 'UPDATE MORE THAN ONE TABLES ON TOP-STATEMENT'
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
let $diff_tables= master:t2, slave:t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo # Test case14: INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES
|
||||
connection master;
|
||||
CREATE TABLE t1(i1 int not null auto_increment, c1 INT, primary key(i1)) engine=innodb;
|
||||
CREATE TABLE t2(i1 int not null auto_increment, c2 INT, primary key(i1)) engine=innodb;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
begin;
|
||||
INSERT INTO t1(c1) VALUES (11), (12);
|
||||
INSERT INTO t2(c2) VALUES (13), (14);
|
||||
|
||||
CREATE VIEW v15 AS SELECT c1, c2 FROM t1, t2;
|
||||
|
||||
INSERT INTO v15(c1) VALUES (15),(16);
|
||||
INSERT INTO v15(c2) VALUES (17),(18);
|
||||
|
||||
connection master1;
|
||||
INSERT INTO v15(c1) VALUES (19),(20);
|
||||
INSERT INTO v15(c2) VALUES (21),(22);
|
||||
|
||||
connection master;
|
||||
INSERT INTO v15(c1) VALUES (23), (24);
|
||||
INSERT INTO v15(c2) VALUES (25), (26);
|
||||
commit;
|
||||
--echo # To verify if it works fine when these statements are not be marked as unsafe
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo #Test if the results are consistent on master and slave
|
||||
--echo #for 'INSERT DATA INTO VIEW WHICH INVOLVED MORE THAN ONE TABLES'
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
let $diff_tables= master:t2, slave:t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop view v15;
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,172 @@
|
||||
source include/master-slave.inc;
|
||||
source include/have_innodb.inc;
|
||||
source include/have_binlog_format_statement.inc;
|
||||
|
||||
disable_warnings;
|
||||
DROP DATABASE IF EXISTS db1;
|
||||
DROP DATABASE IF EXISTS db2;
|
||||
enable_warnings;
|
||||
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
|
||||
use db1;
|
||||
|
||||
CREATE TABLE db1.t1 (a INT) ENGINE=InnoDB;
|
||||
CREATE TABLE db1.t2 (s CHAR(255)) ENGINE=MyISAM;
|
||||
|
||||
sync_slave_with_master;
|
||||
source include/stop_slave.inc;
|
||||
connection master;
|
||||
echo [on master];
|
||||
|
||||
DELIMITER //;
|
||||
CREATE PROCEDURE db1.p1 ()
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (3);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (5);
|
||||
END//
|
||||
|
||||
CREATE PROCEDURE db1.p2 ()
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (6);
|
||||
INSERT INTO t1 VALUES (7);
|
||||
INSERT INTO t1 VALUES (8);
|
||||
INSERT INTO t1 VALUES (9);
|
||||
INSERT INTO t1 VALUES (10);
|
||||
INSERT INTO t2 VALUES ('executed db1.p2()');
|
||||
END//
|
||||
DELIMITER ;//
|
||||
|
||||
INSERT INTO db1.t2 VALUES ('before call db1.p1()');
|
||||
|
||||
# Note: the master_log_pos is set to be the position of the BEGIN + 1,
|
||||
# so before fix of BUG#43263 if the BEGIN is ignored, then all the
|
||||
# INSERTS in p1 will be replicated in AUTOCOMMIT=1 mode and the slave
|
||||
# SQL thread will stop right before the first INSERT. After fix of
|
||||
# BUG#43263, BEGIN will not be ignored by the replication db rules,
|
||||
# and then the whole transaction will be executed before slave SQL
|
||||
# stop.
|
||||
let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
let $master_pos= `SELECT $master_pos + 1`;
|
||||
|
||||
use test;
|
||||
BEGIN;
|
||||
CALL db1.p1();
|
||||
COMMIT;
|
||||
|
||||
# The position where the following START SLAVE UNTIL will stop at
|
||||
let $master_end_trans_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
INSERT INTO db1.t2 VALUES ('after call db1.p1()');
|
||||
SELECT * FROM db1.t1;
|
||||
SELECT * FROM db1.t2;
|
||||
|
||||
connection slave;
|
||||
echo [on slave];
|
||||
|
||||
replace_result $master_pos MASTER_POS;
|
||||
eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_pos;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
let $slave_sql_stop_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
|
||||
let $result= query_get_value(SELECT $slave_sql_stop_pos - $master_end_trans_pos as result, result, 1);
|
||||
|
||||
--echo #
|
||||
--echo # If we got non-zero here, then we're suffering BUG#43263
|
||||
--echo #
|
||||
eval SELECT $result as 'Must be 0';
|
||||
SELECT * from db1.t1;
|
||||
SELECT * from db1.t2;
|
||||
|
||||
connection master;
|
||||
echo [on master];
|
||||
|
||||
INSERT INTO db1.t2 VALUES ('before call db1.p2()');
|
||||
|
||||
# See comments above.
|
||||
let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
let $master_pos= `SELECT $master_pos + 1`;
|
||||
|
||||
BEGIN;
|
||||
CALL db1.p2();
|
||||
disable_warnings;
|
||||
ROLLBACK;
|
||||
enable_warnings;
|
||||
let $master_end_trans_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
INSERT INTO db1.t2 VALUES ('after call db1.p2()');
|
||||
SELECT * FROM db1.t1;
|
||||
SELECT * FROM db1.t2;
|
||||
|
||||
connection slave;
|
||||
echo [on slave];
|
||||
|
||||
replace_result $master_pos MASTER_POS;
|
||||
eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_pos;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
let $slave_sql_stop_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
|
||||
let $result= query_get_value(SELECT $slave_sql_stop_pos - $master_end_trans_pos as result, result, 1);
|
||||
|
||||
--echo #
|
||||
--echo # If we got non-zero here, then we're suffering BUG#43263
|
||||
--echo #
|
||||
eval SELECT $result as 'Must be 0';
|
||||
SELECT * from db1.t1;
|
||||
SELECT * from db1.t2;
|
||||
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_sql_to_start.inc;
|
||||
|
||||
--echo #
|
||||
--echo # SAVEPOINT and ROLLBACK TO have the same problem in BUG#43263
|
||||
--echo # This was reported by BUG#50407
|
||||
connection master;
|
||||
echo [on master]
|
||||
SET SESSION AUTOCOMMIT=0;
|
||||
let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO db1.t1 VALUES(20);
|
||||
|
||||
--echo #
|
||||
--echo # Verify whether this statement is binlogged correctly
|
||||
/*comment*/ SAVEPOINT has_comment;
|
||||
USE db1;
|
||||
INSERT INTO db1.t1 VALUES(30);
|
||||
INSERT INTO db1.t2 VALUES("in savepoint has_comment");
|
||||
USE db2;
|
||||
SavePoint mixed_cases;
|
||||
USE db1;
|
||||
INSERT INTO db1.t2 VALUES("in savepoint mixed_cases");
|
||||
INSERT INTO db1.t1 VALUES(40);
|
||||
USE db2;
|
||||
ROLLBACK TO mixed_cases;
|
||||
ROLLBACK TO has_comment;
|
||||
USE db1;
|
||||
INSERT INTO db1.t2 VALUES("after rollback to");
|
||||
INSERT INTO db1.t1 VALUES(50);
|
||||
USE db2;
|
||||
COMMIT;
|
||||
source include/show_binlog_events.inc;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo [on slave]
|
||||
--echo #
|
||||
--echo # Verify INSERT statements in savepoints are executed, for MyISAM table
|
||||
--echo # is not effected by ROLLBACK TO
|
||||
SELECT * FROM db1.t2 WHERE s LIKE '% savepoint %';
|
||||
--echo #
|
||||
--echo # Verify INSERT statements on the Innodb table are rolled back;
|
||||
SELECT * FROM db1.t1 WHERE a IN (30, 40);
|
||||
|
||||
--echo #
|
||||
--echo # Clean up
|
||||
--echo #
|
||||
connection master;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,50 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Verify that the slave stops gracefully when reading a relay log with
|
||||
# corrupted data.
|
||||
#
|
||||
# ==== Implementation ====
|
||||
#
|
||||
# Setup "fake replication" where the slave only starts the SQL thread,
|
||||
# not the IO thread, and reads from an existing relay log that has
|
||||
# been prepared so that it contains the error. This requires some
|
||||
# extra server options: see the -master.opt file.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#31793: log event corruption causes crash
|
||||
# BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event
|
||||
|
||||
--source include/master-slave.inc
|
||||
|
||||
# BUG#40482 only manifested itself in debug-compiled binaries.
|
||||
source include/have_debug.inc;
|
||||
|
||||
--connection slave
|
||||
call mtr.add_suppression('Found invalid event in binary log');
|
||||
call mtr.add_suppression('Slave SQL.*Relay log read failure: Could not parse relay log event entry.* 1594');
|
||||
|
||||
#
|
||||
# BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event
|
||||
#
|
||||
# The relay log contains an Incident_log_event with a non-existing
|
||||
# incident number.
|
||||
|
||||
--echo ==== Initialize ====
|
||||
--source include/stop_slave.inc
|
||||
RESET SLAVE;
|
||||
|
||||
let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug40482-bin.000001;
|
||||
source include/setup_fake_relay_log.inc;
|
||||
|
||||
--echo ==== Test ====
|
||||
START SLAVE SQL_THREAD;
|
||||
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
|
||||
--echo Last_SQL_Error = $error
|
||||
|
||||
--echo ==== Clean up ====
|
||||
source include/cleanup_fake_relay_log.inc;
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
413
build/lib/mysql/mysql-test/suite/rpl/t/rpl_binlog_errors.test
Normal file
413
build/lib/mysql/mysql-test/suite/rpl/t/rpl_binlog_errors.test
Normal file
@@ -0,0 +1,413 @@
|
||||
# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
|
||||
# when generating new name.
|
||||
#
|
||||
# WHY
|
||||
# ===
|
||||
#
|
||||
# We want to check whether error is reported or not when
|
||||
# new_file_impl fails (this may happen when rotation is not
|
||||
# possible because there is some problem finding an
|
||||
# unique filename).
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
#
|
||||
# Test cases are documented inline.
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_debug.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
-- echo #######################################################################
|
||||
-- echo ####################### PART 1: MASTER TESTS ##########################
|
||||
-- echo #######################################################################
|
||||
|
||||
|
||||
### ACTION: stopping slave as it is not needed for the first part of
|
||||
### the test
|
||||
|
||||
-- connection slave
|
||||
-- source include/stop_slave.inc
|
||||
-- connection master
|
||||
|
||||
call mtr.add_suppression("Can't generate a unique log-filename");
|
||||
call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
|
||||
call mtr.add_suppression("Error writing file .*");
|
||||
|
||||
SET @old_debug= @@global.debug;
|
||||
|
||||
### ACTION: create a large file (> 4096 bytes) that will be later used
|
||||
### in LOAD DATA INFILE to check binlog errors in its vacinity
|
||||
-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data
|
||||
-- let $MYSQLD_DATADIR= `select @@datadir`
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file'
|
||||
|
||||
### ACTION: create a small file (< 4096 bytes) that will be later used
|
||||
### in LOAD DATA INFILE to check for absence of binlog errors
|
||||
### when file loading this file does not force flushing and
|
||||
### rotating the binary log
|
||||
-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data
|
||||
-- let $MYSQLD_DATADIR= `select @@datadir`
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2'
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
-- echo ###################### TEST #1
|
||||
|
||||
### ASSERTION: no problem flushing logs (should show two binlogs)
|
||||
FLUSH LOGS;
|
||||
-- echo # assert: must show two binlogs
|
||||
-- source include/show_binary_logs.inc
|
||||
|
||||
-- echo ###################### TEST #2
|
||||
|
||||
### ASSERTION: check that FLUSH LOGS actually fails and reports
|
||||
### failure back to the user if find_uniq_filename fails
|
||||
### (should show just one binlog)
|
||||
|
||||
RESET MASTER;
|
||||
SET GLOBAL debug="+d,error_unique_log_filename";
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
FLUSH LOGS;
|
||||
-- echo # assert: must show one binlog
|
||||
-- source include/show_binary_logs.inc
|
||||
|
||||
### ACTION: clean up and move to next test
|
||||
SET GLOBAL debug="";
|
||||
RESET MASTER;
|
||||
|
||||
-- echo ###################### TEST #3
|
||||
|
||||
### ACTION: create some tables (t1, t2, t4) and insert some values in
|
||||
### table t1
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
|
||||
CREATE TABLE t4 (a VARCHAR(16384));
|
||||
INSERT INTO t1 VALUES (1);
|
||||
RESET MASTER;
|
||||
|
||||
### ASSERTION: we force rotation of the binary log because it exceeds
|
||||
### the max_binlog_size option (should show two binary
|
||||
### logs)
|
||||
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
|
||||
|
||||
# shows two binary logs
|
||||
-- echo # assert: must show two binlog
|
||||
-- source include/show_binary_logs.inc
|
||||
|
||||
# clean up the table and the binlog to be used in next part of test
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
DELETE FROM t2;
|
||||
RESET MASTER;
|
||||
|
||||
-- echo ###################### TEST #4
|
||||
|
||||
### ASSERTION: load the big file into a transactional table and check
|
||||
### that it reports error. The table will contain the
|
||||
### changes performed despite the fact that it reported an
|
||||
### error.
|
||||
|
||||
SET GLOBAL debug="+d,error_unique_log_filename";
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
|
||||
|
||||
# show table
|
||||
-- echo # assert: must show one entry
|
||||
SELECT count(*) FROM t2;
|
||||
|
||||
# clean up the table and the binlog to be used in next part of test
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
DELETE FROM t2;
|
||||
RESET MASTER;
|
||||
|
||||
-- echo ###################### TEST #5
|
||||
|
||||
### ASSERTION: load the small file into a transactional table and
|
||||
### check that it succeeds
|
||||
|
||||
SET GLOBAL debug="+d,error_unique_log_filename";
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2
|
||||
|
||||
# show table
|
||||
-- echo # assert: must show one entry
|
||||
SELECT count(*) FROM t2;
|
||||
|
||||
# clean up the table and the binlog to be used in next part of test
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
DELETE FROM t2;
|
||||
RESET MASTER;
|
||||
|
||||
-- echo ###################### TEST #6
|
||||
|
||||
### ASSERTION: check that even if one is using a transactional table
|
||||
### and explicit transactions (no autocommit) if rotation
|
||||
### fails we get the error. Transaction is not rolledback
|
||||
### because rotation happens after the commit.
|
||||
|
||||
SET GLOBAL debug="+d,error_unique_log_filename";
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t2 VALUES ('muse');
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
|
||||
INSERT INTO t2 VALUES ('muse');
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
COMMIT;
|
||||
|
||||
### ACTION: Show the contents of the table after the test
|
||||
-- echo # assert: must show three entries
|
||||
SELECT count(*) FROM t2;
|
||||
|
||||
### ACTION: clean up and move to the next test
|
||||
SET AUTOCOMMIT= 1;
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
DELETE FROM t2;
|
||||
RESET MASTER;
|
||||
|
||||
-- echo ###################### TEST #7
|
||||
|
||||
### ASSERTION: check that on a non-transactional table, if rotation
|
||||
### fails then an error is reported and an incident event
|
||||
### is written to the current binary log.
|
||||
|
||||
SET GLOBAL debug="+d,error_unique_log_filename";
|
||||
SELECT count(*) FROM t4;
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4
|
||||
|
||||
-- echo # assert: must show 1 entry
|
||||
SELECT count(*) FROM t4;
|
||||
|
||||
-- echo ### check that the incident event is written to the current log
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
-- let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
-- let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
|
||||
# 53 is the size of the incident event, so we start from 22 bytes before the
|
||||
# current position
|
||||
-- let $binlog_start = `SELECT $binlog_start - 53`
|
||||
FLUSH LOGS;
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> $binlog_file BINLOG_FILE
|
||||
-- replace_column 2 # 4 # 5 #
|
||||
-- eval SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start LIMIT 1
|
||||
|
||||
# clean up and move to next test
|
||||
DELETE FROM t4;
|
||||
RESET MASTER;
|
||||
|
||||
-- echo ###################### TEST #8
|
||||
|
||||
### ASSERTION: check that statements end up in error but they succeed
|
||||
### on changing the data.
|
||||
|
||||
SET GLOBAL debug="+d,error_unique_log_filename";
|
||||
-- echo # must show 0 entries
|
||||
SELECT count(*) FROM t4;
|
||||
SELECT count(*) FROM t2;
|
||||
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc');
|
||||
|
||||
-- echo # INFO: Count(*) Before Offending DELETEs
|
||||
-- echo # assert: must show 1 entry
|
||||
SELECT count(*) FROM t4;
|
||||
-- echo # assert: must show 4 entries
|
||||
SELECT count(*) FROM t2;
|
||||
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
DELETE FROM t4;
|
||||
-- error ER_NO_UNIQUE_LOGFILE
|
||||
DELETE FROM t2;
|
||||
|
||||
-- echo # INFO: Count(*) After Offending DELETEs
|
||||
-- echo # assert: must show zero entries
|
||||
SELECT count(*) FROM t4;
|
||||
SELECT count(*) FROM t2;
|
||||
|
||||
# remove fault injection
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
|
||||
-- echo ###################### TEST #9
|
||||
|
||||
### ASSERTION: check that if we disable binlogging, then statements
|
||||
### succeed.
|
||||
SET GLOBAL debug="+d,error_unique_log_filename";
|
||||
SET SQL_LOG_BIN=0;
|
||||
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
|
||||
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
|
||||
-- echo # assert: must show four entries
|
||||
SELECT count(*) FROM t2;
|
||||
SELECT count(*) FROM t4;
|
||||
DELETE FROM t2;
|
||||
DELETE FROM t4;
|
||||
-- echo # assert: must show zero entries
|
||||
SELECT count(*) FROM t2;
|
||||
SELECT count(*) FROM t4;
|
||||
SET SQL_LOG_BIN=1;
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
|
||||
-- echo ###################### TEST #10
|
||||
|
||||
### ASSERTION: check that error is reported if there is a failure
|
||||
### while registering the index file and the binary log
|
||||
### file or failure to write the rotate event.
|
||||
|
||||
call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file.");
|
||||
call mtr.add_suppression("Could not open .*");
|
||||
|
||||
RESET MASTER;
|
||||
SHOW WARNINGS;
|
||||
|
||||
# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open
|
||||
SET GLOBAL debug="+d,fault_injection_registering_index";
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
-- error ER_CANT_OPEN_FILE
|
||||
FLUSH LOGS;
|
||||
SET GLOBAL debug="-d,fault_injection_registering_index";
|
||||
|
||||
-- error ER_NO_BINARY_LOGGING
|
||||
SHOW BINARY LOGS;
|
||||
|
||||
# issue some statements and check that they don't fail
|
||||
CREATE TABLE t5 (a INT);
|
||||
INSERT INTO t4 VALUES ('bbbbb');
|
||||
INSERT INTO t2 VALUES ('aaaaa');
|
||||
DELETE FROM t4;
|
||||
DELETE FROM t2;
|
||||
DROP TABLE t5;
|
||||
|
||||
-- echo ###################### TEST #11
|
||||
|
||||
### ASSERTION: check that error is reported if there is a failure
|
||||
### while opening the index file and the binary log file or
|
||||
### failure to write the rotate event.
|
||||
|
||||
# restart the server so that we have binlog again
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_restart_server.inc
|
||||
|
||||
# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
|
||||
SET GLOBAL debug="+d,fault_injection_openning_index";
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
-- error ER_CANT_OPEN_FILE
|
||||
FLUSH LOGS;
|
||||
SET GLOBAL debug="-d,fault_injection_openning_index";
|
||||
|
||||
-- error ER_FLUSH_MASTER_BINLOG_CLOSED
|
||||
RESET MASTER;
|
||||
|
||||
# issue some statements and check that they don't fail
|
||||
CREATE TABLE t5 (a INT);
|
||||
INSERT INTO t4 VALUES ('bbbbb');
|
||||
INSERT INTO t2 VALUES ('aaaaa');
|
||||
DELETE FROM t4;
|
||||
DELETE FROM t2;
|
||||
DROP TABLE t5;
|
||||
|
||||
# restart the server so that we have binlog again
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_restart_server.inc
|
||||
|
||||
-- echo ###################### TEST #12
|
||||
|
||||
### ASSERTION: check that error is reported if there is a failure
|
||||
### while writing the rotate event when creating a new log
|
||||
### file.
|
||||
|
||||
# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl
|
||||
SET GLOBAL debug="+d,fault_injection_new_file_rotate_event";
|
||||
-- error ER_ERROR_ON_WRITE
|
||||
FLUSH LOGS;
|
||||
SET GLOBAL debug="-d,fault_injection_new_file_rotate_event";
|
||||
|
||||
-- error ER_FLUSH_MASTER_BINLOG_CLOSED
|
||||
RESET MASTER;
|
||||
|
||||
# issue some statements and check that they don't fail
|
||||
CREATE TABLE t5 (a INT);
|
||||
INSERT INTO t4 VALUES ('bbbbb');
|
||||
INSERT INTO t2 VALUES ('aaaaa');
|
||||
DELETE FROM t4;
|
||||
DELETE FROM t2;
|
||||
DROP TABLE t5;
|
||||
|
||||
# restart the server so that we have binlog again
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_restart_server.inc
|
||||
|
||||
## clean up
|
||||
SET GLOBAL debug= @old_debug;
|
||||
DROP TABLE t1, t2, t4;
|
||||
RESET MASTER;
|
||||
|
||||
# restart slave again
|
||||
-- connection slave
|
||||
-- source include/start_slave.inc
|
||||
-- connection master
|
||||
|
||||
-- echo #######################################################################
|
||||
-- echo ####################### PART 2: SLAVE TESTS ###########################
|
||||
-- echo #######################################################################
|
||||
|
||||
### setup
|
||||
--source include/rpl_reset.inc
|
||||
-- connection slave
|
||||
|
||||
# slave suppressions
|
||||
|
||||
call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
|
||||
call mtr.add_suppression("Error writing file .*");
|
||||
call mtr.add_suppression("Could not open .*");
|
||||
call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file.");
|
||||
call mtr.add_suppression("Can't generate a unique log-filename .*");
|
||||
-- echo ###################### TEST #13
|
||||
|
||||
#### ASSERTION: check against unique log filename error
|
||||
-- let $io_thd_injection_fault_flag= error_unique_log_filename
|
||||
-- let $slave_io_errno= 1595
|
||||
-- let $show_slave_io_error= 1
|
||||
-- source include/io_thd_fault_injection.inc
|
||||
|
||||
-- echo ###################### TEST #14
|
||||
|
||||
#### ASSERTION: check against rotate failing
|
||||
-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event
|
||||
-- let $slave_io_errno= 1595
|
||||
-- let $show_slave_io_error= 1
|
||||
-- source include/io_thd_fault_injection.inc
|
||||
|
||||
-- echo ###################### TEST #15
|
||||
|
||||
#### ASSERTION: check against relay log open failure
|
||||
-- let $io_thd_injection_fault_flag= fault_injection_registering_index
|
||||
-- let $slave_io_errno= 1595
|
||||
-- let $show_slave_io_error= 1
|
||||
-- source include/io_thd_fault_injection.inc
|
||||
|
||||
-- echo ###################### TEST #16
|
||||
|
||||
#### ASSERTION: check against relay log index open failure
|
||||
-- let $io_thd_injection_fault_flag= fault_injection_openning_index
|
||||
-- let $slave_io_errno= 1595
|
||||
-- let $show_slave_io_error= 1
|
||||
-- source include/io_thd_fault_injection.inc
|
||||
|
||||
### clean up
|
||||
-- source include/stop_slave_sql.inc
|
||||
SET GLOBAL debug=@old_debug;
|
||||
RESET SLAVE;
|
||||
RESET MASTER;
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
44
build/lib/mysql/mysql-test/suite/rpl/t/rpl_binlog_grant.test
Normal file
44
build/lib/mysql/mysql-test/suite/rpl/t/rpl_binlog_grant.test
Normal file
@@ -0,0 +1,44 @@
|
||||
source include/master-slave.inc;
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
|
||||
let $VERSION=`select version()`;
|
||||
|
||||
# Bug #21975: grant/revoke statements in transaction
|
||||
# used to disappear from binlog upon rallback.
|
||||
# Now GRANT/REVOKE do implicitly commit
|
||||
# transaction
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists d1;
|
||||
--enable_warnings
|
||||
create database d1;
|
||||
use d1;
|
||||
create table t (s1 int) engine=innodb;
|
||||
set @@autocommit=0;
|
||||
start transaction;
|
||||
insert into t values (1);
|
||||
grant select on t to x@y;
|
||||
let $wait_binlog_event= grant select;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
#
|
||||
# There is no active transaction here
|
||||
#
|
||||
rollback;
|
||||
show grants for x@y;
|
||||
start transaction;
|
||||
insert into t values (2);
|
||||
revoke select on t from x@y;
|
||||
let $wait_binlog_event= revoke select;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
#
|
||||
# There is no active transaction here
|
||||
#
|
||||
commit;
|
||||
select * from t;
|
||||
show grants for x@y;
|
||||
drop user x@y;
|
||||
drop database d1;
|
||||
--sync_slave_with_master
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,465 @@
|
||||
########################################################################################
|
||||
# This test verifies if the binlog is not corrupted when the cache buffer is not
|
||||
# big enough to accommodate the changes and is divided in five steps:
|
||||
#
|
||||
# 1 - Single Statements:
|
||||
# 1.1 - Single statement on transactional table.
|
||||
# 1.2 - Single statement on non-transactional table.
|
||||
# 1.3 - Single statement on both transactional and non-transactional tables.
|
||||
# In both 1.2 and 1.3, an incident event is logged to notify the user that the
|
||||
# master and slave are diverging.
|
||||
#
|
||||
# 2 - Transactions ended by an implicit commit.
|
||||
#
|
||||
# 3 - Transactions ended by a COMMIT.
|
||||
#
|
||||
# 4 - Transactions ended by a ROLLBACK.
|
||||
#
|
||||
# 5 - Transactions with a failing statement that updates a non-transactional
|
||||
# table. In this case, a failure means that the statement does not get into
|
||||
# the cache and an incident event is logged to notify the user that the master
|
||||
# and slave are diverging.
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
########################################################################################
|
||||
# Configuring the environment
|
||||
########################################################################################
|
||||
--source include/have_innodb.inc
|
||||
--source include/master-slave.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/not_windows.inc
|
||||
|
||||
let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
|
||||
let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
|
||||
|
||||
SET GLOBAL max_binlog_cache_size = 4096;
|
||||
# Becuase of bug#55377, we have to set binlog_cache_size until the bug is
|
||||
# fixed.
|
||||
SET GLOBAL binlog_cache_size = 4096;
|
||||
disconnect master;
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
|
||||
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
|
||||
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
|
||||
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
|
||||
|
||||
let $data = `select concat('"', repeat('a',2000), '"')`;
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 1 - SINGLE STATEMENT
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
|
||||
--echo *** Single statement on transactional table ***
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval INSERT INTO t1 (a, data) VALUES (1,
|
||||
CONCAT($data, $data, $data, $data, $data));
|
||||
--enable_query_log
|
||||
|
||||
--echo *** Single statement on non-transactional table ***
|
||||
--echo *** After WL#2687 the difference between STATEMENT/MIXED and ROW will not exist. ***
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
eval INSERT INTO t2 (a, data) VALUES (2,
|
||||
CONCAT($data, $data, $data, $data, $data, $data));
|
||||
# Below code fakes the result of 'ROW' mode.
|
||||
--echo Got one of the listed errors
|
||||
# Ensure same message as in the case binlog_format=row below
|
||||
--echo include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
|
||||
}
|
||||
if (`SELECT @@binlog_format = 'ROW'`)
|
||||
{
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval INSERT INTO t2 (a, data) VALUES (2,
|
||||
CONCAT($data, $data, $data, $data, $data, $data));
|
||||
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
}
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
eval INSERT INTO t2 (a, data) VALUES (3, $data);
|
||||
eval INSERT INTO t2 (a, data) VALUES (4, $data);
|
||||
eval INSERT INTO t2 (a, data) VALUES (5, $data);
|
||||
--enable_query_log
|
||||
|
||||
--echo *** Single statement on both transactional and non-transactional tables. ***
|
||||
--echo *** After WL#2687 we will be able to change the order of the tables. ***
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
|
||||
t1.data = CONCAT($data, $data, $data, $data);
|
||||
--enable_query_log
|
||||
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
#--echo ########################################################################################
|
||||
#--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL
|
||||
#--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
ALTER TABLE t3 ADD COLUMN d int;
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t2 (a, data) VALUES (10, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (11, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (12, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (13, $data);
|
||||
--enable_query_log
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (14, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (15, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (16, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (17, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (19, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (20, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (21, 's');
|
||||
--enable_query_log
|
||||
|
||||
if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
--disable_query_log
|
||||
CREATE TABLE t4 SELECT * FROM t1;
|
||||
--enable_query_log
|
||||
--echo Got one of the listed errors
|
||||
}
|
||||
if (`SELECT @@binlog_format = 'ROW'`)
|
||||
{
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
CREATE TABLE t4 SELECT * FROM t1;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t2 (a, data) VALUES (15, $data);
|
||||
--enable_query_log
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (22, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (23, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (24, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (25, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (26, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (27, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (28, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (29, 's');
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
CREATE TABLE t5 (a int);
|
||||
--enable_query_log
|
||||
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 3 - BEGIN - COMMIT
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 4 - BEGIN - ROLLBACK
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
ROLLBACK;
|
||||
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 5 - PROCEDURE
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
DELIMITER //;
|
||||
|
||||
CREATE PROCEDURE p1(pd VARCHAR(30000))
|
||||
BEGIN
|
||||
INSERT INTO t1 (a, data) VALUES (1, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (2, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (3, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (4, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (5, 's');
|
||||
END//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--disable_query_log
|
||||
eval CALL p1($data);
|
||||
--enable_query_log
|
||||
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval CALL p1($data);
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval CALL p1($data);
|
||||
--enable_query_log
|
||||
ROLLBACK;
|
||||
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 6 - XID
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
SAVEPOINT sv;
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
ROLLBACK TO sv;
|
||||
COMMIT;
|
||||
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 7 - NON-TRANS TABLE
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval UPDATE t2 SET data= CONCAT($data, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (10, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (11, 's');
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (15, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (16, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (17, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # 8 - Bug#55375(Regression Bug) Transaction bigger than
|
||||
--echo # max_binlog_cache_size crashes slave
|
||||
--echo ########################################################################
|
||||
|
||||
SET GLOBAL max_binlog_cache_size = 4096;
|
||||
SET GLOBAL binlog_cache_size = 4096;
|
||||
|
||||
source include/stop_slave.inc;
|
||||
source include/start_slave.inc;
|
||||
CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*");
|
||||
CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*");
|
||||
CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master. Message: error writing to the binary log");
|
||||
|
||||
connection master;
|
||||
TRUNCATE t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--let binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
|
||||
connection master;
|
||||
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
|
||||
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
|
||||
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
|
||||
--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
|
||||
disconnect master;
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
|
||||
--let $n=128
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--echo Repeat statement 'INSERT INTO t1 VALUES(\$n, repeat("a", 32))' $n times
|
||||
while ($n)
|
||||
{
|
||||
--eval INSERT INTO t1 VALUES ($n, repeat("a", 32))
|
||||
--dec $n
|
||||
}
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
--connection slave
|
||||
--let $slave_sql_errno= 1197
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
|
||||
SELECT count(*) FROM t1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
|
||||
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
|
||||
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
|
||||
--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
|
||||
|
||||
source include/stop_slave.inc;
|
||||
source include/start_slave.inc;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
SELECT count(*) FROM t1;
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # CLEAN
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
# t4 exists only if binlog_format!=row, so so a warning is generated
|
||||
# if binog_format=row
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t4;
|
||||
--enable_warnings
|
||||
DROP TABLE t5;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
95
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bit.test
Normal file
95
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bit.test
Normal file
@@ -0,0 +1,95 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Sept/15/2005 #
|
||||
#############################################################################
|
||||
# Test: To test the replication of the bit field #
|
||||
#############################################################################
|
||||
# Change Author: JBM
|
||||
# Change Date: 2006-01-16
|
||||
# Change: Added Order by for NDB
|
||||
##########
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
|
||||
CREATE TABLE test.t1 (
|
||||
dummyKey INTEGER NOT NULL,
|
||||
f01 TINYINT,
|
||||
f10 TINYINT,
|
||||
f12 TINYINT,
|
||||
f15 TINYINT,
|
||||
f16 TINYINT,
|
||||
f7 TINYINT,
|
||||
f9 TINYINT,
|
||||
f29 TINYINT,
|
||||
f0 TINYINT,
|
||||
fA1 TINYINT,
|
||||
C32 TINYINT,
|
||||
A42 TINYINT,
|
||||
CA3 TINYINT,
|
||||
A044 TINYINT,
|
||||
f001 TINYINT,
|
||||
A3002 TINYINT,
|
||||
fC003 TINYINT,
|
||||
CA300 TINYINT,
|
||||
A305 TINYINT,
|
||||
CA321 TINYINT,
|
||||
r001 TINYINT,
|
||||
bit1 BIT(6),
|
||||
bit2 BIT(6),
|
||||
bit3 BIT(6),
|
||||
State1 TINYINT,
|
||||
State2 TINYINT,
|
||||
State3 TINYINT,
|
||||
State4 TINYINT,
|
||||
SubState TINYINT,
|
||||
gState TINYINT,
|
||||
oSupp TINYINT,
|
||||
tSupp TINYINT,
|
||||
sSuppD TINYINT,
|
||||
mSuppf TINYINT,
|
||||
GSuppDf TINYINT,
|
||||
VNotSupp TINYINT,
|
||||
x034 TINYINT,
|
||||
PRIMARY KEY USING HASH (dummyKey) );
|
||||
|
||||
LOCK TABLES test.t1 WRITE;
|
||||
INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
|
||||
SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
|
||||
SELECT hex(bit2) from test.t1 ORDER BY bit2;
|
||||
SELECT hex(bit3) from test.t1 ORDER BY bit3;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
|
||||
SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
|
||||
SELECT hex(bit2) from test.t1 ORDER BY bit2;
|
||||
SELECT hex(bit3) from test.t1 ORDER BY bit3;
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.0 test case
|
||||
--source include/rpl_end.inc
|
||||
117
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bit_npk.test
Normal file
117
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bit_npk.test
Normal file
@@ -0,0 +1,117 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Sept/15/2005 #
|
||||
#############################################################################
|
||||
# Test: To test the replication of the bit field #
|
||||
#############################################################################
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
|
||||
CREATE TABLE test.t1 (
|
||||
dummyKey INTEGER NOT NULL,
|
||||
f01 TINYINT,
|
||||
f10 TINYINT,
|
||||
f12 TINYINT,
|
||||
f15 TINYINT,
|
||||
f16 TINYINT,
|
||||
f7 TINYINT,
|
||||
f9 TINYINT,
|
||||
f29 TINYINT,
|
||||
f0 TINYINT,
|
||||
fA1 TINYINT,
|
||||
C32 TINYINT,
|
||||
A42 TINYINT,
|
||||
CA3 TINYINT,
|
||||
A044 TINYINT,
|
||||
f001 TINYINT,
|
||||
A3002 TINYINT,
|
||||
fC003 TINYINT,
|
||||
CA300 TINYINT,
|
||||
A305 TINYINT,
|
||||
CA321 TINYINT,
|
||||
r001 TINYINT,
|
||||
bit1 BIT(6),
|
||||
bit2 BIT(6),
|
||||
bit3 BIT(6),
|
||||
State1 TINYINT,
|
||||
State2 TINYINT,
|
||||
State3 TINYINT,
|
||||
State4 TINYINT,
|
||||
SubState TINYINT,
|
||||
gState TINYINT,
|
||||
oSupp TINYINT,
|
||||
tSupp TINYINT,
|
||||
sSuppD TINYINT,
|
||||
mSuppf TINYINT,
|
||||
GSuppDf TINYINT,
|
||||
VNotSupp TINYINT,
|
||||
x034 TINYINT);
|
||||
|
||||
LOCK TABLES test.t1 WRITE;
|
||||
INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1);
|
||||
INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
UNLOCK TABLES;
|
||||
|
||||
UPDATE test.t1 set x034 = 50 where bit3 = b'000000';
|
||||
UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0';
|
||||
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
|
||||
FROM test.t1
|
||||
ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
|
||||
SELECT hex(bit1) from test.t1 ORDER BY bit1;
|
||||
SELECT hex(bit2) from test.t1 ORDER BY bit2;
|
||||
SELECT hex(bit3) from test.t1 ORDER BY bit3;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
|
||||
FROM test.t1
|
||||
ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
|
||||
SELECT hex(bit1) from test.t1 ORDER BY bit1;
|
||||
SELECT hex(bit2) from test.t1 ORDER BY bit2;
|
||||
SELECT hex(bit3) from test.t1 ORDER BY bit3;
|
||||
|
||||
connection master;
|
||||
CREATE TABLE test.t2 (a INT, b BIT(1));
|
||||
INSERT INTO test.t2 VALUES (1, b'0');
|
||||
INSERT INTO test.t2 VALUES (1, b'1');
|
||||
UPDATE test.t2 SET a = 2 WHERE b = b'1';
|
||||
|
||||
CREATE TABLE test.t3 (a INT, b INT);
|
||||
INSERT INTO test.t3 VALUES (1, NULL);
|
||||
INSERT INTO test.t3 VALUES (1, 0);
|
||||
UPDATE test.t3 SET a = 2 WHERE b = 0;
|
||||
|
||||
SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
|
||||
SELECT * FROM test.t3 ORDER BY a,b;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
|
||||
SELECT * FROM test.t3 ORDER BY a,b;
|
||||
|
||||
connection master;
|
||||
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
|
||||
--source include/rpl_end.inc
|
||||
85
build/lib/mysql/mysql-test/suite/rpl/t/rpl_blackhole.test
Normal file
85
build/lib/mysql/mysql-test/suite/rpl/t/rpl_blackhole.test
Normal file
@@ -0,0 +1,85 @@
|
||||
# PURPOSE. Test that blackhole works with replication in all three
|
||||
# modes: STATEMENT, MIXED, and ROW.
|
||||
#
|
||||
# METHOD. We start by creating a table on the master and then change
|
||||
# the engine to use blackhole on the slave.
|
||||
#
|
||||
# After insert/update/delete of one or more rows, the test the
|
||||
# proceeds to check that replication is running after replicating an
|
||||
# change, that the blackhole engine does not contain anything (which
|
||||
# is just a check that the correct engine is used), and that something
|
||||
# is written to the binary log.
|
||||
#
|
||||
# Whe check INSERT, UPDATE, and DELETE statement for tables with no
|
||||
# key (forcing a range search on the slave), primary keys (using a
|
||||
# primary key lookup), and index/key with multiple matches (forcing an
|
||||
# index search).
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_blackhole.inc;
|
||||
|
||||
# We start with no primary key
|
||||
CREATE TABLE t1 (a INT, b INT, c INT);
|
||||
CREATE TABLE t2 (a INT, b INT, c INT);
|
||||
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t1 ENGINE=BLACKHOLE;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t2 VALUES (1,9,1), (2,9,2), (3,9,3), (4,9,4);
|
||||
sync_slave_with_master;
|
||||
|
||||
# Test insert, no primary key
|
||||
let $statement = INSERT INTO t1 VALUES (1,1,1),(2,1,2),(3,1,3),(4,1,4);
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test update, no primary key
|
||||
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 1;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test delete, no primary key
|
||||
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 1;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test INSERT-SELECT into Blackhole, no primary key
|
||||
let $statement = INSERT INTO t1 SELECT * FROM t2;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test INSERT-SELECT from Blackhole, no primary key
|
||||
let $statement = INSERT INTO t2 SELECT * FROM t1;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
connection master;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);
|
||||
|
||||
# Test insert, primary key
|
||||
let $statement = INSERT INTO t1 VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4);
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test update, primary key
|
||||
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 2;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test delete, primary key
|
||||
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 2;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
connection master;
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD KEY key_t1 (a);
|
||||
|
||||
# Test insert, key
|
||||
let $statement = INSERT INTO t1 VALUES (1,3,1),(2,3,2),(3,3,3),(4,3,4);
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test update, key
|
||||
let $statement = UPDATE t1 SET c = 2*c WHERE a % 2 = 0 AND b = 3;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
# Test delete, key
|
||||
let $statement = DELETE FROM t1 WHERE a % 2 = 0 AND b = 3;
|
||||
source extra/rpl_tests/rpl_blackhole.test;
|
||||
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1,t2;
|
||||
--source include/rpl_end.inc
|
||||
99
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug26395.test
Normal file
99
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug26395.test
Normal file
@@ -0,0 +1,99 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Tests that an autocommitted XA transaction where the master crashes
|
||||
# just before writing the XID log event is executed correctly. The
|
||||
# master rolls back, so the slave should not execute statement.
|
||||
#
|
||||
# This test was previously part of rpl_ndb_transaction.test
|
||||
#
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# We want master to be alive so that it can replicate the statement to
|
||||
# the slave. So in the test case, we must not crash the
|
||||
# master. Instead, we fake the crash by just not writing the XID event
|
||||
# to the binlog. This is done by the @@debug='d,do_not_write_xid'
|
||||
# flag. This, in turn, requires us to do 'source
|
||||
# include/have_debug.inc'
|
||||
#
|
||||
# So, unlike if the master had crashed, the master *will* execute the
|
||||
# statement. But the slave should not execute it. Hence, after the
|
||||
# test is executed, the expected result on master is a table with one
|
||||
# row, and on slave a table with no rows.
|
||||
#
|
||||
# To simulate the slave correctly, we wait until everything up to but
|
||||
# not including the XID is replicated. This has to be done with
|
||||
# include/sync_slave_io_with_master.inc, not sync_slave_with_master,
|
||||
# since the latter waits until the slave *SQL* thread has caught up
|
||||
# with the master's position, which it will never do.
|
||||
#
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#26395: if crash during autocommit update to transactional table on master, slave fails
|
||||
|
||||
source include/have_innodb.inc;
|
||||
# have_debug is needed since we use the @@debug variable on master
|
||||
source include/have_debug.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
|
||||
--echo ==== Initialize ====
|
||||
|
||||
--echo [on master]
|
||||
--connection master
|
||||
|
||||
CREATE TABLE tinnodb (a INT) ENGINE = INNODB;
|
||||
SHOW CREATE TABLE tinnodb;
|
||||
|
||||
# do_not_write_xid stops the master from writing an XID event.
|
||||
set @old_debug= @@debug;
|
||||
set @@debug= 'd,do_not_write_xid';
|
||||
|
||||
|
||||
--echo ==== Test ====
|
||||
|
||||
# Save the position up to which the slave SQL thread should execute.
|
||||
save_master_pos;
|
||||
|
||||
# Execute query and check that the row made it to the table.
|
||||
INSERT INTO tinnodb VALUES (1);
|
||||
SELECT * FROM tinnodb ORDER BY a;
|
||||
|
||||
# Sync slave's IO thread.
|
||||
--echo [on slave]
|
||||
source include/sync_slave_io_with_master.inc;
|
||||
|
||||
# Sync slave's SQL thread.
|
||||
sync_with_master 0;
|
||||
|
||||
|
||||
--echo ==== Verify results on slave ====
|
||||
|
||||
source include/stop_slave.inc;
|
||||
let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1);
|
||||
eval SELECT "$tmp" AS Slave_IO_State;
|
||||
let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
eval SELECT "$tmp" AS Last_SQL_Error;
|
||||
let $tmp= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1);
|
||||
eval SELECT "$tmp" AS Last_IO_Error;
|
||||
SELECT * FROM tinnodb ORDER BY a;
|
||||
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
# Easiest to clean up master and slave separately, without
|
||||
# replication, since master and slave are out of sync.
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
DROP TABLE tinnodb;
|
||||
set @@debug= @old_debug;
|
||||
|
||||
--echo [on slave]
|
||||
connection slave;
|
||||
DROP TABLE tinnodb;
|
||||
|
||||
# Warning: do not add more tests here. The binlog is in a bad state.
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
137
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug31076.test
Normal file
137
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug31076.test
Normal file
@@ -0,0 +1,137 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
CREATE DATABASE track;
|
||||
USE track;
|
||||
|
||||
CREATE TABLE `visits` (
|
||||
`visits_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`myid` varchar(32) NOT NULL DEFAULT '',
|
||||
`src` varchar(64) NOT NULL DEFAULT '',
|
||||
`ip` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`cc` char(2) NOT NULL DEFAULT '',
|
||||
`org` varchar(80) DEFAULT NULL,
|
||||
`ref` varchar(255) NOT NULL DEFAULT '',
|
||||
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`host` varchar(30) NOT NULL DEFAULT '',
|
||||
`entry` varchar(255) NOT NULL DEFAULT '',
|
||||
`visit_exit` varchar(255) NOT NULL DEFAULT '',
|
||||
`user_id` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`visit_start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`visits_id`),
|
||||
KEY `ip` (`ip`),
|
||||
KEY `time` (`time`),
|
||||
KEY `user_id` (`user_id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=21293381 DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `visits_events` (
|
||||
`event_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`visit_id` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`src` varchar(64) NOT NULL DEFAULT '',
|
||||
`data` varchar(255) NOT NULL DEFAULT '',
|
||||
`visits_events_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`visits_events_id`),
|
||||
KEY `event_id` (`event_id`),
|
||||
KEY `visit_id` (`visit_id`),
|
||||
KEY `data` (`data`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1;
|
||||
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
--delimiter /*!*/;
|
||||
|
||||
# at 4 (0x4)
|
||||
#071204 14:29:31 server id 1 end_log_pos 106
|
||||
# Position Timestamp Type Master ID Size Master Pos Flags
|
||||
# 4 3b 56 55 47 0f 01 00 00 00 66 00 00 00 6a 00 00 00 00 00
|
||||
# 17 04 00 35 2e 31 2e 32 33 2d 72 63 2d 64 65 62 75 |..5.1.23.rc.debu|
|
||||
# 27 67 2d 6c 6f 67 00 00 00 00 00 00 00 00 00 00 00 |g.log...........|
|
||||
# 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
|
||||
# 47 00 00 00 00 3b 56 55 47 13 38 0d 00 08 00 12 00 |.....VUG.8......|
|
||||
# 57 04 04 04 04 12 00 00 53 00 04 1a 08 00 00 00 08 |.......S........|
|
||||
# 67 08 08 02 |...|
|
||||
# Start: binlog v 4, server v 5.1.23-rc-debug-log created 071204 14:29:31 at startup
|
||||
|
||||
BINLOG '
|
||||
O1ZVRw8BAAAAZgAAAGoAAAAAAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAA7VlVHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
||||
'/*!*/;
|
||||
|
||||
# at 164170623
|
||||
# at 164170679
|
||||
#7918 3:59:2 server id 436 end_log_pos 164170679
|
||||
# 9c90b7f 06 4d ef 46 13 b4 01 00 00 38 00 00 00 b7 0b c9 |.M.F.....8......|
|
||||
# 9c90b8f 09 00 00 99 57 17 02 00 00 00 00 05 74 72 61 63 |....W.......trac|
|
||||
# 9c90b9f 6b 00 0d 76 69 |k..vi|
|
||||
# Table_map: `track`.`visits_events` mapped to number 35084185
|
||||
#7918 3:59:2 server id 436 end_log_pos 164170769
|
||||
# 9c90bb7 06 4d ef 46 17 b4 01 00 00 5a 00 00 00 11 0c c9 |.M.F.....Z......|
|
||||
# 9c90bc7 09 10 00 99 57 17 02 00 00 01 00 06 ff c0 20 4e |....W..........N|
|
||||
# 9c90bd7 00 be f5 43 01 06 4d ef 46 00 2b 44 6f 77 6e 6c |...C..M.F..Downl|
|
||||
# 9c90be7 6f 61 64 73 2f 4d 79 53 51 4c 2d 34 2e 31 2f 6d |oads.MySQL.4.1.m|
|
||||
# 9c90bf7 79 73 71 6c 2d 34 2e |ysql.4.|
|
||||
# Write_rows: table id 35084185 flags: STMT_END_F
|
||||
|
||||
BINLOG '
|
||||
Bk3vRhO0AQAAOAAAALcLyQkAAJlXFwIAAAAABXRyYWNrAA12aXNpdHNfZXZlbnRzAAYJAwcPDwM=
|
||||
Bk3vRhe0AQAAWgAAABEMyQkQAJlXFwIAAAEABv/AIE4AvvVDAQZN70YAK0Rvd25sb2Fkcy9NeVNR
|
||||
TC00LjEvbXlzcWwtNC4xLjEyYS13aW4zMi56aXBPaAIC
|
||||
'/*!*/;
|
||||
# at 164170769
|
||||
#7918 3:59:2 server id 436 end_log_pos 164170797
|
||||
# 9c90c11 06 4d ef 46 05 b4 01 00 00 |.M.F.....|
|
||||
# Intvar
|
||||
SET INSERT_ID=21231039/*!*/;
|
||||
# at 164170797
|
||||
#7918 3:59:2 server id 436 end_log_pos 164171293
|
||||
# 9c90c2d 06 4d ef 46 02 b4 01 00 00 f0 01 00 00 1d 0e c9 |.M.F............|
|
||||
# 9c90c3d 09 10 00 28 80 af 01 00 00 00 00 05 00 00 1f 00 |................|
|
||||
# 9c90c4d 00 00 40 00 00 01 00 00 00 00 00 00 00 00 06 03 |................|
|
||||
# 9c90c5d 73 74 64 04 08 00 08 00 08 00 05 03 55 54 43 74 |std.........UTCt|
|
||||
# 9c90c6d 72 61 63 6b 00 49 4e 53 45 52 54 20 49 4e 54 4f |rack.INSERT.INTO|
|
||||
# 9c90c7d 20 76 69 73 69 74 73 20 28 6d 79 69 64 2c 20 75 |.visits..myid..u|
|
||||
# 9c90c8d 73 65 72 5f 69 64 2c 20 73 72 63 2c 20 69 70 2c |ser.id..src..ip.|
|
||||
# 9c90c9d 20 63 63 2c 20 6f 72 67 2c 20 72 65 66 2c 20 74 |.cc..org..ref..t|
|
||||
# 9c90cad 69 6d 65 2c 20 68 6f 73 74 2c 20 65 6e 74 72 79 |ime..host..entry|
|
||||
# 9c90cbd 2c 20 76 69 73 69 74 5f 65 78 69 74 2c 20 76 69 |..visit.exit..vi|
|
||||
# 9c90ccd 73 69 74 5f 73 74 61 72 74 29 0a 09 09 09 56 41 |sit.start.....VA|
|
||||
# 9c90cdd 4c 55 45 53 20 28 27 33 6d 33 6c 34 72 68 73 36 |LUES...3m3l4rhs6|
|
||||
# 9c90ced 64 6f 30 73 66 35 70 31 69 39 6c 72 39 34 67 39 |do0sf5p1i9lr94g9|
|
||||
# 9c90cfd 32 38 61 32 37 32 76 27 2c 20 27 27 2c 20 27 27 |28a272v.........|
|
||||
# 9c90d0d 2c 20 49 4e 45 54 5f 41 54 4f 4e 28 27 37 31 2e |..INET.ATON..71.|
|
||||
# 9c90d1d 31 31 38 2e 31 32 34 2e 39 38 27 29 2c 20 27 27 |118.124.98......|
|
||||
# 9c90d2d 2c 20 27 27 2c 20 27 68 74 74 70 3a 2f 2f 64 65 |.......http...de|
|
||||
# 9c90d3d 76 2e 6d 79 73 71 6c 2e 63 6f 6d 2f 64 6f 77 6e |v.mysql.com.down|
|
||||
# 9c90d4d 6c 6f 61 64 73 2f 63 6f 6e 6e 65 63 74 6f 72 2f |loads.connector.|
|
||||
# 9c90d5d 6a 2f 33 2e 30 2e 68 74 6d 6c 27 2c 20 4e 55 4c |j.3.0.html...NUL|
|
||||
# 9c90d6d 4c 2c 20 27 64 65 76 2e 6d 79 73 71 6c 2e 63 6f |L...dev.mysql.co|
|
||||
# 9c90d7d 6d 27 2c 20 27 2f 67 65 74 2f 44 6f 77 6e 6c 6f |m.....get.Downlo|
|
||||
# 9c90d8d 61 64 73 2f 43 6f 6e 6e 65 63 74 6f 72 2d 4a 2f |ads.Connector.J.|
|
||||
# 9c90d9d 6d 79 73 71 6c 2d 63 6f 6e 6e 65 63 74 6f 72 2d |mysql.connector.|
|
||||
# 9c90dad 6a 61 76 61 2d 33 2e 30 2e 31 37 2d 67 61 2e 7a |java.3.0.17.ga.z|
|
||||
# 9c90dbd 69 70 2f 66 72 6f 6d 2f 70 69 63 6b 27 2c 20 27 |ip.from.pick....|
|
||||
# 9c90dcd 2f 67 65 74 2f 44 6f 77 6e 6c 6f 61 64 73 2f 43 |.get.Downloads.C|
|
||||
# 9c90ddd 6f 6e 6e 65 63 74 6f 72 2d 4a 2f 6d 79 73 71 6c |onnector.J.mysql|
|
||||
# 9c90ded 2d 63 6f 6e 6e 65 63 74 6f 72 2d 6a 61 76 61 2d |.connector.java.|
|
||||
# 9c90dfd 33 2e 30 2e 31 37 2d 67 61 2e 7a 69 70 |3.0.17.ga.zip|
|
||||
# Query thread_id=28278824 exec_time=0 error_code=0
|
||||
use track/*!*/;
|
||||
SET TIMESTAMP=1190087942/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.time_zone='UTC'/*!*/;
|
||||
INSERT INTO visits (myid, user_id, src, ip, cc, org, ref, time, host, entry, visit_exit, visit_start)
|
||||
VALUES ('3m3l4rhs6do0sf5p1i9lr94g928a272v', '', '', INET_ATON('71.118.124.98'), '', '', 'http://dev.mysql.com/downloads/connector/j/3.0.html', NULL, 'dev.mysql.com', '/get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick', '/get/Downloads/Connector-J/mysql-connector-java-3.0.17-ga.zip/from/pick', NOW())/*!*/;
|
||||
# at 164171293
|
||||
|
||||
--delimiter ;
|
||||
|
||||
SELECT * FROM visits;
|
||||
SELECT * FROM visits_events;
|
||||
|
||||
# Cleanup
|
||||
DROP DATABASE track;
|
||||
sync_slave_with_master;
|
||||
--echo End of 5.1 tests
|
||||
--source include/rpl_end.inc
|
||||
41
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug33931.test
Normal file
41
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug33931.test
Normal file
@@ -0,0 +1,41 @@
|
||||
# Test for
|
||||
# Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails
|
||||
# Bug #33932 assertion at handle_slave_sql if init_slave_thread() fails
|
||||
|
||||
source include/have_debug.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection slave;
|
||||
|
||||
# Add suppression for expected warnings in slaves error log
|
||||
call mtr.add_suppression("Failed during slave I/O thread initialization");
|
||||
call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.* 1593");
|
||||
|
||||
--source include/stop_slave.inc
|
||||
reset slave;
|
||||
|
||||
# Set debug flags on slave to force errors to occur
|
||||
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
|
||||
|
||||
start slave;
|
||||
|
||||
#
|
||||
# slave is going to stop because of emulated failures
|
||||
# but there won't be any crashes nor asserts hit.
|
||||
#
|
||||
|
||||
# 1593 = ER_SLAVE_FATAL_ERROR
|
||||
--let $slave_sql_errno= 1593
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
SET GLOBAL debug="";
|
||||
|
||||
# Clear Last_SQL_Error
|
||||
RESET SLAVE;
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
22
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug37426.test
Normal file
22
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug37426.test
Normal file
@@ -0,0 +1,22 @@
|
||||
#############################################################
|
||||
# Purpose: Test for BUG#37426
|
||||
# RBR breaks for CHAR() UTF8 fields > 85 chars
|
||||
#############################################################
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_row.inc;
|
||||
|
||||
connection master;
|
||||
CREATE TABLE char128_utf8 (i1 INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, i2 INT NOT NULL);
|
||||
INSERT INTO char128_utf8 VALUES ( 1, "123", 1 );
|
||||
|
||||
SELECT * FROM char128_utf8;
|
||||
sync_slave_with_master;
|
||||
|
||||
SELECT * FROM char128_utf8;
|
||||
|
||||
# Clean up
|
||||
connection master;
|
||||
DROP TABLE char128_utf8;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
11
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug38694.test
Normal file
11
build/lib/mysql/mysql-test/suite/rpl/t/rpl_bug38694.test
Normal file
@@ -0,0 +1,11 @@
|
||||
# Testing replication threads stopping concurrency issue
|
||||
# at the server shutdown
|
||||
# Related bugs: bug#38694, bug#29968, bug#25306
|
||||
# The test checks if a delay at the termination phase of slave threads
|
||||
# DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
|
||||
# could cause any issue.
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
# End of tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,52 @@
|
||||
# Verify that after CHANGE MASTER, replication (I/O thread and SQL
|
||||
# thread) restart from where SQL thread left, not from where
|
||||
# I/O thread left (some old bug fixed in 4.0.17)
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection master;
|
||||
# Make SQL slave thread advance a bit
|
||||
create table t1(n int);
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
# Now stop it and make I/O slave thread be ahead
|
||||
stop slave sql_thread;
|
||||
connection master;
|
||||
insert into t1 values(1);
|
||||
insert into t1 values(2);
|
||||
save_master_pos;
|
||||
let $slave_param= Read_Master_Log_Pos;
|
||||
let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
connection slave;
|
||||
source include/wait_for_slave_param.inc;
|
||||
source include/stop_slave.inc;
|
||||
|
||||
let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
|
||||
let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
|
||||
if (`SELECT $read_pos = $exec_pos`)
|
||||
{
|
||||
source include/show_rpl_debug_info.inc;
|
||||
echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
|
||||
die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
|
||||
}
|
||||
change master to master_user='root';
|
||||
let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
|
||||
let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
|
||||
if (`SELECT $read_pos <> $exec_pos`)
|
||||
{
|
||||
source include/show_rpl_debug_info.inc;
|
||||
echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
|
||||
die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
|
||||
}
|
||||
|
||||
start slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
2
build/lib/mysql/mysql-test/suite/rpl/t/rpl_charset.test
Normal file
2
build/lib/mysql/mysql-test/suite/rpl/t/rpl_charset.test
Normal file
@@ -0,0 +1,2 @@
|
||||
let $engine_type=myisam;
|
||||
source extra/rpl_tests/rpl_charset.test;
|
||||
26
build/lib/mysql/mysql-test/suite/rpl/t/rpl_charset_sjis.test
Normal file
26
build/lib/mysql/mysql-test/suite/rpl/t/rpl_charset_sjis.test
Normal file
@@ -0,0 +1,26 @@
|
||||
source include/have_sjis.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
--enable_warnings
|
||||
create table t1 (a varchar(255) character set sjis);
|
||||
create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a);
|
||||
|
||||
SET NAMES binary;
|
||||
CALL p1 ('–\\');
|
||||
select "--- on master ---";
|
||||
select hex(a) from t1 ;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select "--- on slave ---";
|
||||
select hex(a) from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop procedure p1;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
# End of 5.0 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,24 @@
|
||||
!include ../my.cnf
|
||||
|
||||
[mysqld.1]
|
||||
log-slave-updates
|
||||
innodb
|
||||
|
||||
[mysqld.2]
|
||||
log-slave-updates
|
||||
innodb
|
||||
|
||||
[mysqld.3]
|
||||
log-slave-updates
|
||||
innodb
|
||||
|
||||
[mysqld.4]
|
||||
log-slave-updates
|
||||
innodb
|
||||
|
||||
[ENV]
|
||||
SERVER_MYPORT_3= @mysqld.3.port
|
||||
SERVER_MYSOCK_3= @mysqld.3.socket
|
||||
|
||||
SERVER_MYPORT_4= @mysqld.4.port
|
||||
SERVER_MYSOCK_4= @mysqld.4.socket
|
||||
@@ -0,0 +1,333 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Setup: circular replication on four hosts, i.e., topology
|
||||
# server_1 -> server_2 -> server_3 -> server_4 -> server_1
|
||||
#
|
||||
# Tested properties:
|
||||
# - Correctly configured autoinc works.
|
||||
# - Manual failover works.
|
||||
#
|
||||
# ==== Related bugs and worklogs ====
|
||||
#
|
||||
# WL#3754
|
||||
# BUG#49978
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# Set up circular ring and new names for servers
|
||||
--echo *** Set up circular replication on four servers ***
|
||||
--let $rpl_topology= 1->2->3->4->1
|
||||
--source include/rpl_init.inc
|
||||
--echo
|
||||
|
||||
#set auto inc variables at each server
|
||||
--let $_rpl_server= $rpl_server_count
|
||||
while ($_rpl_server)
|
||||
{
|
||||
--let $rpl_connection_name= server_$_rpl_server
|
||||
--source include/rpl_connection.inc
|
||||
eval SET auto_increment_increment= $rpl_server_count;
|
||||
eval SET auto_increment_offset= $_rpl_server;
|
||||
|
||||
--dec $_rpl_server
|
||||
}
|
||||
|
||||
# Preparing data.
|
||||
--echo *** Preparing data ***
|
||||
--connection server_1
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
|
||||
--source include/rpl_sync.inc
|
||||
--connection server_4
|
||||
--echo
|
||||
|
||||
#
|
||||
# Testing
|
||||
#
|
||||
|
||||
--echo *** Testing schema A->B->C->D->A ***
|
||||
--echo
|
||||
# insert data via all hosts
|
||||
--connection server_1
|
||||
INSERT INTO t1(b,c) VALUES('A',1);
|
||||
--sync_slave_with_master server_2
|
||||
INSERT INTO t1(b,c) VALUES('B',1);
|
||||
--sync_slave_with_master server_3
|
||||
INSERT INTO t1(b,c) VALUES('C',1);
|
||||
--sync_slave_with_master server_4
|
||||
INSERT INTO t1(b,c) VALUES('D',1);
|
||||
|
||||
--source include/rpl_sync.inc
|
||||
|
||||
--connection server_1
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--connection server_2
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--connection server_3
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--connection server_4
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--echo
|
||||
|
||||
--echo *** Testing schema A->B->D->A if C has failure ***
|
||||
--echo
|
||||
--echo * Do failure for C and then make new connection B->D *
|
||||
|
||||
# Note: server_N has auto_increment_offset=N. Below, we insert value 6
|
||||
# in the autoinc column on server_3 (and prevent it from replicating
|
||||
# further using SQL_SLAVE_SKIP_COUNTER on server_4). Due to the
|
||||
# auto_increment_offset setting, the autoinc value 6 is normally
|
||||
# generated on server_2. When we later insert a row on server_2, we
|
||||
# thus cause a duplicate key error on server_3.
|
||||
|
||||
# Do not replicate next event from C
|
||||
--connection server_4
|
||||
STOP SLAVE;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
source include/start_slave.inc;
|
||||
--connection server_3
|
||||
INSERT INTO t1 VALUES(6,'C',2);
|
||||
--sync_slave_with_master server_4
|
||||
|
||||
--connection server_2
|
||||
INSERT INTO t1(b,c) VALUES('B',2);
|
||||
# Wait while C will stop.
|
||||
--connection server_3
|
||||
# 1062 = ER_DUP_ENTRY
|
||||
call mtr.add_suppression("Slave SQL.*Duplicate entry .6. for key .PRIMARY.* Error_code: 1062");
|
||||
--let $slave_sql_errno= 1062
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
--connection server_1
|
||||
INSERT INTO t1(b,c) VALUES('A',2);
|
||||
--connection server_4
|
||||
INSERT INTO t1(b,c) VALUES('D',2);
|
||||
|
||||
|
||||
# Sync all servers except C
|
||||
--connection server_2
|
||||
let $wait_condition= SELECT COUNT(*)=3 FROM t1 WHERE a > 4;
|
||||
--let $server_connection= server_1
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
--echo * Data on servers (C failed) *
|
||||
# Masters C,D shouldn't have correct data
|
||||
--connection server_1
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection server_2
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection server_3
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection server_4
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--echo
|
||||
|
||||
--echo * Reconfigure replication to schema A->B->D->A *
|
||||
# Exclude Master C
|
||||
--connection server_3
|
||||
--source include/stop_slave_io.inc
|
||||
--let $pos_c= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
|
||||
--let $file_c= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1)
|
||||
|
||||
--connection server_4
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--let $rpl_topology= 1->2->4->1,2->3
|
||||
--let $rpl_master_log_file= 4:$file_c
|
||||
--let $rpl_master_log_pos= 4:$pos_c
|
||||
--source include/rpl_change_topology.inc
|
||||
|
||||
#--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 $file_c LOG_FILE $pos_c LOG_POS
|
||||
#--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SERVER_MYPORT_2,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c
|
||||
source include/start_slave.inc;
|
||||
--connection server_2
|
||||
--sync_slave_with_master server_4
|
||||
--sync_slave_with_master server_1
|
||||
--echo
|
||||
|
||||
--echo * Check data inserted before failure *
|
||||
--connection server_1
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection server_2
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection server_3
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection server_4
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--echo
|
||||
|
||||
--echo * Check data inserted after failure *
|
||||
--connection server_1
|
||||
INSERT INTO t1(b,c) VALUES('A',3);
|
||||
--connection server_2
|
||||
INSERT INTO t1(b,c) VALUES('B',3);
|
||||
--connection server_4
|
||||
INSERT INTO t1(b,c) VALUES('D',3);
|
||||
connection server_1;
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_sync.inc
|
||||
|
||||
--connection server_1
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection server_2
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection server_3
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection server_4
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection server_1
|
||||
--echo
|
||||
|
||||
--echo *** Testing restoring scheme A->B->C->D->A after failure ***
|
||||
--echo
|
||||
# Master D will ignore a next event from C so that event will not be
|
||||
# distributed to other servers
|
||||
--echo * Remove wrong event from C and restore B->C->D *
|
||||
--connection server_4
|
||||
source include/stop_slave.inc;
|
||||
--connection server_3
|
||||
DELETE FROM t1 WHERE a = 6;
|
||||
--source include/start_slave.inc
|
||||
--connection server_2
|
||||
--sync_slave_with_master server_3
|
||||
RESET MASTER;
|
||||
--let $file_d= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $pos_d= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--connection server_4
|
||||
RESET SLAVE;
|
||||
--let $rpl_topology= 1->2->3->4->1
|
||||
--let $rpl_master_log_file= 4:$file_d
|
||||
--let $rpl_master_log_pos= 4:$pos_d
|
||||
--source include/rpl_change_topology.inc
|
||||
#--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 $file_d LOG_FILE $pos_d LOG_POS
|
||||
#--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SERVER_MYPORT_3,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d
|
||||
--source include/start_slave.inc
|
||||
--connection server_3
|
||||
--sync_slave_with_master server_4
|
||||
--source include/rpl_sync.inc
|
||||
|
||||
--echo
|
||||
--echo * Check data inserted before restoring schema A->B->C->D->A *
|
||||
--connection server_1
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master server_2
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master server_3
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master server_4
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master server_1
|
||||
--echo
|
||||
|
||||
--echo * Check data inserted after restoring schema A->B->C->D->A *
|
||||
--connection server_1
|
||||
INSERT INTO t1(b,c) VALUES('A',4);
|
||||
--connection server_2
|
||||
INSERT INTO t1(b,c) VALUES('B',4);
|
||||
--connection server_3
|
||||
INSERT INTO t1(b,c) VALUES('C',4);
|
||||
--connection server_4
|
||||
INSERT INTO t1(b,c) VALUES('D',4);
|
||||
--connection server_1
|
||||
|
||||
--source include/rpl_sync.inc
|
||||
|
||||
--connection server_1
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection server_2
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection server_3
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection server_4
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection server_1
|
||||
--echo
|
||||
|
||||
--echo * Transactions with commits *
|
||||
# Testing mixing of transactions and regular inserts
|
||||
--connection server_1
|
||||
BEGIN;
|
||||
--connection server_3
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection server_1
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection server_1
|
||||
INSERT INTO t2(b,c) VALUES('A',1);
|
||||
--connection server_2
|
||||
INSERT INTO t2(b,c) VALUES('B',1);
|
||||
--connection server_3
|
||||
INSERT INTO t2(b,c) VALUES('C',1);
|
||||
--connection server_4
|
||||
INSERT INTO t2(b,c) VALUES('D',1);
|
||||
dec $counter;
|
||||
}
|
||||
--connection server_1
|
||||
COMMIT;
|
||||
--connection server_3
|
||||
COMMIT;
|
||||
--connection server_1
|
||||
--enable_query_log
|
||||
|
||||
--source include/rpl_sync.inc
|
||||
|
||||
--connection server_1
|
||||
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection server_2
|
||||
SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection server_3
|
||||
SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection server_4
|
||||
SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection server_1
|
||||
--echo
|
||||
|
||||
--echo * Transactions with rollbacks *
|
||||
# Testing mixing of transactions with rollback and regular inserts
|
||||
--connection server_1
|
||||
BEGIN;
|
||||
--connection server_3
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection server_1
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection server_1
|
||||
INSERT INTO t2(b,c) VALUES('A',2);
|
||||
--connection server_2
|
||||
INSERT INTO t2(b,c) VALUES('B',2);
|
||||
--connection server_3
|
||||
INSERT INTO t2(b,c) VALUES('C',2);
|
||||
--connection server_4
|
||||
INSERT INTO t2(b,c) VALUES('D',2);
|
||||
dec $counter;
|
||||
}
|
||||
--connection server_1
|
||||
ROLLBACK;
|
||||
--connection server_3
|
||||
ROLLBACK;
|
||||
--connection server_1
|
||||
--enable_query_log
|
||||
|
||||
--source include/rpl_sync.inc
|
||||
|
||||
--connection server_1
|
||||
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection server_2
|
||||
SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection server_3
|
||||
SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection server_4
|
||||
SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection server_1
|
||||
|
||||
--echo
|
||||
|
||||
# Clean up
|
||||
--echo *** Clean up ***
|
||||
--connection server_1
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
221
build/lib/mysql/mysql-test/suite/rpl/t/rpl_colSize.test
Normal file
221
build/lib/mysql/mysql-test/suite/rpl/t/rpl_colSize.test
Normal file
@@ -0,0 +1,221 @@
|
||||
##################################################################
|
||||
# rpl_colSize #
|
||||
# #
|
||||
# This test is designed to test the changes included in WL#3228. #
|
||||
# The changes include the ability to replicate with the master #
|
||||
# having columns that are smaller (shorter) than the slave. #
|
||||
##################################################################
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo **** Testing WL#3228 changes. ****
|
||||
--echo *** Create "wider" table on slave ***
|
||||
sync_slave_with_master;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a float (47),
|
||||
b double (143,9),
|
||||
c decimal (65,30),
|
||||
d numeric (4,0),
|
||||
e bit (32),
|
||||
f char (21),
|
||||
g varchar (1300),
|
||||
h binary (33),
|
||||
j varbinary (200),
|
||||
k enum ('5','6','7', '8','9','0'),
|
||||
l set ('1','2','3','4','5','6','7','8','9','0','11','12','13','14','15','16','17','18','19','21','22','23','24','25','26','27','28','29'),
|
||||
m TINYBLOB,
|
||||
n BLOB,
|
||||
o MEDIUMBLOB,
|
||||
p LONGBLOB,
|
||||
q TINYTEXT,
|
||||
r TEXT,
|
||||
s MEDIUMTEXT,
|
||||
t LONGTEXT
|
||||
);
|
||||
|
||||
--echo *** Create same table on master but with narrow columns ***
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (
|
||||
a float (44),
|
||||
b double (10,3),
|
||||
c decimal (10,2),
|
||||
d numeric (3,0),
|
||||
e bit (16),
|
||||
f char (10),
|
||||
g varchar (100),
|
||||
h binary (20),
|
||||
j varbinary (20),
|
||||
k enum ('5','6','7'),
|
||||
l set ('1','2','3','4','5','6','7','8','9','0'),
|
||||
m TINYBLOB,
|
||||
n BLOB,
|
||||
o MEDIUMBLOB,
|
||||
p LONGBLOB,
|
||||
q TINYTEXT,
|
||||
r TEXT,
|
||||
s MEDIUMTEXT,
|
||||
t LONGTEXT
|
||||
);
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start replication ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Insert data on master and display it. ***
|
||||
connection master;
|
||||
|
||||
INSERT INTO t1 () VALUES (
|
||||
17.567,
|
||||
2.123,
|
||||
10.20,
|
||||
125,
|
||||
hex(64),
|
||||
'TEST',
|
||||
'This is a test',
|
||||
'binary data',
|
||||
'more binary data',
|
||||
'6',
|
||||
'7',
|
||||
"blob 1",
|
||||
"blob 2",
|
||||
"blob 3",
|
||||
"blob 4",
|
||||
"text 1",
|
||||
"text 2",
|
||||
"text 3",
|
||||
"text 4");
|
||||
|
||||
# Replace values in columns that display differently between SBR & RBR
|
||||
--replace_column 5 # 8 #
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
--echo *** Select data from slave to compare ***
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
|
||||
# Replace values in columns that display differently between SBR & RBR
|
||||
--replace_column 5 # 8 #
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# Test boundary limits of varchar and char fields
|
||||
# Master/Slave
|
||||
# <256/<256 with m < s, m > s, and m == s <-- col a
|
||||
# >255/<256 with m < s, m > s, and m == s <-- error will be caught in BUG#22086
|
||||
# <256/>255 with m < s, m > s, and m == s <-- col b
|
||||
# >255/>255 with m < s, m > s, and m == s <-- col c
|
||||
#
|
||||
# Test boundary limits of CHAR fields
|
||||
# Master/Slave
|
||||
# <256/<256 with m < s, m > s, and m == s <-- col d
|
||||
# >255/<256 with m < s, m > s, and m == s <-- error char limited to 255 chars
|
||||
# <256/>255 with m < s, m > s, and m == s <-- error char limited to 255 chars
|
||||
# >255/>255 with m < s, m > s, and m == s <-- error char limited to 255 chars
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo Create varchar table on master
|
||||
CREATE TABLE t1 (
|
||||
a VARCHAR(50),
|
||||
b VARCHAR(100),
|
||||
c VARCHAR(300),
|
||||
d CHAR(5)
|
||||
);
|
||||
|
||||
sync_slave_with_master slave;
|
||||
|
||||
--echo Alter varchar table on slave
|
||||
ALTER TABLE t1 CHANGE COLUMN a a VARCHAR(100);
|
||||
ALTER TABLE t1 CHANGE COLUMN b b VARCHAR(400);
|
||||
ALTER TABLE t1 CHANGE COLUMN c c VARCHAR(500);
|
||||
ALTER TABLE t1 CHANGE COLUMN d d CHAR(100);
|
||||
|
||||
connection master;
|
||||
|
||||
--echo Insert some values and select them on master
|
||||
INSERT INTO t1 VALUES ("This is a test of col a.",
|
||||
"This is another test of col b.",
|
||||
"This is a test of the large col c.",
|
||||
"Col d");
|
||||
SELECT * FROM t1;
|
||||
--replace_result default DEFAULT
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
sync_slave_with_master slave;
|
||||
|
||||
--echo Insert some values and select them on slave
|
||||
SELECT * FROM t1;
|
||||
--replace_result default DEFAULT
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
|
||||
# Test boundary limits of bit fields
|
||||
# m < s, m % 8 != 0, and s % 8 == 0 col a
|
||||
# m < s, m % 8 == 0, and s % 8 != 0 col b
|
||||
# m < s, m % 8 != 0, and s % 8 != 0 col c
|
||||
# m > s, m % 8 != 0, and s % 8 == 0 <-- error will be caught in BUG#22086
|
||||
# m > s, m % 8 == 0, and s % 8 != 0 <-- error will be caught in BUG#22086
|
||||
# m > s, m % 8 != 0, and s % 8 != 0 <-- error will be caught in BUG#22086
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo Create bit table on master
|
||||
CREATE TABLE t1 (
|
||||
a BIT(7),
|
||||
b BIT(8),
|
||||
c BIT(21),
|
||||
d BIT(11),
|
||||
e BIT(11)
|
||||
);
|
||||
|
||||
sync_slave_with_master slave;
|
||||
|
||||
--echo Create bit table on slave
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a BIT(16),
|
||||
b BIT(22),
|
||||
c BIT(54),
|
||||
d BIT(25),
|
||||
e BIT(13)
|
||||
);
|
||||
|
||||
connection master;
|
||||
|
||||
--echo Insert some values and select them on master
|
||||
INSERT INTO t1 VALUES (
|
||||
b'1010101',
|
||||
b'10101011',
|
||||
b'101010110101010101111',
|
||||
b'10101010101',
|
||||
b'10101011111'
|
||||
);
|
||||
|
||||
SELECT BIN(a), BIN(b), BIN(c), BIN(d), BIN(e) FROM t1;
|
||||
--replace_result default DEFAULT
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
sync_slave_with_master slave;
|
||||
|
||||
--echo Insert some values and select them on master
|
||||
SELECT BIN(a), BIN(b), BIN(c), BIN(d), BIN(e) FROM t1;
|
||||
--replace_result default DEFAULT
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo *** Cleanup ***
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# END 5.1 Test Case
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,6 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/master-slave.inc
|
||||
let $engine_type=innodb;
|
||||
-- source extra/rpl_tests/rpl_commit_after_flush.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,148 @@
|
||||
###############################################################################
|
||||
#BUG#44581 Slave stops when transaction with non-transactional table gets
|
||||
#lock wait timeout
|
||||
#
|
||||
# In STMT and MIXED modes, a statement that changes both non-transactional and
|
||||
# transactional tables must be written to the binary log whenever there are
|
||||
# changes to non-transactional tables. This means that the statement gets into
|
||||
# the # binary log even when the changes to the transactional tables fail. In
|
||||
# particular, in the presence of a failure such statement is annotated with the
|
||||
# error number and wrapped in a begin/rollback. On the slave, while applying
|
||||
# the statement, it is expected the same failure and the rollback prevents the
|
||||
# transactional changes to be persisted.
|
||||
|
||||
# This test aims to verify if a statement that updates both transactional and
|
||||
# non-transacitonal tables and fails due to concurrency problems is correctly
|
||||
# processed by the slave in the sense that the statements get into the binary
|
||||
# log, the error is ignored and only the non-transactional tables are changed.
|
||||
###############################################################################
|
||||
|
||||
--source include/master-slave.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_statement.inc
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Environment
|
||||
--echo ########################################################################
|
||||
connection master;
|
||||
|
||||
CREATE TABLE t (i INT, PRIMARY KEY(i), f CHAR(8)) engine = Innodb;
|
||||
CREATE TABLE n (d DATETIME, f CHAR(32)) engine = MyIsam;
|
||||
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER tr AFTER UPDATE ON t FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO n VALUES ( now(), concat( 'updated t: ', old.f, ' -> ', new.f ) );
|
||||
END |
|
||||
DELIMITER ;|
|
||||
|
||||
INSERT INTO t VALUES (4,'black'), (2,'red'), (3,'yelow'), (1,'cyan');
|
||||
|
||||
connect (conn1, 127.0.0.1,root,,);
|
||||
connect (conn2, 127.0.0.1,root,,);
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Testing ER_LOCK_WAIT_TIMEOUT
|
||||
--echo ########################################################################
|
||||
|
||||
let $type=2;
|
||||
|
||||
while ($type)
|
||||
{
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
connection conn1;
|
||||
if (`select $type = 2`)
|
||||
{
|
||||
SET AUTOCOMMIT = 1;
|
||||
BEGIN;
|
||||
}
|
||||
if (`select $type = 1`)
|
||||
{
|
||||
SET AUTOCOMMIT = 0;
|
||||
}
|
||||
eval UPDATE t SET f = 'yellow $type' WHERE i = 3;
|
||||
|
||||
connection conn2;
|
||||
if (`select $type = 2`)
|
||||
{
|
||||
SET AUTOCOMMIT = 1;
|
||||
BEGIN;
|
||||
}
|
||||
if (`select $type = 1`)
|
||||
{
|
||||
SET AUTOCOMMIT = 0;
|
||||
}
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
eval UPDATE t SET f = 'magenta $type' WHERE f = 'red';
|
||||
eval INSERT INTO t VALUES (5 + ($type * 10),"brown");
|
||||
INSERT INTO n VALUES (now(),"brown");
|
||||
|
||||
connection conn1;
|
||||
COMMIT;
|
||||
|
||||
connection conn2;
|
||||
ROLLBACK;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
connection conn1;
|
||||
if (`select $type = 2`)
|
||||
{
|
||||
SET AUTOCOMMIT = 1;
|
||||
BEGIN;
|
||||
}
|
||||
if (`select $type = 1`)
|
||||
{
|
||||
SET AUTOCOMMIT = 0;
|
||||
}
|
||||
eval UPDATE t SET f = 'gray $type' WHERE i = 3;
|
||||
|
||||
connection conn2;
|
||||
if (`select $type = 2`)
|
||||
{
|
||||
SET AUTOCOMMIT = 1;
|
||||
BEGIN;
|
||||
}
|
||||
if (`select $type = 1`)
|
||||
{
|
||||
SET AUTOCOMMIT = 0;
|
||||
}
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
eval UPDATE t SET f = 'dark blue $type' WHERE f = 'red';
|
||||
eval INSERT INTO t VALUES (6 + ($type * 10),"brown");
|
||||
INSERT INTO n VALUES (now(),"brown");
|
||||
|
||||
connection conn1;
|
||||
COMMIT;
|
||||
|
||||
connection conn2;
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
dec $type;
|
||||
}
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
let $rpl_diff_statement= SELECT * FROM t order by i;
|
||||
source include/rpl_diff.inc;
|
||||
|
||||
let $rpl_diff_statement= SELECT * FROM n order by d, f;
|
||||
source include/rpl_diff.inc;
|
||||
|
||||
--echo ########################################################################
|
||||
--echo # Cleanup
|
||||
--echo ########################################################################
|
||||
|
||||
connection master;
|
||||
DROP TRIGGER tr;
|
||||
DROP TABLE t;
|
||||
DROP TABLE n;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
disconnect conn1;
|
||||
disconnect conn2;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,74 @@
|
||||
###############################################################################
|
||||
# After the patch for BUG#49124:
|
||||
# - Use ' ' instead of '!' in the conditional comments which are not applied on
|
||||
# master. So they become common comments and will not be applied on slave.
|
||||
#
|
||||
# - Example:
|
||||
# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
|
||||
# will be binlogged as
|
||||
# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'.
|
||||
###############################################################################
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_statement.inc;
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
--echo # Case 1:
|
||||
--echo # ------------------------------------------------------------------
|
||||
--echo # In a statement, some CCs are applied while others are not. The CCs
|
||||
--echo # which are not applied on master will be binlogged as common comments.
|
||||
|
||||
/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
sync_slave_with_master;
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo
|
||||
--echo # Case 2:
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # Verify whether it can be binlogged correctly when executing prepared
|
||||
--echo # statement.
|
||||
--connection master
|
||||
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
|
||||
EXECUTE stmt;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
EXECUTE stmt;
|
||||
|
||||
sync_slave_with_master;
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
--echo
|
||||
SET @value=62;
|
||||
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
|
||||
EXECUTE stmt USING @value;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
EXECUTE stmt USING @value;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
sync_slave_with_master;
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo
|
||||
--echo # Case 3:
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # Verify it can restore the '!', if the it is an uncomplete conditional
|
||||
--echo # comments
|
||||
--connection master
|
||||
--error 1064
|
||||
SELECT c1 FROM /*!99999 t1 WHEREN;
|
||||
|
||||
DROP TABLE t1;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Tests for replication of statements that manipulate databases.
|
||||
#
|
||||
# For this test file, we have a number of databases. All databases
|
||||
# with "greek" names will be replicated on the slave, while other names
|
||||
# (e.g., american) will not be replicated.
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
# Bug#6391 (binlog-do-db rules ignored)
|
||||
# In this case, 'mysqltest_bob' should not be replicated to the slave.
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest_prometheus;
|
||||
DROP DATABASE IF EXISTS mysqltest_sisyfos;
|
||||
DROP DATABASE IF EXISTS mysqltest_bob;
|
||||
sync_slave_with_master;
|
||||
# This database is not replicated
|
||||
DROP DATABASE IF EXISTS mysqltest_bob;
|
||||
--enable_warnings
|
||||
|
||||
connection master;
|
||||
CREATE DATABASE mysqltest_prometheus;
|
||||
CREATE DATABASE mysqltest_sisyfos;
|
||||
CREATE DATABASE mysqltest_bob;
|
||||
|
||||
USE mysqltest_sisyfos;
|
||||
# These should be replicated
|
||||
CREATE TABLE t1 (b int);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
USE mysqltest_bob;
|
||||
# These should *not* be replicated
|
||||
CREATE TABLE t2 (b int);
|
||||
INSERT INTO t2 VALUES(2);
|
||||
|
||||
# Current database is now 'mysqltest_bob'
|
||||
# The following should be replicated
|
||||
ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
|
||||
|
||||
USE mysqltest_sisyfos;
|
||||
# The following should *not* be replicated
|
||||
ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
|
||||
|
||||
SHOW DATABASES LIKE 'mysql%';
|
||||
sync_slave_with_master;
|
||||
SHOW DATABASES LIKE 'mysql%';
|
||||
|
||||
connection master;
|
||||
DROP DATABASE IF EXISTS mysqltest_sisyfos;
|
||||
USE mysqltest_prometheus;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
CREATE DATABASE mysqltest_sisyfos;
|
||||
USE mysqltest_sisyfos;
|
||||
CREATE TABLE t2 (a INT);
|
||||
let $VERSION=`select version()`;
|
||||
SHOW DATABASES LIKE 'mysql%';
|
||||
sync_slave_with_master;
|
||||
SHOW DATABASES LIKE 'mysql%';
|
||||
USE mysqltest_prometheus;
|
||||
SHOW TABLES;
|
||||
USE mysqltest_sisyfos;
|
||||
SHOW TABLES;
|
||||
|
||||
connection master;
|
||||
DROP DATABASE IF EXISTS mysqltest_prometheus;
|
||||
DROP DATABASE IF EXISTS mysqltest_sisyfos;
|
||||
DROP DATABASE IF EXISTS mysqltest_bob;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,150 @@
|
||||
# BUG#45574:
|
||||
# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists.
|
||||
#
|
||||
# There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
|
||||
# CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
|
||||
# binlogged even if either the DB, TABLE or EVENT does not exist. In
|
||||
# contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
|
||||
# exists.
|
||||
#
|
||||
# This problem caused some of the tests to fail randomly on PB or PB2.
|
||||
#
|
||||
# Description:
|
||||
# Fixed this bug by adding calls to write_bin_log in:
|
||||
# mysql_create_db
|
||||
# mysql_create_table_no_lock
|
||||
# mysql_create_like_table
|
||||
# create_table_from_items
|
||||
#
|
||||
# Test is implemented as follows:
|
||||
# i) test each "CREATE IF NOT EXISTS" (DDL), found in MySQL 5.1 manual
|
||||
# exclude CREATE TEMPORARY TABLE, on existent objects;
|
||||
#
|
||||
# Note:
|
||||
# rpl_create_tmp_table_if_not_exists.test tests CREATE TEMPORARY TABLE cases.
|
||||
#
|
||||
# References:
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
disable_warnings;
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE IF NOT EXISTS t(c1 int);
|
||||
CREATE TABLE IF NOT EXISTS t1 LIKE t;
|
||||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
|
||||
CREATE EVENT IF NOT EXISTS e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO SELECT now();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
#DROP database from slave.
|
||||
#The database and all tables can be recreated in slave
|
||||
#if binlog of the second CREATE command is recorded and sent from master to slave.
|
||||
DROP DATABASE mysqltest;
|
||||
|
||||
connection master;
|
||||
CREATE DATABASE IF NOT EXISTS mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE IF NOT EXISTS t(c1 int);
|
||||
CREATE TABLE IF NOT EXISTS t1 LIKE t;
|
||||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
|
||||
CREATE EVENT IF NOT EXISTS e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO SELECT now();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
SHOW TABLES in mysqltest;
|
||||
#Execution time changes in each run. So we disregard it by calling replace_column.
|
||||
replace_column 6 #;
|
||||
SHOW EVENTS in mysqltest;
|
||||
|
||||
|
||||
connection master;
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
|
||||
#
|
||||
# BUG#47418 RBR fails, failure with mixup of base/temporary/view TABLE DDL
|
||||
#
|
||||
# Before the patch for this bug, 'CREATE TABLE IF NOT EXIST ... SELECT'
|
||||
# statement was binlogged as a TEMPORARY table if the object existed as
|
||||
# a temporary table. This was caused by that the temporary table was opened
|
||||
# and the results of the 'SELECT' was inserted into the temporary table if
|
||||
# a temporary table existed with the same name.
|
||||
#
|
||||
# After the patch for this bug, the base table is created and the results of
|
||||
# the 'SELECT' are inserted into it, even though a temporary table exists with
|
||||
# the same name, and the statement is still binlogged as a base table.
|
||||
#
|
||||
|
||||
echo -------------BUG#47418-------------;
|
||||
connection master;
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
CREATE TABLE t3(c1 INTEGER);
|
||||
INSERT INTO t3 VALUES(33);
|
||||
|
||||
CREATE TEMPORARY TABLE t1(c1 INTEGER);
|
||||
CREATE TEMPORARY TABLE t2(c1 INTEGER);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t2 VALUES(1);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS t1(c1 INTEGER) SELECT c1 FROM t3;
|
||||
CREATE TABLE t2(c1 INTEGER) SELECT c1 FROM t3;
|
||||
|
||||
# In these two statements, t1 and t2 are the temporary table. there is only
|
||||
# value '1' in them. The records of t2 are not inserted into them.
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
# In these two statements, t1 and t2 are the base table. The recoreds of t2
|
||||
# are inserted into it when CREATE TABLE ... SELECT was executed.
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
DROP TEMPORARY TABLE t2;
|
||||
#In these two statements, t1 and t2 are the base table.
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo
|
||||
--echo # Bug#55616 Killing thread or query during CREATE IF NOT EXISTS makes
|
||||
--echo # slave SQL thread abort
|
||||
--echo
|
||||
|
||||
--connection master1
|
||||
let $con_id = `SELECT CONNECTION_ID()`;
|
||||
|
||||
CREATE TABLE t1 ( i INT );
|
||||
send CREATE TABLE IF NOT EXISTS t1
|
||||
AS SELECT SLEEP(3);
|
||||
|
||||
connection master;
|
||||
let $wait_timeout = 3;
|
||||
let $show_statement = SHOW PROCESSLIST;
|
||||
let $field = State;
|
||||
let $condition = = 'User sleep';
|
||||
source include/wait_show_condition.inc;
|
||||
|
||||
--replace_result $con_id master1
|
||||
eval KILL QUERY $con_id;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,41 @@
|
||||
# BUG#45574:
|
||||
# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists.
|
||||
#
|
||||
# There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
|
||||
# CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
|
||||
# binlogged even if either the DB, TABLE or EVENT does not exist. In
|
||||
# contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
|
||||
# exists.
|
||||
#
|
||||
# This problem caused some of the tests to fail randomly on PB or PB2.
|
||||
#
|
||||
# Test is implemented as follows:
|
||||
#
|
||||
# i) test each "CREATE TEMPORARY TABLE IF EXISTS" (DDL), found in MySQL
|
||||
# 5.1 manual, on existent objects;
|
||||
# ii) show binlog events;
|
||||
#
|
||||
# Note:
|
||||
# rpl_create_if_not_exists.test tests other cases.
|
||||
#
|
||||
# References:
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
#CREATE TEMPORARY TABLE statements are not binlogged in row mode,
|
||||
#So it must be test by itself.
|
||||
source include/have_binlog_format_mixed_or_statement.inc;
|
||||
disable_warnings;
|
||||
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,66 @@
|
||||
# Test for BUG#26551
|
||||
#
|
||||
|
||||
# This test is unfortunately very fragile and very dependent on the
|
||||
# load of the computer. The test is therefore disabled normally. It is
|
||||
# entered here to demonstrate how to check that the bug is actually
|
||||
# solved.
|
||||
|
||||
--echo Turn on parsing to run this test
|
||||
|
||||
disable_parsing;
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t1 (data LONGBLOB) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (data LONGBLOB) ENGINE=MYISAM;
|
||||
|
||||
INSERT INTO t1 (data) VALUES (repeat('a',1024*1024));
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
send INSERT INTO t2 SELECT * FROM t1;
|
||||
|
||||
connection master1;
|
||||
|
||||
# This sleep is picked so that the query above has started to insert
|
||||
# some rows into t2. If it hasn't the slave will not stop below.
|
||||
let $wait_condition= SELECT COUNT(*) > 1000 FROM t1;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# SHOW PROCESSLIST;
|
||||
|
||||
# Code for the 5.1 server to get the thread id of the thread executing
|
||||
# the query above.
|
||||
#
|
||||
#SET @id = 0;
|
||||
#SELECT id INTO @id
|
||||
# FROM information_schema.processlist
|
||||
# WHERE info LIKE 'INSERT INTO t2%';
|
||||
|
||||
# This is the connection that is executing the INSERT INTO t2...
|
||||
KILL QUERY 2;
|
||||
|
||||
connection slave;
|
||||
|
||||
# Here the slave will only stop if the query above actually started
|
||||
# inserting some rows into t2. Otherwise, it will hang forever. ... and there
|
||||
# the error code should be 1317 (ER_QUERY_INTERRUPTED)
|
||||
--let $slave_sql_errno= 1317
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
# The following should be 0
|
||||
SELECT COUNT(*) FROM t2;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
enable_parsing;
|
||||
@@ -0,0 +1,47 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Verify cross-version replication from an old master to the up-to-date slave
|
||||
#
|
||||
# ==== Implementation ====
|
||||
#
|
||||
# Feed to the slave server a binlog recorded on an old version master
|
||||
# via setting up slave-to-slave replication. The latter is done by means of
|
||||
# the opt file and include/setup_fake_relay_log.inc.
|
||||
# The master's binlog is treated as a relay log that the SQL thread executes.
|
||||
#
|
||||
|
||||
--source include/master-slave.inc
|
||||
|
||||
# The test is disabled for windows due to
|
||||
# Bug #42879 CHANGE MASTER RELAY_LOG_FILE=path fails on windows
|
||||
# Todo: release it from not_windows
|
||||
--source include/not_windows.inc
|
||||
|
||||
#
|
||||
# Bug#31240 load data infile replication between (4.0 or 4.1) and 5.1 fails
|
||||
#
|
||||
|
||||
--echo ==== Initialize ====
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
RESET SLAVE;
|
||||
|
||||
# the relay log contains create t1, t3 tables and load data infile
|
||||
--let $fake_relay_log = $MYSQL_TEST_DIR/suite/binlog/std_data/binlog_old_version_4_1.000001
|
||||
--source include/setup_fake_relay_log.inc
|
||||
|
||||
--echo ==== Test ====
|
||||
start slave sql_thread;
|
||||
--let $slave_param = Exec_Master_Log_Pos
|
||||
# end_log_pos of the last event of the relay log
|
||||
--let $slave_param_value = 149436
|
||||
--source include/wait_for_slave_param.inc
|
||||
--echo ==== a prove that the fake has been processed successfully ====
|
||||
SELECT COUNT(*) - 17920 as zero FROM t3;
|
||||
|
||||
--echo ==== Clean up ====
|
||||
--source include/stop_slave_sql.inc
|
||||
--source include/cleanup_fake_relay_log.inc
|
||||
drop table t1, t3;
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,8 @@
|
||||
!include ../my.cnf
|
||||
|
||||
[mysqld.3]
|
||||
log-slave-updates
|
||||
|
||||
[ENV]
|
||||
SERVER_MYPORT_3= @mysqld.3.port
|
||||
SERVER_MYSOCK_3= @mysqld.3.socket
|
||||
229
build/lib/mysql/mysql-test/suite/rpl/t/rpl_current_user.test
Normal file
229
build/lib/mysql/mysql-test/suite/rpl/t/rpl_current_user.test
Normal file
@@ -0,0 +1,229 @@
|
||||
##############################################################################
|
||||
# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER,
|
||||
# REVOKE, GRANT, ALTER EVENT
|
||||
#
|
||||
# Calling CURRENT_USER() results into inconsistency between slave and master,
|
||||
# as the slave SQL thread has different user with common users.
|
||||
#
|
||||
# After the patch for bug#48321, session's user will be written into query log
|
||||
# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT',
|
||||
# 'ALTER EVENT'.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
source include/have_binlog_format_statement.inc;
|
||||
|
||||
--let $rpl_topology= 1->2->3
|
||||
--source include/rpl_init.inc
|
||||
|
||||
--let $rpl_connection_name= master
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_connect.inc
|
||||
|
||||
--let $rpl_connection_name= slave
|
||||
--let $rpl_server_number= 2
|
||||
--source include/rpl_connect.inc
|
||||
|
||||
--connection master
|
||||
|
||||
CREATE TABLE t1(c1 char(100));
|
||||
CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
|
||||
CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
|
||||
CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
|
||||
CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
|
||||
CREATE PROCEDURE p1() SELECT 1;
|
||||
--echo # bug48321_1-01234 has the max length(16) of user.
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
|
||||
|
||||
--echo
|
||||
--echo # Make sure the max lengths of user and host
|
||||
--echo # the user name is too lengh
|
||||
--error 1470
|
||||
GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost';
|
||||
--echo # the host name is too lengh
|
||||
--error 1470
|
||||
GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
|
||||
|
||||
--echo
|
||||
--echo # User 'bug48321_1-01234' connects to master by conn1
|
||||
connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,);
|
||||
connection conn1;
|
||||
--echo # [On conn1]
|
||||
--echo # Verify 'REVOKE ALL' statement
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'GRANT ... ON TABLE ...' statement
|
||||
GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'GRANT ... ON PROCEDURE...' statement
|
||||
GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'GRANT ... ON *.* ...' statement
|
||||
GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'REVOKE ... ON TABLE ...' statement
|
||||
REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'REVOKE ... ON PROCEDURE...' statement
|
||||
REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_procs_priv, server_2:v_procs_priv, server_3:v_procs_priv;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'REVOKE ... ON *.* ...' statement
|
||||
REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'GRANT ...' statement in the procedure
|
||||
CREATE PROCEDURE my_grant()
|
||||
GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
|
||||
call my_grant;
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure
|
||||
CREATE PROCEDURE my_revoke()
|
||||
REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
|
||||
call my_revoke;
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_tables_priv, server_2:v_tables_priv, server_3:v_tables_priv;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'RENAME USER ...' statement
|
||||
RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
disconnect conn1;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'DROP USER ...' statement
|
||||
connection master;
|
||||
GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
|
||||
connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,);
|
||||
connection conn1;
|
||||
DROP USER CURRENT_USER();
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_user, server_2:v_user, server_3:v_user;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify 'ALTER EVENT...' statement
|
||||
connection master;
|
||||
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
|
||||
|
||||
--echo # Explicitly assign CURRENT_USER() to definer
|
||||
ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_event, server_2:v_event, server_3:v_event;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Session user will be set as definer, if the statement does not assign
|
||||
--echo # a definer
|
||||
ALTER EVENT e1 ENABLE;
|
||||
--source include/rpl_sync.inc
|
||||
let $diff_tables= server_1:v_event, server_2:v_event, server_3:v_event;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Verify that this patch does not affect the calling of CURRENT_USER()
|
||||
--echo # in the other statements
|
||||
connection master;
|
||||
--echo # [On master]
|
||||
INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
--echo # [On slave]
|
||||
SELECT * FROM t1;
|
||||
--echo # [On server_3]
|
||||
sync_slave_with_master server_3;
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
--echo # [On master]
|
||||
UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
--echo # [On slave]
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master server_3;
|
||||
--echo # [On server_3]
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
--echo # [On master]
|
||||
DELETE FROM t1 WHERE c1=CURRENT_USER();
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
--echo # [On slave]
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master server_3;
|
||||
--echo # [On server_3]
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
--echo # [On master]
|
||||
CREATE TABLE t2(c1 char(100));
|
||||
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION my_user() RETURNS VARCHAR(64)
|
||||
SQL SECURITY INVOKER
|
||||
BEGIN
|
||||
INSERT INTO t2 VALUES(CURRENT_USER());
|
||||
RETURN CURRENT_USER();
|
||||
END |
|
||||
DELIMITER ;|
|
||||
|
||||
INSERT INTO t1 VALUES(my_user());
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
sync_slave_with_master;
|
||||
--echo # [On slave]
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
sync_slave_with_master server_3;
|
||||
--echo # [On server_3]
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
--echo
|
||||
--echo # END
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE my_grant;
|
||||
DROP PROCEDURE my_revoke;
|
||||
DROP FUNCTION my_user;
|
||||
DROP EVENT e1;
|
||||
--source include/rpl_end.inc
|
||||
|
||||
33
build/lib/mysql/mysql-test/suite/rpl/t/rpl_ddl.test
Normal file
33
build/lib/mysql/mysql-test/suite/rpl/t/rpl_ddl.test
Normal file
@@ -0,0 +1,33 @@
|
||||
######################## 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..
|
||||
#
|
||||
--source include/not_ndb_default.inc
|
||||
--source include/master-slave.inc
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
let $temp_engine_type= MEMORY;
|
||||
let $show_binlog = 0;
|
||||
let $manipulate = 0;
|
||||
-- source extra/rpl_tests/rpl_ddl.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,4 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
let $engine_type=innodb;
|
||||
-- source extra/rpl_tests/rpl_deadlock.test
|
||||
@@ -0,0 +1,8 @@
|
||||
###################################################
|
||||
# By JBM 2006-02-14 added to skip test when NDB #
|
||||
##################################################
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/master-slave.inc
|
||||
let $engine_type=myisam;
|
||||
-- source extra/rpl_tests/rpl_delete_no_where.test
|
||||
--source include/rpl_end.inc
|
||||
375
build/lib/mysql/mysql-test/suite/rpl/t/rpl_do_grant.test
Normal file
375
build/lib/mysql/mysql-test/suite/rpl/t/rpl_do_grant.test
Normal file
@@ -0,0 +1,375 @@
|
||||
# Works in statement-based and row-based binlogging.
|
||||
# Test that GRANT and other user management commands are replicated to the slave
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# do not be influenced by other tests.
|
||||
connection master;
|
||||
delete from mysql.user where user=_binary'rpl_do_grant';
|
||||
delete from mysql.db where user=_binary'rpl_do_grant';
|
||||
flush privileges;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# if these DELETE did nothing on the master, we need to do them manually on the
|
||||
# slave.
|
||||
delete from mysql.user where user=_binary'rpl_ignore_grant';
|
||||
delete from mysql.db where user=_binary'rpl_ignore_grant';
|
||||
flush privileges;
|
||||
|
||||
# test replication of GRANT
|
||||
connection master;
|
||||
grant select on *.* to rpl_do_grant@localhost;
|
||||
grant drop on test.* to rpl_do_grant@localhost;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
show grants for rpl_do_grant@localhost;
|
||||
|
||||
# test replication of SET PASSWORD
|
||||
connection master;
|
||||
set password for rpl_do_grant@localhost=password("does it work?");
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
|
||||
|
||||
#
|
||||
# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
|
||||
#
|
||||
connection master;
|
||||
update mysql.user set password='' where user='rpl_do_grant';
|
||||
flush privileges;
|
||||
select password<>'' from mysql.user where user='rpl_do_grant';
|
||||
set sql_mode='ANSI_QUOTES';
|
||||
set password for rpl_do_grant@localhost=password('does it work?');
|
||||
set sql_mode='';
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select password<>'' from mysql.user where user='rpl_do_grant';
|
||||
|
||||
|
||||
# clear what we have done, to not influence other tests.
|
||||
connection master;
|
||||
delete from mysql.user where user=_binary'rpl_do_grant';
|
||||
delete from mysql.db where user=_binary'rpl_do_grant';
|
||||
flush privileges;
|
||||
sync_slave_with_master;
|
||||
# The mysql database is not replicated, so we have to do the deletes
|
||||
# manually on the slave as well.
|
||||
delete from mysql.user where user=_binary'rpl_do_grant';
|
||||
delete from mysql.db where user=_binary'rpl_do_grant';
|
||||
flush privileges;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
connection master;
|
||||
--error 1141
|
||||
show grants for rpl_do_grant@localhost;
|
||||
connection slave;
|
||||
--error 1141
|
||||
show grants for rpl_do_grant@localhost;
|
||||
|
||||
connection master;
|
||||
create user rpl_do_grant@localhost;
|
||||
show grants for rpl_do_grant@localhost;
|
||||
--error 1141
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
sync_slave_with_master;
|
||||
show grants for rpl_do_grant@localhost;
|
||||
--error 1141
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
|
||||
connection master;
|
||||
rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
sync_slave_with_master;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
|
||||
connection master;
|
||||
grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
sync_slave_with_master;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
|
||||
connection master;
|
||||
revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
sync_slave_with_master;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
|
||||
connection master;
|
||||
revoke all privileges, grant option from rpl_do_grant2@localhost;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
sync_slave_with_master;
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
|
||||
connection master;
|
||||
drop user rpl_do_grant2@localhost;
|
||||
--error 1141
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
sync_slave_with_master;
|
||||
--error 1141
|
||||
show grants for rpl_do_grant2@localhost;
|
||||
|
||||
#####################################################
|
||||
# Purpose
|
||||
# Test whether mysql.procs_priv get replicated
|
||||
# Related bugs:
|
||||
# BUG42217 mysql.procs_priv does not get replicated
|
||||
#####################################################
|
||||
connection master;
|
||||
call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS bug42217_db;
|
||||
--enable_warnings
|
||||
CREATE DATABASE bug42217_db;
|
||||
|
||||
GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
|
||||
IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION;
|
||||
|
||||
-- sync_slave_with_master
|
||||
-- connection master
|
||||
|
||||
connect (create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,);
|
||||
connect (create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,);
|
||||
|
||||
connection create_rout_db_master;
|
||||
|
||||
|
||||
USE bug42217_db;
|
||||
|
||||
DELIMITER //;
|
||||
CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30)
|
||||
BEGIN
|
||||
RETURN "INSIDE upgrade_del_func()";
|
||||
END//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
connection master;
|
||||
|
||||
USE bug42217_db;
|
||||
--replace_column 8 #
|
||||
SELECT * FROM mysql.procs_priv;
|
||||
SELECT upgrade_del_func();
|
||||
|
||||
sync_slave_with_master;
|
||||
--replace_column 8 #
|
||||
SELECT * FROM mysql.procs_priv;
|
||||
SHOW GRANTS FOR 'create_rout_db'@'localhost';
|
||||
|
||||
USE bug42217_db;
|
||||
SHOW CREATE FUNCTION upgrade_del_func;
|
||||
SELECT upgrade_del_func();
|
||||
|
||||
--echo "Check whether the definer user will be able to execute the replicated routine on slave"
|
||||
connection create_rout_db_slave;
|
||||
USE bug42217_db;
|
||||
SHOW CREATE FUNCTION upgrade_del_func;
|
||||
SELECT upgrade_del_func();
|
||||
|
||||
connection slave;
|
||||
DELETE FROM mysql.procs_priv;
|
||||
FLUSH PRIVILEGES;
|
||||
USE bug42217_db;
|
||||
--echo "Can't execute the replicated routine on slave like before after procs privilege is deleted "
|
||||
--error 1370
|
||||
SELECT upgrade_del_func();
|
||||
|
||||
--echo "Test the user who creates a function on master doesn't exist on slave."
|
||||
--echo "Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted"
|
||||
DROP USER 'create_rout_db'@'localhost';
|
||||
|
||||
connection create_rout_db_master;
|
||||
DELIMITER //;
|
||||
CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30)
|
||||
BEGIN
|
||||
RETURN "INSIDE upgrade_alter_func()";
|
||||
END//
|
||||
DELIMITER ;//
|
||||
|
||||
connection master;
|
||||
SELECT upgrade_alter_func();
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE FUNCTION upgrade_alter_func;
|
||||
--echo "Should no privilege record for upgrade_alter_func in mysql.procs_priv"
|
||||
--replace_column 8 #
|
||||
SELECT * FROM mysql.procs_priv;
|
||||
--error 1449
|
||||
SELECT upgrade_alter_func();
|
||||
|
||||
###### CLEAN UP SECTION ##############
|
||||
disconnect create_rout_db_master;
|
||||
disconnect create_rout_db_slave;
|
||||
connection master;
|
||||
USE bug42217_db;
|
||||
DROP FUNCTION upgrade_del_func;
|
||||
DROP FUNCTION upgrade_alter_func;
|
||||
DROP DATABASE bug42217_db;
|
||||
-- sync_slave_with_master
|
||||
-- connection master
|
||||
|
||||
# user was already dropped in the slave before
|
||||
# so we should not replicate this statement.
|
||||
SET SQL_LOG_BIN= 0;
|
||||
DROP USER 'create_rout_db'@'localhost';
|
||||
SET SQL_LOG_BIN= 1;
|
||||
|
||||
# finish entire clean up (remove binlogs)
|
||||
# so that we leave a pristine environment for the
|
||||
# following tests
|
||||
--let $rpl_only_running_threads= 1
|
||||
-- source include/rpl_reset.inc
|
||||
USE test;
|
||||
|
||||
# BUG#49119: Master crashes when executing 'REVOKE ... ON
|
||||
# {PROCEDURE|FUNCTION} FROM ...'
|
||||
#
|
||||
# The tests are divided into two test cases:
|
||||
#
|
||||
# i) a test case that mimics the one in the bug report.
|
||||
#
|
||||
# - We show that, despite the fact, that a revoke command fails
|
||||
# when binlogging is active, the master will not hit an
|
||||
# assertion.
|
||||
#
|
||||
# ii) a test case that partially succeeds on the master will also
|
||||
# partially succeed on the slave.
|
||||
#
|
||||
# - The revoke statement that partially succeeds tries to revoke
|
||||
# an EXECUTE grant for two users, and only one of the user has
|
||||
# the specific grant. This will cause mysql to drop one of the
|
||||
# grants and report error for the statement. The slave should
|
||||
# also drop the grants that the master succeed and the SQL
|
||||
# thread should not stop on statement failure.
|
||||
|
||||
-- echo ######## BUG#49119 #######
|
||||
-- echo ### i) test case from the 'how to repeat section'
|
||||
|
||||
-- connection master
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE p1() SELECT * FROM t1 |
|
||||
DELIMITER ;|
|
||||
-- error ER_NONEXISTING_PROC_GRANT
|
||||
REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost';
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo ### ii) Test case in which REVOKE partially succeeds
|
||||
|
||||
-- connection master
|
||||
-- source include/rpl_reset.inc
|
||||
-- connection master
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE p1() SELECT * FROM t1 |
|
||||
DELIMITER ;|
|
||||
|
||||
CREATE USER 'user49119'@'localhost';
|
||||
GRANT EXECUTE ON PROCEDURE p1 TO 'user49119'@'localhost';
|
||||
|
||||
-- echo ##############################################################
|
||||
-- echo ### Showing grants for both users: root and user49119 (master)
|
||||
SHOW GRANTS FOR 'user49119'@'localhost';
|
||||
SHOW GRANTS FOR CURRENT_USER;
|
||||
-- echo ##############################################################
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo ##############################################################
|
||||
-- echo ### Showing grants for both users: root and user49119 (master)
|
||||
SHOW GRANTS FOR 'user49119'@'localhost';
|
||||
SHOW GRANTS FOR CURRENT_USER;
|
||||
-- echo ##############################################################
|
||||
|
||||
-- connection master
|
||||
|
||||
-- echo ## This statement will make the revoke fail because root has no
|
||||
-- echo ## execute grant. However, it will still revoke the grant for
|
||||
-- echo ## user49119.
|
||||
-- error ER_NONEXISTING_PROC_GRANT
|
||||
REVOKE EXECUTE ON PROCEDURE p1 FROM 'user49119'@'localhost', 'root'@'localhost';
|
||||
|
||||
-- echo ##############################################################
|
||||
-- echo ### Showing grants for both users: root and user49119 (master)
|
||||
-- echo ### after revoke statement failure
|
||||
SHOW GRANTS FOR 'user49119'@'localhost';
|
||||
SHOW GRANTS FOR CURRENT_USER;
|
||||
-- echo ##############################################################
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo #############################################################
|
||||
-- echo ### Showing grants for both users: root and user49119 (slave)
|
||||
-- echo ### after revoke statement failure (should match
|
||||
SHOW GRANTS FOR 'user49119'@'localhost';
|
||||
SHOW GRANTS FOR CURRENT_USER;
|
||||
-- echo ##############################################################
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP USER 'user49119'@'localhost';
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
#
|
||||
# Bug #51987 revoke privileges logs wrong error code
|
||||
#
|
||||
|
||||
-- source include/rpl_reset.inc
|
||||
-- connection master
|
||||
|
||||
grant all on *.* to foo@"1.2.3.4";
|
||||
-- error ER_REVOKE_GRANTS
|
||||
revoke all privileges, grant option from "foo";
|
||||
|
||||
## assertion: revoke is logged
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
## assertion: slave replicates revoke and does not fail because master
|
||||
## logged revoke with correct expected error code
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
-- connection master
|
||||
DROP USER foo@"1.2.3.4";
|
||||
-- sync_slave_with_master
|
||||
|
||||
--echo
|
||||
--echo # Bug#27606 GRANT statement should be replicated with DEFINER information
|
||||
--source include/rpl_reset.inc
|
||||
--connection master
|
||||
GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
|
||||
|
||||
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
|
||||
sync_slave_with_master;
|
||||
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
|
||||
|
||||
--connection master
|
||||
REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
|
||||
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
|
||||
sync_slave_with_master;
|
||||
SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
|
||||
|
||||
--connection master
|
||||
DROP USER user_bug27606@localhost;
|
||||
|
||||
--echo "End of test"
|
||||
--source include/rpl_end.inc
|
||||
66
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop.test
Normal file
66
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop.test
Normal file
@@ -0,0 +1,66 @@
|
||||
# Testcase for BUG#4552 (DROP on two tables, one of which does not
|
||||
# exist, must be binlogged with a non-zero error code)
|
||||
source include/master-slave.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
create table t1 (a int);
|
||||
--error 1051
|
||||
drop table t1, t2;
|
||||
--sync_slave_with_master
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
# BUG#55625 RBR breaks on failing 'CREATE TABLE'
|
||||
# A CREATE...SELECT that fails is written to the binary log if a non-transactional
|
||||
# statement is updated. If the logging format is ROW, the CREATE statement and the
|
||||
# changes are written to the binary log as distinct events and by consequence the
|
||||
# created table is not rolled back in the slave.
|
||||
# To fix the problem, we do not write a CREATE...SELECT that fails to the binary
|
||||
# log. Howerver, the changes to non-transactional tables are not replicated and
|
||||
# thus the slave goes out of sync. This should be fixed after BUG#47899.
|
||||
#
|
||||
# In the test case, we verify if the binary log contains no information for a
|
||||
# CREATE...SELECT that fails.
|
||||
connection slave;
|
||||
|
||||
--source include/stop_slave.inc
|
||||
SET @old_binlog_format= @@global.binlog_format;
|
||||
SET GLOBAL binlog_format = ROW;
|
||||
--source include/start_slave.inc
|
||||
|
||||
connection master;
|
||||
SET @old_binlog_format= @@global.binlog_format;
|
||||
SET binlog_format = ROW;
|
||||
|
||||
CREATE TABLE t2(a INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t3(a INT) ENGINE=INNODB;
|
||||
|
||||
delimiter |;
|
||||
CREATE FUNCTION f1() RETURNS INT
|
||||
BEGIN
|
||||
insert into t2 values(1);
|
||||
insert into t3 values(1);
|
||||
return 1;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1);
|
||||
|
||||
--error 1062
|
||||
CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1();
|
||||
--error 1062
|
||||
CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1();
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t2, t3;
|
||||
SET @@global.binlog_format= @old_binlog_format;
|
||||
|
||||
--sync_slave_with_master
|
||||
SET @@global.binlog_format= @old_binlog_format;
|
||||
|
||||
# End of 5.1 tests
|
||||
|
||||
--source include/rpl_end.inc
|
||||
62
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop_db.test
Normal file
62
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop_db.test
Normal file
@@ -0,0 +1,62 @@
|
||||
# test case for BUG#4680 -- if there are extra files in the db directory
|
||||
# dropping the db on the master causes replication problems
|
||||
|
||||
-- source include/master-slave.inc
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest1;
|
||||
--enable_warnings
|
||||
create database mysqltest1;
|
||||
create table mysqltest1.t1 (n int);
|
||||
insert into mysqltest1.t1 values (1);
|
||||
select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
|
||||
create table mysqltest1.t2 (n int);
|
||||
create table mysqltest1.t3 (n int);
|
||||
--replace_result \\ /
|
||||
--error 1010
|
||||
drop database mysqltest1;
|
||||
use mysqltest1;
|
||||
show tables;
|
||||
|
||||
# test the branch of the code that deals with the query buffer overflow
|
||||
|
||||
--disable_query_log
|
||||
let $1=50;
|
||||
while ($1)
|
||||
{
|
||||
eval create table mysqltest1.mysqltest_long_table_name$1 (n int);
|
||||
dec $1;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--replace_result \\ /
|
||||
--error 1010
|
||||
drop database mysqltest1;
|
||||
use mysqltest1;
|
||||
show tables;
|
||||
use test;
|
||||
create table t1 (n int);
|
||||
insert into t1 values (1234);
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
use mysqltest1;
|
||||
show tables;
|
||||
use test;
|
||||
select * from t1;
|
||||
|
||||
#cleanup
|
||||
connection master;
|
||||
|
||||
# Remove the "extra" file created above
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
remove_file $MYSQLD_DATADIR/mysqltest1/f1.txt;
|
||||
|
||||
use test;
|
||||
drop table t1;
|
||||
drop database mysqltest1;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
70
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop_temp.test
Normal file
70
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop_temp.test
Normal file
@@ -0,0 +1,70 @@
|
||||
##############################################
|
||||
# Change Author: JBM
|
||||
# Change Date: 2006-02-07
|
||||
# Change: Added ENGINE=MyISAM
|
||||
# Purpose: According to TU in 16552 This is how
|
||||
# to work around NDB's issue with temp tables
|
||||
##############################################
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_mixed_or_statement.inc;
|
||||
|
||||
--disable_warnings
|
||||
create database if not exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
connect (con_temp,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
|
||||
connection con_temp;
|
||||
use mysqltest;
|
||||
create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
|
||||
create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
|
||||
|
||||
disconnect con_temp;
|
||||
--source include/wait_until_disconnected.inc
|
||||
|
||||
connection master;
|
||||
-- let $wait_binlog_event= DROP
|
||||
-- source include/wait_for_binlog_event.inc
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
show status like 'Slave_open_temp_tables';
|
||||
# Cleanup
|
||||
connection master;
|
||||
drop database mysqltest;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#49137
|
||||
# This test verifies if DROP MULTI TEMPORARY TABLE
|
||||
# will cause different errors on master and slave,
|
||||
# when one or more of these tables do not exist.
|
||||
#
|
||||
|
||||
connection master;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp1;
|
||||
CREATE TEMPORARY TABLE t1 ( a int );
|
||||
--error 1051
|
||||
DROP TEMPORARY TABLE t1, t2;
|
||||
--error 1051
|
||||
DROP TEMPORARY TABLE tmp2;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
stop slave;
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
CREATE TEMPORARY TABLE tmp3 (a int);
|
||||
DROP TEMPORARY TABLE tmp3;
|
||||
|
||||
connection slave;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
37
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop_view.test
Normal file
37
build/lib/mysql/mysql-test/suite/rpl/t/rpl_drop_view.test
Normal file
@@ -0,0 +1,37 @@
|
||||
# test case for bug#30998
|
||||
# Drop View breaks replication if view does not exist
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
drop view if exists v1, v2, v3, not_exist_view;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
create table t2 (b int);
|
||||
create table t3 (c int);
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from t2;
|
||||
create view v3 as select * from t3;
|
||||
--error 1051
|
||||
drop view not_exist_view;
|
||||
--error 1051
|
||||
drop view v1, not_exist_view;
|
||||
--error 1146
|
||||
select * from v1;
|
||||
drop view v2, v3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
--error 1146
|
||||
select * from v1;
|
||||
--error 1146
|
||||
select * from v2;
|
||||
--error 1146
|
||||
select * from v3;
|
||||
|
||||
--echo ==== clean up ====
|
||||
connection master;
|
||||
drop table t1, t2, t3;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,97 @@
|
||||
# This test checks that in a dual-head setup
|
||||
# A->B->A, where A has --log-slave-updates (why would it?
|
||||
# assume that there is a C as slave of A),
|
||||
# then the Exec_master_log_pos of SHOW SLAVE STATUS does
|
||||
# not stay too low on B(BUG#13023 due to events ignored because
|
||||
# of their server id).
|
||||
# It also will test BUG#13861.
|
||||
|
||||
source include/have_innodb.inc;
|
||||
|
||||
--let $rpl_topology= 1->2->1
|
||||
--source include/rpl_init.inc
|
||||
|
||||
# now we test it
|
||||
|
||||
connection server_2;
|
||||
|
||||
create table t1 (n int);
|
||||
let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
let $master_log_pos_1= `SELECT $master_log_pos_1 + 3`;
|
||||
|
||||
--sync_slave_with_master server_1
|
||||
|
||||
#
|
||||
# BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
|
||||
# log-slave-updates and circul repl
|
||||
#
|
||||
source include/stop_slave.inc;
|
||||
|
||||
create table t2 (n int); # create one ignored event
|
||||
|
||||
--sync_slave_with_master server_2
|
||||
|
||||
show tables;
|
||||
|
||||
create table t3 (n int) engine=innodb;
|
||||
let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
let $master_log_pos_2= `SELECT $master_log_pos_2 + 5`;
|
||||
set @a=1;
|
||||
insert into t3 values(@a);
|
||||
let $master_log_pos_3= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
let $master_log_pos_3= `SELECT $master_log_pos_3 + 5`;
|
||||
begin;
|
||||
insert into t3 values(2);
|
||||
insert into t3 values(3);
|
||||
commit;
|
||||
insert into t3 values(4);
|
||||
|
||||
|
||||
connection server_1;
|
||||
|
||||
# bug is that START SLAVE UNTIL may stop too late, we test that by
|
||||
# asking it to stop before creation of t3.
|
||||
|
||||
--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS
|
||||
eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_1;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
|
||||
# then BUG#13861 causes t3 to show up below (because stopped too
|
||||
# late).
|
||||
|
||||
show tables;
|
||||
|
||||
# ensure that we do not break set @a=1; insert into t3 values(@a);
|
||||
--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS
|
||||
eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_2;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
select * from t3;
|
||||
|
||||
# ensure that we do not break transaction
|
||||
--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_3 MASTER_LOG_POS
|
||||
eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_3;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
select * from t3;
|
||||
|
||||
source include/start_slave.inc;
|
||||
|
||||
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
|
||||
|
||||
connection server_1;
|
||||
|
||||
create table t4 (n int); # create 3 ignored events
|
||||
create table t5 (n int);
|
||||
create table t6 (n int);
|
||||
|
||||
--sync_slave_with_master server_2
|
||||
|
||||
# then BUG#13023 caused hang below ("master" looks behind, while it's
|
||||
# not in terms of updates done).
|
||||
--sync_slave_with_master server_1
|
||||
|
||||
show tables;
|
||||
|
||||
# cleanup
|
||||
drop table t1, t2, t3, t4, t5, t6;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Verify dump thread can send events in active file, correctly after
|
||||
# encountering an IO error.
|
||||
#
|
||||
--source include/have_debug.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
CALL mtr.add_suppression("Failed to read an event from active binlog.*");
|
||||
SET @debug_saved= @@GLOBAL.DEBUG;
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
--source include/rpl_connection_master.inc
|
||||
SET GLOBAL debug='+d,dump_fake_io_error';
|
||||
INSERT INTO t1 VALUES(2);
|
||||
INSERT INTO t1 VALUES(3);
|
||||
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:t1, slave:t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--source include/rpl_connection_master.inc
|
||||
SET @@GLOBAL.DEBUG= @debug_saved;
|
||||
DROP TABLE t1;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,13 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# Load table should not succeed on the master as this is not a slave
|
||||
#
|
||||
--error 1218
|
||||
load table t1 from master;
|
||||
connection slave;
|
||||
--error 1188
|
||||
load table t1 from master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,67 @@
|
||||
# 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.
|
||||
##########################################################################
|
||||
# 2006-02-07 JBM Added error code 1022 for NDB Engine + ORDER BY
|
||||
##########################################################################
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
|
||||
connection master;
|
||||
create table t1 (a int primary key);
|
||||
create table t4 (a int primary key);
|
||||
# generate an error that goes to the binlog
|
||||
--error 1022, ER_DUP_ENTRY
|
||||
insert into t1 values (1),(1);
|
||||
insert into t4 values (1),(2);
|
||||
# as the t1 table is ignored on the slave, the slave should be able to sync
|
||||
sync_slave_with_master;
|
||||
# check that the table has been ignored, because otherwise the test is nonsense
|
||||
show tables like 't1';
|
||||
show tables like 't4';
|
||||
SELECT * FROM test.t4 ORDER BY a;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_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;
|
||||
let $wait_condition= SELECT a > 1 FROM t2;
|
||||
source include/wait_condition.inc;
|
||||
select (@id := id) - id from t3;
|
||||
kill @id;
|
||||
drop table t2,t3;
|
||||
insert into t4 values (3),(4);
|
||||
connection master;
|
||||
# The get_lock function causes warning for unsafe statement.
|
||||
--disable_warnings
|
||||
--error 0,1317,2013
|
||||
reap;
|
||||
--enable_warnings
|
||||
connection master1;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM test.t4 ORDER BY a;
|
||||
|
||||
connection master1;
|
||||
DROP TABLE test.t4;
|
||||
sync_slave_with_master;
|
||||
# End of 4.1 tests
|
||||
# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
|
||||
|
||||
|
||||
--source include/rpl_end.inc
|
||||
114
build/lib/mysql/mysql-test/suite/rpl/t/rpl_events.test
Normal file
114
build/lib/mysql/mysql-test/suite/rpl/t/rpl_events.test
Normal file
@@ -0,0 +1,114 @@
|
||||
##################################################################
|
||||
# Author: Giuseppe #
|
||||
# Date: 2006-12-20 #
|
||||
# Purpose: To test that event effects are replicated #
|
||||
# in both row based and statement based format #
|
||||
##################################################################
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
SET @old_event_scheduler = @@global.event_scheduler;
|
||||
set global event_scheduler=1;
|
||||
|
||||
let $engine_type= MyISAM;
|
||||
|
||||
set binlog_format=row;
|
||||
|
||||
# Embedded server doesn't support binlogging
|
||||
--source include/rpl_events.inc
|
||||
|
||||
set binlog_format=statement;
|
||||
|
||||
# Embedded server doesn't support binlogging
|
||||
--source include/rpl_events.inc
|
||||
|
||||
#
|
||||
# Bug #28953 Using events in a replication let the slave crash.
|
||||
#
|
||||
|
||||
connection master;
|
||||
|
||||
CREATE TABLE t28953 (a INT);
|
||||
|
||||
DELIMITER |;
|
||||
CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR
|
||||
DO BEGIN
|
||||
select * from t28953;
|
||||
END;|
|
||||
DELIMITER ;|
|
||||
|
||||
ALTER EVENT event1 RENAME TO event2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
||||
DROP EVENT event2;
|
||||
|
||||
#
|
||||
# BUG#44331
|
||||
# This test verifies if the definer is consistent between master and slave,
|
||||
# when the event is created without the DEFINER clause set explicitly or the
|
||||
# DEFINER is set to CURRENT_USER
|
||||
#
|
||||
CREATE TABLE test.t1(details CHAR(30));
|
||||
|
||||
CREATE EVENT /*!50000 event44331_1 */
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_1 fired - no definer');
|
||||
|
||||
CREATE DEFINER=CURRENT_USER /*!50000 EVENT event44331_2 */
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_2 fired - DEFINER=CURRENT_USER');
|
||||
|
||||
CREATE DEFINER=CURRENT_USER() EVENT event44331_3
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_3 fired - DEFINER=CURRENT_USER() function');
|
||||
|
||||
DELIMITER |;
|
||||
CREATE /*!50000 DEFINER='user44331' */ EVENT event44331_4
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
ON COMPLETION PRESERVE DISABLE
|
||||
DO INSERT INTO test.t1 VALUES('event event44331_4 fired - DEFINER=user1');
|
||||
# Test for bug#50095 Multi-statement including CREATE EVENT causes rotten
|
||||
# binlog entry
|
||||
SELECT 'ABC';
|
||||
SELECT '123'|
|
||||
DELIMITER ;|
|
||||
|
||||
--echo #on master
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_1';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_2';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_3';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_4';
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
--echo #on slave
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_1';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_2';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_3';
|
||||
select EVENT_SCHEMA, EVENT_NAME, DEFINER from information_schema.events
|
||||
where EVENT_NAME='event44331_4';
|
||||
|
||||
connection master;
|
||||
SET @@global.event_scheduler= @old_event_scheduler;
|
||||
DROP TABLE t28953;
|
||||
DROP TABLE t1;
|
||||
DROP EVENT event44331_1;
|
||||
DROP EVENT event44331_2;
|
||||
DROP EVENT event44331_3;
|
||||
DROP EVENT event44331_4;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,11 @@
|
||||
#############################################################
|
||||
# Purpose: To test having extra columns on the master WL#3915
|
||||
#############################################################
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
let $engine_type = 'InnoDB';
|
||||
--source extra/rpl_tests/rpl_extra_col_master.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,10 @@
|
||||
#############################################################
|
||||
# Purpose: To test having extra columns on the master WL#3915
|
||||
#############################################################
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
let $engine_type = 'MyISAM';
|
||||
--source extra/rpl_tests/rpl_extra_col_master.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,6 @@
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/master-slave.inc
|
||||
let $engine_type = 'InnoDB';
|
||||
-- source extra/rpl_tests/rpl_extra_col_slave.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,5 @@
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
let $engine_type = 'MyISAM';
|
||||
-- source extra/rpl_tests/rpl_extra_col_slave.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,4 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
let $engine_type=InnoDB;
|
||||
-- source extra/rpl_tests/rpl_failed_optimize.test
|
||||
@@ -0,0 +1,270 @@
|
||||
# Test evaluation of replication table filter rules
|
||||
#
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test if replication table filter rules are properly evaluated when
|
||||
# some of the tables referenced by the multiple-table update do not
|
||||
# exist on slave.
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Master creates tables t1, t2, t3, t4, t5, t6, t7, t8, t9 and the
|
||||
# slave is started with the following replication table filter rules:
|
||||
#
|
||||
# --replicate-do-table=t1
|
||||
# --replicate-do-table=t2
|
||||
# --replicate-do-table=t3
|
||||
#
|
||||
# and
|
||||
#
|
||||
# --replicate-ignore-table=t4
|
||||
# --replicate-ignore-table=t5
|
||||
# --replicate-ignore-table=t6
|
||||
#
|
||||
# So the slave only replicate changes to tables t1, t2 and t3 and only
|
||||
# these tables exist on slave.
|
||||
#
|
||||
# From now on, tables t1, t2, and t3 are referenced as do tables,
|
||||
# tables t4, t5, t6 are referenced as ignore tables, and tables t7,
|
||||
# t8, t9 are referenced as other tables.
|
||||
#
|
||||
# All multi-table update tests reference tables that are not do
|
||||
# tables, which do not exist on slave. And the following situations
|
||||
# of multi-table update will be tested:
|
||||
#
|
||||
# 1. Do tables are not referenced at all
|
||||
# 2. Do tables are not referenced for update
|
||||
# 3. Ignore tables are referenced for update before do tables
|
||||
# 4. Only do tables are referenced for update
|
||||
# 5. Do tables and other tables are referenced for update
|
||||
# 6. Do tables are referenced for update before ignore tables
|
||||
#
|
||||
# For 1, 2 and 3, the statement should be ignored by slave, for 4, 5
|
||||
# and 6 the statement should be accepted by slave and cause an error
|
||||
# because of non-exist tables.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#37051 Replication rules not evaluated correctly
|
||||
|
||||
|
||||
source include/have_binlog_format_statement.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
# These tables are mentioned in do-table rules
|
||||
CREATE TABLE t1 (id int, a int);
|
||||
CREATE TABLE t2 (id int, b int);
|
||||
CREATE TABLE t3 (id int, c int);
|
||||
|
||||
# These tables are mentioned in ignore-table rules
|
||||
CREATE TABLE t4 (id int, d int);
|
||||
CREATE TABLE t5 (id int, e int);
|
||||
CREATE TABLE t6 (id int, f int);
|
||||
|
||||
# These tables are not mentioned in do-table or ignore-table rules
|
||||
CREATE TABLE t7 (id int, g int);
|
||||
CREATE TABLE t8 (id int, h int);
|
||||
CREATE TABLE t9 (id int, i int);
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t3 VALUES (1, 1), (2, 2), (3, 3);
|
||||
|
||||
INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t5 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t6 VALUES (1, 1), (2, 2), (3, 3);
|
||||
|
||||
INSERT INTO t7 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t8 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t9 VALUES (1, 1), (2, 2), (3, 3);
|
||||
|
||||
# Only t1, t2, t3 should be replicated to slave
|
||||
sync_slave_with_master;
|
||||
echo [on slave];
|
||||
SHOW TABLES LIKE 't%';
|
||||
|
||||
connection master;
|
||||
echo [on master];
|
||||
|
||||
#
|
||||
# Do tables are not referenced, these statements should be ignored by
|
||||
# slave.
|
||||
#
|
||||
UPDATE t7 LEFT JOIN t4 ON (t4.id=t7.id) SET d=0, g=0 where t7.id=1;
|
||||
UPDATE t7 LEFT JOIN (t4, t5, t6) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t6.id) SET d=0, e=0, f=0, g=0 where t7.id=1;
|
||||
UPDATE t4 LEFT JOIN (t7, t8, t9) ON (t4.id=t7.id and t4.id=t8.id and t4.id=t9.id) SET d=0, g=0, h=0, i=0 where t4.id=1;
|
||||
UPDATE t7 LEFT JOIN (t8, t9) ON (t7.id=t8.id and t7.id=t9.id) SET g=0, h=0, i=0 where t7.id=1;
|
||||
|
||||
#
|
||||
# Do tables are not referenced for update, these statements should be
|
||||
# ignored by slave.
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET d=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET g=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET d=0, e=0, f=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t8) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t8.id) SET d=0, e=0, h=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t7, t8, t5) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t5.id) SET g=0, h=0, e=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t2, t3, t5) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t5.id) SET e=0 where t1.id=1;
|
||||
|
||||
#
|
||||
# Ignore tables are referenced for update before do tables, these
|
||||
# statements should be ignore by slave.
|
||||
#
|
||||
UPDATE t4 LEFT JOIN t1 ON (t1.id=t4.id) SET a=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t7) ON (t4.id=t1.id and t7.id=t4.id) SET a = 0, d=0, g=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t2, t3) ON (t1.id=t4.id and t2.id=t4.id and t3.id=t4.id) SET a=0, b=0, c=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t2, t5) ON (t1.id=t4.id and t2.id=t4.id and t5.id=t4.id) SET a=0, b=0, e=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id) SET a=0, d=0, f=0, g=0 where t4.id=1;
|
||||
UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
|
||||
UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1;
|
||||
|
||||
# Sync slave to make sure all above statements are correctly ignored,
|
||||
# if any of the above statement are not ignored, it would cause error
|
||||
# and stop slave sql thread.
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
call mtr.add_suppression("Slave SQL.*Error .Table .test.t[47]. doesn.t exist. on query.* Error_code: 1146");
|
||||
connection master;
|
||||
|
||||
# Parameters for include/wait_for_slave_sql_error_and_skip.inc:
|
||||
# Ask it to show SQL error message.
|
||||
let $show_slave_sql_error= 1;
|
||||
# The expected error will always be 1146 (ER_NO_SUCH_TABLE).
|
||||
let $slave_sql_errno= 1146;
|
||||
|
||||
#
|
||||
# Only do tables are referenced for update, these statements should
|
||||
# cause error on slave
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
#
|
||||
# Do tables and other tables are referenced for update, these
|
||||
# statements should cause error on slave
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
#
|
||||
# Do tables are referenced for update before ignore tables
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
echo [on slave];
|
||||
|
||||
# We should only have tables t1, t2, t3 on slave
|
||||
show tables like 't%';
|
||||
|
||||
# The rows in these tables should remain untouched
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
SELECT * FROM t3;
|
||||
|
||||
# Clean up
|
||||
connection master;
|
||||
echo [on master];
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
#
|
||||
# BUG#11754117 - 45670: INTVAR_EVENTS FOR FILTERED-OUT QUERY_LOG_EVENTS ARE EXECUTED
|
||||
# Int-, Rand- and User- var events accompaning a filtered out Query-log-event should
|
||||
# be filtered as well.
|
||||
#
|
||||
connection master;
|
||||
# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
|
||||
CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT); # ignored on slave
|
||||
CREATE TABLE test.t1 (a INT); # accepted on slave
|
||||
INSERT INTO test.t1 VALUES(1);
|
||||
|
||||
--sync_slave_with_master
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
|
||||
CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
|
||||
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
|
||||
INSERT INTO test.t_slave VALUES(NULL, RAND(), @c);
|
||||
|
||||
connection master;
|
||||
SET INSERT_ID=2;
|
||||
SET @c=2;
|
||||
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
|
||||
INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored
|
||||
SELECT b into @b FROM test.t5;
|
||||
--let $b_master=`select @b`
|
||||
UPDATE test.t1 SET a=2; # to run trigger on slave
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
# The proof:
|
||||
SELECT a AS 'ONE' into @a FROM test.t_slave;
|
||||
SELECT c AS 'NULL' into @c FROM test.t_slave;
|
||||
|
||||
let $count= 1;
|
||||
let $table= test.t_slave;
|
||||
source include/wait_until_rows_count.inc;
|
||||
|
||||
if (`SELECT @a != 2 and @c != NULL`)
|
||||
{
|
||||
SELECT * FROM test.t_slave;
|
||||
--die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context.
|
||||
}
|
||||
|
||||
SELECT b into @b FROM test.t_slave;
|
||||
--let $b_slave=`select @b`
|
||||
|
||||
--let $assert_text= Random values from master and slave must be different
|
||||
--let $assert_cond= $b_master != $b_slave
|
||||
--source include/assert.inc
|
||||
|
||||
# cleanup BUG#11754117
|
||||
connection master;
|
||||
drop table test.t5;
|
||||
drop table test.t1;
|
||||
|
||||
--sync_slave_with_master
|
||||
drop table test.t_slave;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,46 @@
|
||||
# Testing if "flush logs" command bouncing resulting in logs created in a loop
|
||||
# in case of bi-directional replication
|
||||
--let $rpl_topology= 1->2->1
|
||||
--source include/rpl_init.inc
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/
|
||||
show variables like 'relay_log%';
|
||||
|
||||
#
|
||||
# Flush logs of slave
|
||||
#
|
||||
# Create full loop by following way:
|
||||
# 1. Insert into t1 on master (1st).
|
||||
# 2. Insert into t1 on slave (2nd) when the event (1st) for t1 replicated.
|
||||
# 3. Master waits until the event (2nd) for t1 will be replicated.
|
||||
|
||||
CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM;
|
||||
let $wait_binlog_event= CREATE TABLE t1;
|
||||
--source include/wait_for_binlog_event.inc
|
||||
sync_slave_with_master server_2;
|
||||
|
||||
connection server_1;
|
||||
INSERT INTO t1 VALUE(1);
|
||||
FLUSH LOGS;
|
||||
sync_slave_with_master server_2;
|
||||
|
||||
INSERT INTO t1 VALUE(2);
|
||||
let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
sync_slave_with_master server_1;
|
||||
|
||||
#
|
||||
# Check that the master server's slave threads are still running and show
|
||||
# Relay_Log_File
|
||||
#
|
||||
--source include/check_slave_is_running.inc
|
||||
--let status_items= Relay_Log_File
|
||||
--source include/show_slave_status.inc
|
||||
|
||||
--disable_query_log
|
||||
connection server_1;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master server_2;
|
||||
--enable_query_log
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,4 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
let $engine_type=INNODB;
|
||||
-- source extra/rpl_tests/rpl_foreign_key.test
|
||||
256
build/lib/mysql/mysql-test/suite/rpl/t/rpl_found_rows.test
Normal file
256
build/lib/mysql/mysql-test/suite/rpl/t/rpl_found_rows.test
Normal file
@@ -0,0 +1,256 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
# It is not possible to replicate FOUND_ROWS() using statement-based
|
||||
# replication, but there is a workaround that stores the result of
|
||||
# FOUND_ROWS() into a user variable and then replicates this instead.
|
||||
|
||||
# The purpose of this test case is to test that the workaround
|
||||
# function properly even when inside stored programs (i.e., stored
|
||||
# routines and triggers).
|
||||
|
||||
--echo ==== 0. Setting it all up ====
|
||||
|
||||
SET BINLOG_FORMAT=STATEMENT;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE logtbl (sect INT, test INT, count INT);
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t1 SELECT 2*a+3 FROM t1;
|
||||
INSERT INTO t1 SELECT 2*a+3 FROM t1;
|
||||
INSERT INTO t1 SELECT 2*a+3 FROM t1;
|
||||
INSERT INTO t1 SELECT 2*a+3 FROM t1;
|
||||
INSERT INTO t1 SELECT 2*a+3 FROM t1;
|
||||
INSERT INTO t1 SELECT 2*a+3 FROM t1;
|
||||
|
||||
--echo #### 1. Using statement mode ####
|
||||
|
||||
--echo ==== 1.1. Simple test ====
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
|
||||
# Instead of
|
||||
# INSERT INTO logtbl VALUES(1, 1, FOUND_ROWS());
|
||||
# we write
|
||||
SELECT FOUND_ROWS() INTO @a;
|
||||
INSERT INTO logtbl VALUES(1,1,@a);
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
|
||||
# Instead of
|
||||
# INSERT INTO logtbl VALUES(1, 2, FOUND_ROWS());
|
||||
# we write
|
||||
SELECT FOUND_ROWS() INTO @a;
|
||||
INSERT INTO logtbl VALUES(1,2,@a);
|
||||
|
||||
SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
|
||||
|
||||
--echo ==== 1.2. Stored procedure ====
|
||||
|
||||
# Here we do both the calculation and the logging. We also do it twice
|
||||
# to make sure that there are no limitations on how many times it can
|
||||
# be used.
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
--delimiter $$
|
||||
CREATE PROCEDURE calc_and_log(sect INT, test INT) BEGIN
|
||||
DECLARE cnt INT;
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
|
||||
SELECT FOUND_ROWS() INTO cnt;
|
||||
INSERT INTO logtbl VALUES(sect,test,cnt);
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
SELECT FOUND_ROWS() INTO cnt;
|
||||
INSERT INTO logtbl VALUES(sect,test+1,cnt);
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
CALL calc_and_log(2,1);
|
||||
|
||||
--delimiter $$
|
||||
CREATE PROCEDURE just_log(sect INT, test INT, found_rows INT) BEGIN
|
||||
INSERT INTO logtbl VALUES (sect,test,found_rows);
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
SELECT FOUND_ROWS() INTO @found_rows;
|
||||
CALL just_log(2,3,@found_rows);
|
||||
|
||||
SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
|
||||
|
||||
--echo ==== 1.3. Stored functions ====
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
--delimiter $$
|
||||
CREATE FUNCTION log_rows(sect INT, test INT, found_rows INT)
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO logtbl VALUES(sect,test,found_rows);
|
||||
RETURN found_rows;
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
SELECT FOUND_ROWS() INTO @found_rows;
|
||||
SELECT log_rows(3,1,@found_rows), log_rows(3,2,@found_rows);
|
||||
|
||||
SELECT * FROM logtbl WHERE sect = 3 ORDER BY sect,test;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM logtbl WHERE sect = 3 ORDER BY sect,test;
|
||||
|
||||
--echo ==== 1.9. Cleanup ====
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DELETE FROM logtbl;
|
||||
DROP PROCEDURE just_log;
|
||||
DROP PROCEDURE calc_and_log;
|
||||
DROP FUNCTION log_rows;
|
||||
|
||||
--source include/rpl_reset.inc
|
||||
|
||||
--echo #### 2. Using mixed mode ####
|
||||
|
||||
--echo ==== 2.1. Checking a procedure ====
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
|
||||
# We will now check some stuff that will not work in statement-based
|
||||
# replication, but which should cause the binary log to switch to
|
||||
# row-based logging.
|
||||
|
||||
--delimiter $$
|
||||
CREATE PROCEDURE just_log(sect INT, test INT) BEGIN
|
||||
INSERT INTO logtbl VALUES (sect,test,FOUND_ROWS());
|
||||
END $$
|
||||
--delimiter ;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo **** On Master 1 ****
|
||||
connection master1;
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
CALL just_log(1,1);
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
CALL just_log(1,2);
|
||||
|
||||
--echo **** On Master 1 ****
|
||||
|
||||
connection master1;
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
|
||||
CALL just_log(1,3);
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
CALL just_log(1,4);
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
|
||||
|
||||
--echo ==== 2.1. Checking a stored function ====
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
--delimiter $$
|
||||
CREATE FUNCTION log_rows(sect INT, test INT)
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
DECLARE found_rows INT;
|
||||
SELECT FOUND_ROWS() INTO found_rows;
|
||||
INSERT INTO logtbl VALUES(sect,test,found_rows);
|
||||
RETURN found_rows;
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
|
||||
SELECT log_rows(2,1), log_rows(2,2);
|
||||
|
||||
CREATE TABLE t2 (a INT, b INT);
|
||||
|
||||
# Trying with referencing FOUND_ROWS() directly in the trigger.
|
||||
|
||||
--delimiter $$
|
||||
CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO logtbl VALUES (NEW.a, NEW.b, FOUND_ROWS());
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
|
||||
INSERT INTO t2 VALUES (2,3), (2,4);
|
||||
|
||||
# Referencing FOUND_ROWS() indirectly.
|
||||
|
||||
DROP TRIGGER t2_tr;
|
||||
|
||||
--delimiter $$
|
||||
CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE dummy INT;
|
||||
SELECT log_rows(NEW.a, NEW.b) INTO dummy;
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
INSERT INTO t2 VALUES (2,5), (2,6);
|
||||
|
||||
# Putting FOUND_ROWS() even lower in the call chain.
|
||||
|
||||
connection master;
|
||||
DROP TRIGGER t2_tr;
|
||||
|
||||
--delimiter $$
|
||||
CREATE PROCEDURE log_me_inner(sect INT, test INT)
|
||||
BEGIN
|
||||
DECLARE dummy INT;
|
||||
SELECT log_rows(sect, test) INTO dummy;
|
||||
SELECT log_rows(sect, test+1) INTO dummy;
|
||||
END $$
|
||||
|
||||
CREATE PROCEDURE log_me(sect INT, test INT)
|
||||
BEGIN
|
||||
CALL log_me_inner(sect,test);
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
--delimiter $$
|
||||
CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
|
||||
BEGIN
|
||||
CALL log_me(NEW.a, NEW.b);
|
||||
END $$
|
||||
--delimiter ;
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
|
||||
INSERT INTO t2 VALUES (2,5), (2,6);
|
||||
|
||||
SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2, logtbl;
|
||||
DROP PROCEDURE just_log;
|
||||
DROP PROCEDURE log_me;
|
||||
DROP PROCEDURE log_me_inner;
|
||||
DROP FUNCTION log_rows;
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
23
build/lib/mysql/mysql-test/suite/rpl/t/rpl_free_items.test
Normal file
23
build/lib/mysql/mysql-test/suite/rpl/t/rpl_free_items.test
Normal file
@@ -0,0 +1,23 @@
|
||||
source include/master-slave.inc;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
disable_query_log;
|
||||
SET @query="INSERT INTO t2 SELECT * FROM t1 WHERE a REGEXP \"0\"";
|
||||
let $1 = 2000;
|
||||
while ($1)
|
||||
{
|
||||
eval SET @query=concat(@query, " OR a REGEXP '$1'");
|
||||
dec $1;
|
||||
}
|
||||
let $1=`select @query`;
|
||||
eval $1;
|
||||
enable_query_log;
|
||||
# I have seen the slave crash either now or at shutdown
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
26
build/lib/mysql/mysql-test/suite/rpl/t/rpl_geometry.test
Normal file
26
build/lib/mysql/mysql-test/suite/rpl/t/rpl_geometry.test
Normal file
@@ -0,0 +1,26 @@
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_row.inc;
|
||||
|
||||
#
|
||||
# Bug#48776, Bug#43784
|
||||
#
|
||||
create table t1(a varchar(100),
|
||||
b multipoint not null,
|
||||
c varchar(256));
|
||||
|
||||
insert into t1 set
|
||||
a='hello',
|
||||
b=geomfromtext('multipoint(1 1)'),
|
||||
c='geometry';
|
||||
|
||||
create table t2 (a int(11) not null auto_increment primary key,
|
||||
b geometrycollection default null,
|
||||
c decimal(10,0));
|
||||
|
||||
insert into t2(c) values (null);
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
--source include/rpl_end.inc
|
||||
47
build/lib/mysql/mysql-test/suite/rpl/t/rpl_get_lock.test
Normal file
47
build/lib/mysql/mysql-test/suite/rpl/t/rpl_get_lock.test
Normal file
@@ -0,0 +1,47 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
|
||||
create table t1(n int);
|
||||
# Use of get_lock gives a warning for unsafeness if binlog_format=statement
|
||||
--disable_warnings
|
||||
insert into t1 values(get_lock("lock",2));
|
||||
--enable_warnings
|
||||
dirty_close master;
|
||||
connection master1;
|
||||
select get_lock("lock",2);
|
||||
|
||||
select release_lock("lock");
|
||||
#ignore
|
||||
disable_query_log;
|
||||
let $1=2000;
|
||||
while ($1)
|
||||
{
|
||||
do get_lock("lock",2);
|
||||
do release_lock("lock");
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
sync_slave_with_master;
|
||||
select get_lock("lock",3);
|
||||
select * from t1;
|
||||
# There is no point in testing REPLICATIION of the IS_*_LOCK
|
||||
# functions; slave does not run with the same concurrency context as
|
||||
# master (generally in slave we can't know that on master this lock
|
||||
# was already held by another connection and so that the the
|
||||
# get_lock() we're replicating timed out on master hence returned 0,
|
||||
# or that the is_free_lock() we're playing returned 0 etc.
|
||||
# But here all we do is test these functions outside of replication.
|
||||
select is_free_lock("lock"), is_used_lock("lock") = connection_id();
|
||||
explain extended select is_free_lock("lock"), is_used_lock("lock");
|
||||
# Check lock functions
|
||||
select is_free_lock("lock2");
|
||||
select is_free_lock(NULL);
|
||||
connection master1;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# BUG#45214
|
||||
# This test verifies if the slave I/O tread tries to reconnect to
|
||||
# master when it tries to get the values of the UNIX_TIMESTAMP, SERVER_ID,
|
||||
# COLLATION_SERVER and TIME_ZONE from master under network disconnection.
|
||||
# The COLLATION_SERVER and TIME_ZONE are got only on master server version 4.
|
||||
# So they can't be verified by test case here.
|
||||
# Finish the following tests by calling its common test script:
|
||||
# extra/rpl_tests/rpl_get_master_version_and_clock.test.
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_debug.inc;
|
||||
source include/have_debug_sync.inc;
|
||||
|
||||
#
|
||||
# The test is not supposed to have any binglog affairs.
|
||||
# Hence it's enough it to run only with one binlog format
|
||||
#
|
||||
source include/have_binlog_format_mixed.inc;
|
||||
|
||||
connection slave;
|
||||
|
||||
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*");
|
||||
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
|
||||
call mtr.add_suppression("Slave I/O thread .* register on master");
|
||||
|
||||
#Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection
|
||||
let $debug_saved= `select @@global.debug`;
|
||||
|
||||
# set up two parameters to pass into extra/rpl_tests/rpl_get_master_version_and_clock
|
||||
let $dbug_sync_point= 'debug_lock.before_get_UNIX_TIMESTAMP';
|
||||
let $debug_sync_action= 'now SIGNAL signal.get_unix_timestamp';
|
||||
source extra/rpl_tests/rpl_get_master_version_and_clock.test;
|
||||
|
||||
#Test case 2: Try to get the value of the SERVER_ID from master under network disconnection
|
||||
connection slave;
|
||||
|
||||
let $dbug_sync_point= 'debug_lock.before_get_SERVER_ID';
|
||||
let $debug_sync_action= 'now SIGNAL signal.get_server_id';
|
||||
source extra/rpl_tests/rpl_get_master_version_and_clock.test;
|
||||
|
||||
eval set global debug= '$debug_saved';
|
||||
|
||||
|
||||
# cleanup
|
||||
|
||||
# is not really necessary but avoids mtr post-run env check warnings
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
||||
# End of tests
|
||||
--source include/rpl_end.inc
|
||||
40
build/lib/mysql/mysql-test/suite/rpl/t/rpl_grant.test
Normal file
40
build/lib/mysql/mysql-test/suite/rpl/t/rpl_grant.test
Normal file
@@ -0,0 +1,40 @@
|
||||
# Tests of grants and users
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/not_embedded.inc;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
|
||||
CREATE USER dummy@localhost;
|
||||
CREATE USER dummy1@localhost, dummy2@localhost;
|
||||
|
||||
SELECT user, host FROM mysql.user WHERE user like 'dummy%';
|
||||
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
|
||||
sync_slave_with_master;
|
||||
--echo **** On Slave ****
|
||||
SELECT user,host FROM mysql.user WHERE user like 'dummy%';
|
||||
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
|
||||
# No user exists
|
||||
error ER_CANNOT_USER;
|
||||
DROP USER nonexisting@localhost;
|
||||
|
||||
# At least one user exists, but not all
|
||||
error ER_CANNOT_USER;
|
||||
DROP USER nonexisting@localhost, dummy@localhost;
|
||||
|
||||
# All users exist
|
||||
DROP USER dummy1@localhost, dummy2@localhost;
|
||||
|
||||
SELECT user, host FROM mysql.user WHERE user like 'dummy%';
|
||||
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
|
||||
sync_slave_with_master;
|
||||
--echo **** On Slave ****
|
||||
SELECT user,host FROM mysql.user WHERE user like 'dummy%';
|
||||
SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
|
||||
|
||||
--source include/rpl_end.inc
|
||||
375
build/lib/mysql/mysql-test/suite/rpl/t/rpl_idempotency.test
Normal file
375
build/lib/mysql/mysql-test/suite/rpl/t/rpl_idempotency.test
Normal file
@@ -0,0 +1,375 @@
|
||||
# Testing various forms of idempotency for replication that should
|
||||
# work the same way under statement based as under row based.
|
||||
|
||||
source include/master-slave.inc;
|
||||
connection master;
|
||||
source include/have_innodb.inc;
|
||||
connection slave;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
# Add suppression for expected warning(s) in slaves error log
|
||||
call mtr.add_suppression("Can.t find record in .t[12].* Error_code: 1032");
|
||||
call mtr.add_suppression("Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451");
|
||||
call mtr.add_suppression("Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
|
||||
call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.* Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
|
||||
|
||||
SET @old_slave_exec_mode= @@global.slave_exec_mode;
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
CREATE TABLE t2 (a INT);
|
||||
INSERT INTO t1 VALUES (-1),(-2),(-3);
|
||||
INSERT INTO t2 VALUES (-1),(-2),(-3);
|
||||
sync_slave_with_master;
|
||||
|
||||
# A delete for a row that does not exist, the statement is
|
||||
# deliberately written to be idempotent for statement-based
|
||||
# replication as well. We test this towards both a table with a
|
||||
# primary key and without a primary key.
|
||||
|
||||
connection slave;
|
||||
DELETE FROM t1 WHERE a = -2;
|
||||
DELETE FROM t2 WHERE a = -2;
|
||||
connection master;
|
||||
DELETE FROM t1 WHERE a = -2;
|
||||
DELETE FROM t2 WHERE a = -2;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
# An insert of a row that already exists. Since we are replacing the
|
||||
# row if it already exists, the most apropriate representation is
|
||||
# INSERT IGNORE. We only test this towards a table with a primary key,
|
||||
# since the other case does not make sense.
|
||||
|
||||
INSERT IGNORE INTO t1 VALUES (-2);
|
||||
connection master;
|
||||
INSERT IGNORE INTO t1 VALUES (-2);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
# BUG#19958: RBR idempotency issue for UPDATE and DELETE
|
||||
|
||||
# Statement-based and row-based replication have different behaviour
|
||||
# when updating a row with an explicit WHERE-clause that matches
|
||||
# exactly one row (or no row at all). For statement-based replication,
|
||||
# the statement is idempotent since the first time it is executed, it
|
||||
# will update exactly one row, and the second time it will not update
|
||||
# any row at all. This was not the case for row-based replication, so
|
||||
# we test under both row-based and statement-based replication both
|
||||
# for tables with and without primary keys.
|
||||
|
||||
connection slave;
|
||||
UPDATE t1 SET a = 1 WHERE a = -1;
|
||||
UPDATE t2 SET a = 1 WHERE a = -1;
|
||||
connection master;
|
||||
UPDATE t1 SET a = 1 WHERE a = -1;
|
||||
UPDATE t2 SET a = 1 WHERE a = -1;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
# bug#31609 Not all RBR slave errors reported as errors
|
||||
# bug#31552 Replication breaks when deleting rows from out-of-sync table
|
||||
# without PK
|
||||
|
||||
#
|
||||
# Idempotent applying is not default any longer.
|
||||
# The default for slave-exec-mode option and server
|
||||
# variable slave_exec_mode is 'STRICT'.
|
||||
# When 'STRICT' mode is set, the slave SQL thread will stop whenever
|
||||
# the row to change is not found. In 'IDEMPOTENT' mode, the SQL thread
|
||||
# will continue running and apply the row - replace if it's Write_rows event -
|
||||
# or skip to the next event.
|
||||
|
||||
# the previous part of the tests was with IDEMPOTENT slave's mode.
|
||||
|
||||
|
||||
#
|
||||
# Other than above idempotent errors dealing with foreign keys constraint
|
||||
#
|
||||
|
||||
select @@global.slave_exec_mode /* must be IDEMPOTENT */;
|
||||
|
||||
connection master;
|
||||
|
||||
create table ti1 (b int primary key) engine = innodb;
|
||||
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
|
||||
engine = innodb;
|
||||
set foreign_key_checks=1 /* ensure the check */;
|
||||
|
||||
insert into ti1 values (1),(2),(3);
|
||||
insert into ti2 set a=2, b=2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
#connection slave;
|
||||
select * from ti1 order by b /* must be (1),(2),(3) */;
|
||||
insert into ti2 set a=1, b=1;
|
||||
select * from ti2 order by b /* must be (1,1) (2,2) */;
|
||||
|
||||
connection master;
|
||||
|
||||
# from now on checking rbr specific idempotent errors
|
||||
set @save_binlog_format= @@session.binlog_format;
|
||||
set @@session.binlog_format= row;
|
||||
delete from ti1 where b=1;
|
||||
|
||||
select * from ti1 order by b /* must be (2),(3) */;
|
||||
|
||||
# slave must catch up (expect some warnings in error.log)
|
||||
sync_slave_with_master;
|
||||
|
||||
#connection slave;
|
||||
select * from ti1 order by b /* must stays as were on master (1),(2),(3) */;
|
||||
|
||||
delete from ti1 where b=3;
|
||||
|
||||
connection master;
|
||||
insert into ti2 set a=3, b=3;
|
||||
|
||||
# slave must catch up (expect some warnings in error.log)
|
||||
sync_slave_with_master;
|
||||
|
||||
#connection slave;
|
||||
select * from ti2 order by b /* must be (1,1),(2,2) - not inserted */;
|
||||
|
||||
|
||||
#
|
||||
# Checking the new global sys variable
|
||||
#
|
||||
|
||||
connection slave;
|
||||
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
set global slave_exec_mode='STRICT';
|
||||
|
||||
# checking mutual exclusion for the options
|
||||
--error ER_SLAVE_AMBIGOUS_EXEC_MODE
|
||||
set global slave_exec_mode='IDEMPOTENT,STRICT';
|
||||
|
||||
select @@global.slave_exec_mode /* must be STRICT */;
|
||||
|
||||
#
|
||||
# Checking stops.
|
||||
# In the following sections strict slave sql thread is going to
|
||||
# stop when faces an idempotent error. In order to proceed
|
||||
# the mode is temporarily switched to indempotent.
|
||||
#
|
||||
|
||||
#
|
||||
--echo *** foreign keys errors as above now forces to stop
|
||||
#
|
||||
|
||||
connection master;
|
||||
|
||||
set foreign_key_checks=0;
|
||||
drop table ti2, ti1;
|
||||
|
||||
create table ti1 (b int primary key) engine = innodb;
|
||||
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
|
||||
engine = innodb;
|
||||
set foreign_key_checks=1 /* ensure the check */;
|
||||
|
||||
insert into ti1 values (1),(2),(3);
|
||||
insert into ti2 set a=2, b=2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
#connection slave;
|
||||
select * from ti1 order by b /* must be (1),(2),(3) */;
|
||||
--echo *** conspire future problem
|
||||
insert into ti2 set a=1, b=1;
|
||||
select * from ti2 order by b /* must be (1,1) (2,2) */;
|
||||
|
||||
connection master;
|
||||
|
||||
delete from ti1 where b=1 /* offending delete event */;
|
||||
select * from ti1 order by b /* must be (2),(3) */;
|
||||
|
||||
# foreign key: row is referenced
|
||||
|
||||
--echo *** slave must stop (Trying to delete a referenced foreing key)
|
||||
connection slave;
|
||||
# 1451 = ER_ROW_ID_REFERENCED_2
|
||||
--let $slave_sql_errno= 1451
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
|
||||
set foreign_key_checks= 0;
|
||||
delete from ti2 where b=1;
|
||||
set foreign_key_checks= 1;
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
start slave sql_thread;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
set global slave_exec_mode='STRICT';
|
||||
|
||||
connection master;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
#connection slave;
|
||||
--echo *** conspire the following insert failure
|
||||
# foreign key: no referenced row
|
||||
|
||||
--echo *** conspire future problem
|
||||
delete from ti1 where b=3;
|
||||
|
||||
connection master;
|
||||
insert into ti2 set a=3, b=3 /* offending write event */;
|
||||
|
||||
--echo *** slave must stop (Trying to insert an invalid foreign key)
|
||||
connection slave;
|
||||
# 1452 = ER_NO_REFERENCED_ROW_2
|
||||
--let $slave_sql_errno= 1452
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
select * from ti2 order by b /* must be (2,2) */;
|
||||
set foreign_key_checks= 0;
|
||||
insert into ti1 set b=3;
|
||||
set foreign_key_checks= 1;
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
start slave sql_thread;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
set global slave_exec_mode='STRICT';
|
||||
|
||||
connection master;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
select * from ti2 order by b /* must be (2,2),(3,3) */;
|
||||
|
||||
#
|
||||
--echo *** other errors
|
||||
#
|
||||
|
||||
# dup key insert
|
||||
|
||||
#connection slave;
|
||||
--echo *** conspiring query
|
||||
insert into ti1 set b=1;
|
||||
|
||||
connection master;
|
||||
insert into ti1 set b=1 /* offending write event */;
|
||||
|
||||
--echo *** slave must stop (Trying to insert a dupliacte key)
|
||||
connection slave;
|
||||
# 1062 = ER_DUP_ENTRY
|
||||
--let $slave_sql_errno= 1062
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
set foreign_key_checks= 0;
|
||||
delete from ti1 where b=1;
|
||||
set foreign_key_checks= 1;
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
start slave sql_thread;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
set global slave_exec_mode='STRICT';
|
||||
|
||||
# key not found
|
||||
|
||||
connection master;
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
CREATE TABLE t2 (a INT);
|
||||
INSERT INTO t1 VALUES (-1),(-2),(-3);
|
||||
INSERT INTO t2 VALUES (-1),(-2),(-3);
|
||||
sync_slave_with_master;
|
||||
|
||||
#connection slave;
|
||||
DELETE FROM t1 WHERE a = -2;
|
||||
DELETE FROM t2 WHERE a = -2;
|
||||
connection master;
|
||||
DELETE FROM t1 WHERE a = -2;
|
||||
|
||||
--echo *** slave must stop (Key was not found)
|
||||
connection slave;
|
||||
# 1032 = ER_KEY_NOT_FOUND
|
||||
--let $slave_sql_errno= 1032
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
start slave sql_thread;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
set global slave_exec_mode='STRICT';
|
||||
|
||||
connection master;
|
||||
DELETE FROM t2 WHERE a = -2;
|
||||
--echo *** slave must stop (Key was not found)
|
||||
connection slave;
|
||||
# 1032 = ER_KEY_NOT_FOUND
|
||||
--let $slave_sql_errno= 1032
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
start slave sql_thread;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
set global slave_exec_mode='STRICT';
|
||||
|
||||
UPDATE t1 SET a = 1 WHERE a = -1;
|
||||
UPDATE t2 SET a = 1 WHERE a = -1;
|
||||
|
||||
connection master;
|
||||
UPDATE t1 SET a = 1 WHERE a = -1;
|
||||
|
||||
--echo *** slave must stop (Key was not found)
|
||||
connection slave;
|
||||
# 1032 = ER_KEY_NOT_FOUND
|
||||
--let $slave_sql_errno= 1032
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
start slave sql_thread;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
set global slave_exec_mode='STRICT';
|
||||
|
||||
|
||||
connection master;
|
||||
UPDATE t2 SET a = 1 WHERE a = -1;
|
||||
|
||||
--echo *** slave must stop (Key was not found)
|
||||
connection slave;
|
||||
# 1032 = ER_KEY_NOT_FOUND
|
||||
--let $slave_sql_errno= 1032
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
start slave sql_thread;
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
SET @@global.slave_exec_mode= @old_slave_exec_mode;
|
||||
|
||||
# cleanup for bug#31609 tests
|
||||
|
||||
connection master;
|
||||
set @@session.binlog_format= @save_binlog_format;
|
||||
drop table t1,t2,ti2,ti1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
||||
--echo *** end of tests
|
||||
60
build/lib/mysql/mysql-test/suite/rpl/t/rpl_ignore_grant.test
Normal file
60
build/lib/mysql/mysql-test/suite/rpl/t/rpl_ignore_grant.test
Normal file
@@ -0,0 +1,60 @@
|
||||
# Test that GRANT is not replicated to the slave
|
||||
# when --replicate-wild-ignore-table=mysql.%
|
||||
# In BUG#980, this test would _randomly_ fail.
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
# do not be influenced by other tests.
|
||||
connection master;
|
||||
delete from mysql.user where user=_binary'rpl_ignore_grant';
|
||||
delete from mysql.db where user=_binary'rpl_ignore_grant';
|
||||
flush privileges;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# as these DELETE were not replicated, we need to do them manually on the
|
||||
# slave.
|
||||
delete from mysql.user where user=_binary'rpl_ignore_grant';
|
||||
delete from mysql.db where user=_binary'rpl_ignore_grant';
|
||||
flush privileges;
|
||||
|
||||
# test non-replication of GRANT
|
||||
connection master;
|
||||
grant select on *.* to rpl_ignore_grant@localhost;
|
||||
grant drop on test.* to rpl_ignore_grant@localhost;
|
||||
show grants for rpl_ignore_grant@localhost;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
--error 1141 #("no such grant for user")
|
||||
show grants for rpl_ignore_grant@localhost;
|
||||
# check it another way
|
||||
select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
|
||||
select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
|
||||
|
||||
# test non-replication of SET PASSWORD
|
||||
# first force creation of the user on slave (because as the user does not exist
|
||||
# on slave, the SET PASSWORD may be replicated but silently do nothing; this is
|
||||
# not what we want; we want it to be not-replicated).
|
||||
grant select on *.* to rpl_ignore_grant@localhost;
|
||||
connection master;
|
||||
set password for rpl_ignore_grant@localhost=password("does it work?");
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
|
||||
|
||||
# clear what we have done, to not influence other tests.
|
||||
connection master;
|
||||
delete from mysql.user where user=_binary'rpl_ignore_grant';
|
||||
delete from mysql.db where user=_binary'rpl_ignore_grant';
|
||||
flush privileges;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
delete from mysql.user where user=_binary'rpl_ignore_grant';
|
||||
delete from mysql.db where user=_binary'rpl_ignore_grant';
|
||||
flush privileges;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,52 @@
|
||||
# test verifies that REVOKE must not be replicated when
|
||||
# slave server starts with --replicate-wild-ignore-table=mysql.%
|
||||
# the option is set in rpl_ignore_revoke-slave.opt
|
||||
# The first part of BUG#9483 for GRANT is checked by
|
||||
# existed specific rpl_ignore_grant test case (BUG#980)
|
||||
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
### CLEAN-UP: create an account and manually duplicate it on the slave
|
||||
|
||||
connection master;
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
revoke select on *.* from 'user_foo'@'%';
|
||||
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
|
||||
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
revoke select on *.* from 'user_foo'@'%';
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
|
||||
|
||||
|
||||
### TEST
|
||||
|
||||
#connection slave;
|
||||
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
|
||||
|
||||
connection master;
|
||||
revoke select on *.* from 'user_foo';
|
||||
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
|
||||
|
||||
sync_slave_with_master;
|
||||
#connection slave;
|
||||
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
|
||||
|
||||
### CLEAN-UP
|
||||
|
||||
connection slave;
|
||||
--disable_abort_on_error
|
||||
revoke select on *.* FROM 'user_foo';
|
||||
--enable_abort_on_error
|
||||
|
||||
connection master;
|
||||
delete from mysql.user where user="user_foo";
|
||||
sync_slave_with_master;
|
||||
|
||||
# Since changes to mysql.* are ignored, the revoke need to
|
||||
# be done on slave as well
|
||||
delete from mysql.user where user="user_foo";
|
||||
--source include/rpl_end.inc
|
||||
181
build/lib/mysql/mysql-test/suite/rpl/t/rpl_ignore_table.test
Normal file
181
build/lib/mysql/mysql-test/suite/rpl/t/rpl_ignore_table.test
Normal file
@@ -0,0 +1,181 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# BUG#16487
|
||||
#
|
||||
# Requirement:
|
||||
# Multi-updates on ignored tables should not fail even if the slave does
|
||||
# not have the ignored tables.
|
||||
#
|
||||
# Note table t1, t2, and t3 are ignored in the option file to this test.
|
||||
#
|
||||
|
||||
--echo **** Test case for BUG#16487 ****
|
||||
--echo **** Master ****
|
||||
connection master;
|
||||
CREATE TABLE test.t4 (a int);
|
||||
CREATE TABLE test.t1 (a int);
|
||||
|
||||
# Expect: The row must *not* by updated on slave, since t1 is ignored
|
||||
UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5;
|
||||
|
||||
--echo **** Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t4;
|
||||
|
||||
# Cleanup
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t4;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
#
|
||||
# Bug#25482 GRANT statements are not replicated if
|
||||
# you use "replicate-ignore-table"
|
||||
#
|
||||
|
||||
--echo **** Test case for BUG#25482 ****
|
||||
--echo **** Adding GRANTS on master ****
|
||||
|
||||
connection master;
|
||||
create table test.t1(a int);
|
||||
create table test.t4(a int);
|
||||
|
||||
# Simple user that should not replicate
|
||||
GRANT SELECT ON test.t1 TO mysqltest1@localhost;
|
||||
|
||||
# Partial replicate
|
||||
GRANT INSERT ON test.t4 TO mysqltest2@localhost;
|
||||
GRANT select, update, insert, references on t1
|
||||
to mysqltest2@localhost;
|
||||
|
||||
# Partial replicate 2
|
||||
GRANT SELECT ON test.* TO mysqltest3@localhost;
|
||||
GRANT INSERT ON test.t4 TO mysqltest3@localhost;
|
||||
GRANT select(a), update(a), insert(a), references(a) on t4
|
||||
to mysqltest3@localhost;
|
||||
|
||||
# Create another database and table
|
||||
create database mysqltest2;
|
||||
create table mysqltest2.t2 (id int);
|
||||
# Create a grant that should replicate
|
||||
GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
|
||||
|
||||
# Create a grant manually
|
||||
insert into mysql.user (user, host) values ("mysqltest5", "somehost");
|
||||
|
||||
# Partial replicate 3 with *.*
|
||||
GRANT SELECT ON *.* TO mysqltest6@localhost;
|
||||
GRANT INSERT ON *.* TO mysqltest6@localhost;
|
||||
GRANT INSERT ON test.* TO mysqltest6@localhost;
|
||||
GRANT INSERT ON test.t1 TO mysqltest6@localhost;
|
||||
|
||||
show grants for mysqltest1@localhost;
|
||||
show grants for mysqltest2@localhost;
|
||||
show grants for mysqltest3@localhost;
|
||||
show grants for mysqltest4@localhost;
|
||||
show grants for mysqltest6@localhost;
|
||||
|
||||
flush privileges;
|
||||
show grants for mysqltest5@somehost;
|
||||
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo **** Checking grants on slave ****
|
||||
|
||||
# Check that grants are replicated to slave
|
||||
show grants for mysqltest2@localhost;
|
||||
show grants for mysqltest3@localhost;
|
||||
show grants for mysqltest4@localhost;
|
||||
show grants for mysqltest5@somehost;
|
||||
show grants for mysqltest6@localhost;
|
||||
|
||||
# mysqltest1 should not be on slave
|
||||
--error 1141
|
||||
show grants for mysqltest1@localhost;
|
||||
|
||||
--echo **** Revoking grants on master ****
|
||||
connection master;
|
||||
REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
|
||||
REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
|
||||
REVOKE select(a) on t4
|
||||
from mysqltest3@localhost;
|
||||
|
||||
show grants for mysqltest1@localhost;
|
||||
show grants for mysqltest3@localhost;
|
||||
show grants for mysqltest4@localhost;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo **** Checking grants on slave ****
|
||||
|
||||
# mysqltest1 should not be on slave
|
||||
--error 1141
|
||||
show grants for mysqltest1@localhost;
|
||||
show grants for mysqltest3@localhost;
|
||||
show grants for mysqltest4@localhost;
|
||||
|
||||
# Cleanup
|
||||
# connection slave;
|
||||
# BUG31552 changes idempotency is not default any longer
|
||||
# In order the following `delete from mysql.user',
|
||||
# where mysqltest1 does not exist on slave,
|
||||
# to succeed on slave the mode is temporarily changed
|
||||
set global slave_exec_mode='IDEMPOTENT';
|
||||
call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table mysql.* Error_code: 1032");
|
||||
|
||||
connection master;
|
||||
drop table t1, mysqltest2.t2;
|
||||
drop table t4;
|
||||
drop database mysqltest2;
|
||||
delete from mysql.user where user like "mysqltest%";
|
||||
delete from mysql.db where user like "mysqltest%";
|
||||
#
|
||||
# BUG 27606 causes failure to replicate this statement
|
||||
# move it to slave instead
|
||||
#delete from mysql.tables_priv where user like "mysqltest%";
|
||||
delete from mysql.columns_priv where user like "mysqltest%";
|
||||
|
||||
sync_slave_with_master;
|
||||
# bug#31552: do not restore the mode here but later in order
|
||||
# to succeed with yet the following delete from mysql.tables_priv
|
||||
|
||||
#BUG27606
|
||||
delete from mysql.tables_priv where user like "mysqltest%";
|
||||
|
||||
connection master;
|
||||
|
||||
#BUG27606
|
||||
delete from mysql.tables_priv where user like "mysqltest%";
|
||||
|
||||
#
|
||||
# bug#22877 replication character sets get out of sync
|
||||
# using replicate-wild-ignore-table
|
||||
#
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t5;
|
||||
--enable_warnings
|
||||
CREATE TABLE t5 (
|
||||
word varchar(50) collate utf8_unicode_ci NOT NULL default ''
|
||||
) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
SET @@session.character_set_client=33,@@session.collation_connection=192;
|
||||
CREATE TEMPORARY TABLE tmptbl504451f4258$1 (id INT NOT NULL) ENGINE=MEMORY;
|
||||
INSERT INTO t5 (word) VALUES ('TEST’');
|
||||
SELECT HEX(word) FROM t5;
|
||||
sync_slave_with_master;
|
||||
set @@global.slave_exec_mode= default; # bug#31552 comments above
|
||||
connection slave;
|
||||
SELECT HEX(word) FROM t5;
|
||||
--error 1146
|
||||
SELECT * FROM tmptbl504451f4258$1;
|
||||
connection master;
|
||||
DROP TABLE t5;
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/force_restart.inc
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,39 @@
|
||||
# This one assumes we are ignoring updates on table mysqltest_foo, but doing
|
||||
# the ones on all other tables
|
||||
|
||||
source include/master-slave.inc;
|
||||
connection slave;
|
||||
|
||||
#
|
||||
# For this test we must be in the test database
|
||||
#
|
||||
use test;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists mysqltest_foo;
|
||||
drop table if exists mysqltest_bar;
|
||||
--enable_warnings
|
||||
|
||||
create table mysqltest_foo (n int);
|
||||
insert into mysqltest_foo values(4);
|
||||
connection master;
|
||||
use test;
|
||||
create table mysqltest_foo (n int);
|
||||
insert into mysqltest_foo values(5);
|
||||
create table mysqltest_bar (m int);
|
||||
insert into mysqltest_bar values(15);
|
||||
create table t1 (k int);
|
||||
insert into t1 values(55);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
|
||||
connection master;
|
||||
drop table mysqltest_foo,mysqltest_bar,t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
drop table mysqltest_foo,mysqltest_bar,t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
41
build/lib/mysql/mysql-test/suite/rpl/t/rpl_incident.test
Normal file
41
build/lib/mysql/mysql-test/suite/rpl/t/rpl_incident.test
Normal file
@@ -0,0 +1,41 @@
|
||||
--source include/master-slave.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
--echo **** On Master ****
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SELECT * FROM t1;
|
||||
|
||||
# This will generate an incident log event and store it in the binary
|
||||
# log before the replace statement.
|
||||
REPLACE INTO t1 VALUES (4);
|
||||
--save_master_pos
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection slave;
|
||||
# Wait until SQL thread stops with error LOST_EVENT on master
|
||||
call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master.* 1590");
|
||||
let $slave_sql_errno= 1590;
|
||||
let $show_slave_sql_error= 1;
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
|
||||
# The 4 should not be inserted into the table, since the incident log
|
||||
# event should have stop the slave.
|
||||
--echo **** On Slave ****
|
||||
SELECT * FROM t1;
|
||||
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
||||
START SLAVE;
|
||||
--sync_with_master
|
||||
|
||||
# Now, we should have inserted the row into the table and the slave
|
||||
# should be running. We should also have rotated to a new binary log.
|
||||
|
||||
SELECT * FROM t1;
|
||||
source include/check_slave_is_running.inc;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
--sync_slave_with_master
|
||||
--source include/rpl_end.inc
|
||||
34
build/lib/mysql/mysql-test/suite/rpl/t/rpl_init_slave.test
Normal file
34
build/lib/mysql/mysql-test/suite/rpl/t/rpl_init_slave.test
Normal file
@@ -0,0 +1,34 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# Test of init_slave variable
|
||||
#
|
||||
|
||||
set global max_connections=151;
|
||||
|
||||
connection slave;
|
||||
source include/stop_slave.inc;
|
||||
source include/start_slave.inc;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
show variables like 'init_slave';
|
||||
show variables like 'max_connections';
|
||||
reset master;
|
||||
connection master;
|
||||
show variables like 'init_slave';
|
||||
show variables like 'max_connections';
|
||||
sync_slave_with_master;
|
||||
# Save variable value
|
||||
set @my_global_init_connect= @@global.init_connect;
|
||||
set global init_connect="set @c=1";
|
||||
show variables like 'init_connect';
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Restore changed global variable
|
||||
set global init_connect= @my_global_init_connect;
|
||||
set global max_connections= default;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,89 @@
|
||||
######################################################################
|
||||
# Some errors that cause the slave SQL thread to stop are not shown in
|
||||
# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
|
||||
# is only in the server's error log.
|
||||
#
|
||||
# Two failures and their respective reporting are verified:
|
||||
#
|
||||
# 1 - Failures during slave thread initialization
|
||||
# 2 - Failures while processing queries passed through the init_slave
|
||||
# option.
|
||||
#
|
||||
# In order to check the first type of failure, we inject a fault in the
|
||||
# SQL/IO Threads through SET GLOBAL debug.
|
||||
#
|
||||
# To check the second type, we set @@global.init_slave to an invalid
|
||||
# command thus preventing the initialization of the SQL Thread.
|
||||
#
|
||||
# Obs:
|
||||
# 1 - Note that testing failures while initializing the relay log position
|
||||
# is hard as the same function is called before the code reaches the point
|
||||
# that we want to test.
|
||||
#
|
||||
# 2 - This test does not target failures that are reported while applying
|
||||
# events such as duplicate keys, errors while reading the relay-log.bin*,
|
||||
# etc. Such errors are already checked on other tests.
|
||||
######################################################################
|
||||
|
||||
######################################################################
|
||||
# Configuring the Environment
|
||||
######################################################################
|
||||
source include/have_debug.inc;
|
||||
source include/master-slave.inc;
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
connection slave;
|
||||
|
||||
--disable_warnings
|
||||
stop slave;
|
||||
--enable_warnings
|
||||
reset slave;
|
||||
|
||||
######################################################################
|
||||
# Injecting faults in the threads' initialization
|
||||
######################################################################
|
||||
connection slave;
|
||||
|
||||
# Set debug flags on slave to force errors to occur
|
||||
SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
|
||||
|
||||
start slave;
|
||||
|
||||
#
|
||||
# slave is going to stop because of emulated failures
|
||||
# but there won't be any crashes nor asserts hit.
|
||||
#
|
||||
# 1593 = ER_SLAVE_FATAL_ERROR
|
||||
--let $slave_sql_errno= 1593
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
call mtr.add_suppression("Failed during slave.* thread initialization");
|
||||
|
||||
SET GLOBAL debug= "";
|
||||
|
||||
######################################################################
|
||||
# Injecting faults in the init_slave option
|
||||
######################################################################
|
||||
connection slave;
|
||||
|
||||
reset slave;
|
||||
|
||||
SET GLOBAL init_slave= "garbage";
|
||||
|
||||
start slave;
|
||||
# 1064 = ER_PARSE_ERROR
|
||||
--let $slave_sql_errno= 1064
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
######################################################################
|
||||
# Clean up
|
||||
######################################################################
|
||||
SET GLOBAL init_slave= "";
|
||||
|
||||
# Clean up Last_SQL_Error
|
||||
--source include/stop_slave_io.inc
|
||||
RESET SLAVE;
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
125
build/lib/mysql/mysql-test/suite/rpl/t/rpl_innodb.test
Normal file
125
build/lib/mysql/mysql-test/suite/rpl/t/rpl_innodb.test
Normal file
@@ -0,0 +1,125 @@
|
||||
# File for specialities regarding replication from or to InnoDB
|
||||
# tables.
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
#
|
||||
# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
|
||||
#
|
||||
connection master;
|
||||
CREATE TABLE t4 (
|
||||
id INT(5) unsigned NOT NULL auto_increment,
|
||||
name varchar(15) NOT NULL default '',
|
||||
number varchar(35) NOT NULL default 'default',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY unique_rec (name,number)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--disable_warnings
|
||||
LOAD DATA
|
||||
INFILE '../../std_data/loaddata_pair.dat'
|
||||
REPLACE INTO TABLE t4
|
||||
(name,number);
|
||||
--enable_warnings
|
||||
SELECT * FROM t4;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t4;
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
LOAD DATA
|
||||
INFILE '../../std_data/loaddata_pair.dat'
|
||||
REPLACE INTO TABLE t4
|
||||
(name,number);
|
||||
--enable_warnings
|
||||
SELECT * FROM t4;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t4;
|
||||
|
||||
connection master;
|
||||
--disable_query_log
|
||||
DROP TABLE t4;
|
||||
--enable_query_log
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
|
||||
# on master
|
||||
#
|
||||
#Note Matthias: to be merged to rpl_ddl.test
|
||||
|
||||
--source include/not_ndb_default.inc
|
||||
|
||||
FLUSH LOGS;
|
||||
sync_slave_with_master;
|
||||
FLUSH LOGS;
|
||||
connection master;
|
||||
let $engine_type= "InnoDB";
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
|
||||
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
|
||||
# We want to verify that the following transactions are written to the
|
||||
# binlog, despite the transaction is rolled back. (The should be
|
||||
# written to the binlog since they contain non-transactional DROP
|
||||
# TEMPORARY TABLE). To see that, we use the auxiliary table t1, which
|
||||
# is transactional (InnoDB) on master and MyISAM on slave. t1 should
|
||||
# be transactional on master so that the insert into t1 does not cause
|
||||
# the transaction to be logged. Since t1 is non-transactional on
|
||||
# slave, the change will not be rolled back, so the inserted rows will
|
||||
# stay in t1 and we can verify that the transaction was replicated.
|
||||
ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
|
||||
SHOW CREATE TABLE mysqltest1.t1;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
INSERT INTO mysqltest1.t1 SET f1= 1;
|
||||
DROP TEMPORARY TABLE mysqltest1.tmp;
|
||||
ROLLBACK;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
# Must return no rows here
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
|
||||
INSERT INTO mysqltest1.t1 SET f1= 2;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
|
||||
ROLLBACK;
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
# Must return no rows here
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
# t1 has two rows here: the transaction not rolled back since t1 uses MyISAM
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
FLUSH LOGS;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
FLUSH LOGS;
|
||||
|
||||
DROP DATABASE mysqltest1;
|
||||
--source include/rpl_end.inc
|
||||
|
||||
--echo End of 5.1 tests
|
||||
153
build/lib/mysql/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test
Normal file
153
build/lib/mysql/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test
Normal file
@@ -0,0 +1,153 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_partition.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
# Set the default connection to 'master'
|
||||
|
||||
--vertical_results
|
||||
|
||||
let $engine_type= 'innodb';
|
||||
|
||||
######## Creat Table Section #########
|
||||
use test;
|
||||
|
||||
eval CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE test.bykey_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE=$engine_type
|
||||
PARTITION BY KEY(id) partitions 5;
|
||||
|
||||
eval CREATE TABLE test.byrange_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE=$engine_type
|
||||
PARTITION BY RANGE(id)
|
||||
SUBPARTITION BY hash(id) subpartitions 2
|
||||
(PARTITION pa1 values less than (10),
|
||||
PARTITION pa2 values less than (20),
|
||||
PARTITION pa3 values less than (30),
|
||||
PARTITION pa4 values less than (40),
|
||||
PARTITION pa5 values less than (50),
|
||||
PARTITION pa6 values less than (60),
|
||||
PARTITION pa7 values less than (70),
|
||||
PARTITION pa8 values less than (80),
|
||||
PARTITION pa9 values less than (90),
|
||||
PARTITION pa10 values less than (100),
|
||||
PARTITION pa11 values less than MAXVALUE);
|
||||
|
||||
######## Create SPs, Functions, Views and Triggers Section ##############
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.proc_norm()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SET local_time= NOW();
|
||||
SET cur_user= CURRENT_USER();
|
||||
SET local_uuid= UUID();
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO test.regular_tbl VALUES (NULL, NOW(), USER() , UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
SELECT MAX(id) FROM test.regular_tbl INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM test.regular_tbl WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE test.proc_bykey()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SET local_time= NOW();
|
||||
SET cur_user= CURRENT_USER();
|
||||
SET local_uuid= UUID();
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO test.bykey_tbl VALUES (NULL, NOW(), USER() , UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
SELECT MAX(id) FROM test.bykey_tbl INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM test.bykey_tbl WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE test.proc_byrange()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SET local_time= NOW();
|
||||
SET cur_user = CURRENT_USER();
|
||||
SET local_uuid=UUID();
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO test.byrange_tbl VALUES (NULL, NOW(), USER(), UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
SELECT MAX(id) FROM test.byrange_tbl INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM test.byrange_tbl WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
############ Finish Setup Section ###################
|
||||
|
||||
|
||||
############ Test Section ###################
|
||||
|
||||
CALL test.proc_norm();
|
||||
SELECT count(*) as "Master regular" FROM test.regular_tbl;
|
||||
CALL test.proc_bykey();
|
||||
SELECT count(*) as "Master bykey" FROM test.bykey_tbl;
|
||||
CALL test.proc_byrange();
|
||||
SELECT count(*) as "Master byrange" FROM test.byrange_tbl;
|
||||
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
show create table test.byrange_tbl;
|
||||
SELECT count(*) "Slave norm" FROM test.regular_tbl;
|
||||
SELECT count(*) "Slave bykey" FROM test.bykey_tbl;
|
||||
SELECT count(*) "Slave byrange" FROM test.byrange_tbl;
|
||||
|
||||
###### CLEAN UP SECTION ##############
|
||||
|
||||
connection master;
|
||||
DROP PROCEDURE test.proc_norm;
|
||||
DROP PROCEDURE test.proc_bykey;
|
||||
DROP PROCEDURE test.proc_byrange;
|
||||
DROP TABLE test.regular_tbl;
|
||||
DROP TABLE test.bykey_tbl;
|
||||
DROP TABLE test.byrange_tbl;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,66 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
# Set the default connection to 'master'
|
||||
|
||||
--vertical_results
|
||||
|
||||
#let $engine_type= 'myisam';
|
||||
let $engine_type= 'innodb';
|
||||
|
||||
######## Creat Table Section #########
|
||||
use test;
|
||||
|
||||
eval CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE=$engine_type;
|
||||
|
||||
######## Create SPs, Functions, Views and Triggers Section ##############
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.proc_norm()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SET local_time= NOW();
|
||||
SET cur_user= CURRENT_USER();
|
||||
SET local_uuid= UUID();
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO test.regular_tbl VALUES (NULL, NOW(), USER() , UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
SELECT MAX(id) FROM test.regular_tbl INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM test.regular_tbl WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
############ Finish Setup Section ###################
|
||||
|
||||
|
||||
############ Test Section ###################
|
||||
|
||||
CALL test.proc_norm();
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
###### CLEAN UP SECTION ##############
|
||||
|
||||
connection master;
|
||||
DROP PROCEDURE test.proc_norm;
|
||||
DROP TABLE test.regular_tbl;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#########################################
|
||||
# Purpose: testing the replication in mixed mode
|
||||
# Requirements: define binlog format for mysqld as in example below:
|
||||
# ./mysql-test-run.pl --mysqld=--binlog-format=mixed
|
||||
#########################################
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= innodb;
|
||||
--source suite/rpl/include/rpl_mixed_ddl.inc
|
||||
@@ -0,0 +1,9 @@
|
||||
#########################################
|
||||
# Purpose: testing the replication in mixed mode
|
||||
# Requirements: define binlog format for mysqld as in example below:
|
||||
# ./mysql-test-run.pl --mysqld=--binlog-format=mixed
|
||||
#########################################
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= innodb;
|
||||
--source suite/rpl/include/rpl_mixed_dml.inc
|
||||
41
build/lib/mysql/mysql-test/suite/rpl/t/rpl_insert.test
Normal file
41
build/lib/mysql/mysql-test/suite/rpl/t/rpl_insert.test
Normal file
@@ -0,0 +1,41 @@
|
||||
--echo #
|
||||
--echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog
|
||||
--echo #
|
||||
|
||||
--source include/master-slave.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/not_windows.inc
|
||||
|
||||
--disable_warnings
|
||||
CREATE SCHEMA IF NOT EXISTS mysqlslap;
|
||||
USE mysqlslap;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (id INT, name VARCHAR(64));
|
||||
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')";
|
||||
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
|
||||
|
||||
# Wait until all the 5000 inserts has been inserted into the table
|
||||
let $wait_condition= SELECT COUNT(*) = 5000 FROM mysqlslap.t1;
|
||||
source include/wait_condition.inc;
|
||||
SELECT COUNT(*) FROM mysqlslap.t1;
|
||||
|
||||
connection slave;
|
||||
# Wait until all the 5000 inserts has been inserted into the table
|
||||
let $wait_condition= SELECT COUNT(*) = 5000 FROM mysqlslap.t1;
|
||||
source include/wait_condition.inc;
|
||||
SELECT COUNT(*) FROM mysqlslap.t1;
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
|
||||
connection master;
|
||||
USE test;
|
||||
DROP SCHEMA mysqlslap;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,14 @@
|
||||
#########################################
|
||||
# Wrapper for rpl_insert_duplicate.test #
|
||||
#########################################
|
||||
-- source include/master-slave.inc
|
||||
-- source include/have_innodb.inc
|
||||
#-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
|
||||
let $engine_type=innodb;
|
||||
-- source extra/rpl_tests/rpl_insert_duplicate.test
|
||||
|
||||
let $engine_type=myisam;
|
||||
-- source extra/rpl_tests/rpl_insert_duplicate.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,7 @@
|
||||
#################################
|
||||
# Wrapper for rpl_insert_id.test#
|
||||
#################################
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
let $engine_type=myisam;
|
||||
-- source extra/rpl_tests/rpl_insert_id.test
|
||||
@@ -0,0 +1,7 @@
|
||||
#################################
|
||||
# Wrapper for rpl_insert_id.test#
|
||||
#################################
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
let $engine_type=innodb;
|
||||
-- source extra/rpl_tests/rpl_insert_id_pk.test
|
||||
@@ -0,0 +1,14 @@
|
||||
#####################################
|
||||
# Wrapper for rpl_insert_ignore.test#
|
||||
#####################################
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
-- let $engine_type=innodb
|
||||
-- source extra/rpl_tests/rpl_insert_ignore.test
|
||||
|
||||
-- let $engine_type=myisam
|
||||
-- source extra/rpl_tests/rpl_insert_ignore.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,20 @@
|
||||
# Testcase for BUG#10456 - INSERT INTO ... SELECT violating a primary key
|
||||
# breaks replication
|
||||
|
||||
-- source include/master-slave.inc
|
||||
connection master;
|
||||
|
||||
create table t1 (n int not null primary key);
|
||||
insert into t1 values (1);
|
||||
create table t2 (n int);
|
||||
insert into t2 values (1);
|
||||
insert ignore into t1 select * from t2;
|
||||
insert into t1 values (2);
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
311
build/lib/mysql/mysql-test/suite/rpl/t/rpl_invoked_features.test
Normal file
311
build/lib/mysql/mysql-test/suite/rpl/t/rpl_invoked_features.test
Normal file
@@ -0,0 +1,311 @@
|
||||
#########################################
|
||||
# Author: Serge Kozlov skozlov@mysql.com
|
||||
# Date: 04/25/2007
|
||||
# Purpose: Testing Invocation and Invoked
|
||||
# Features for Replication.
|
||||
#########################################
|
||||
|
||||
--source include/master-slave.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# --disable_warnings/--enable_warnings added before/after query
|
||||
# if one uses UUID() function because we need to avoid warnings
|
||||
# for STATEMENT binlog format
|
||||
|
||||
# Non-transactional engine
|
||||
--let $engine_type= myisam
|
||||
|
||||
# Transactional engine
|
||||
--let $engine_type2= innodb
|
||||
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
|
||||
USE test;
|
||||
--disable_warnings
|
||||
DROP VIEW IF EXISTS v1,v11;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p11;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP EVENT IF EXISTS e1;
|
||||
DROP EVENT IF EXISTS e11;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
#
|
||||
# Prepare objects (tables etc)
|
||||
#
|
||||
|
||||
# Create tables
|
||||
|
||||
--echo
|
||||
eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type;
|
||||
INSERT INTO t1 VALUES (1,1,'1');
|
||||
--disable_warnings
|
||||
INSERT INTO t1 VALUES (2,2,UUID());
|
||||
--enable_warnings
|
||||
eval CREATE TABLE t2 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type;
|
||||
INSERT INTO t2 VALUES (1,1,'1');
|
||||
--disable_warnings
|
||||
INSERT INTO t2 VALUES (2,2,UUID());
|
||||
--enable_warnings
|
||||
|
||||
eval CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
|
||||
INSERT INTO t11 VALUES (1,1,'1');
|
||||
--disable_warnings
|
||||
INSERT INTO t11 VALUES (2,2,UUID());
|
||||
--enable_warnings
|
||||
eval CREATE TABLE t12 (a INT UNIQUE, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
|
||||
INSERT INTO t12 VALUES (1,1,'1');
|
||||
--disable_warnings
|
||||
INSERT INTO t12 VALUES (2,2,UUID());
|
||||
--enable_warnings
|
||||
|
||||
# Create invoked features
|
||||
--echo
|
||||
# Create view for tables t1,t11
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
CREATE VIEW v11 AS SELECT * FROM t11;
|
||||
|
||||
# Create triggers for t1,t11
|
||||
DELIMITER |;
|
||||
|
||||
CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t2 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
INSERT INTO t3 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER t1_tr2 BEFORE UPDATE ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE t2 SET c = '';
|
||||
UPDATE t3 SET c = '';
|
||||
END|
|
||||
|
||||
CREATE TRIGGER t11_tr1 BEFORE INSERT ON t11 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t12 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
INSERT INTO t13 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER t11_tr2 BEFORE UPDATE ON t11 FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE t12 SET c = '';
|
||||
UPDATE t13 SET c = '';
|
||||
END|
|
||||
|
||||
# Create events which will run every 1 sec
|
||||
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
|
||||
BEGIN
|
||||
ALTER EVENT e1 DISABLE;
|
||||
CALL p1(10, '');
|
||||
END|
|
||||
|
||||
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
|
||||
BEGIN
|
||||
ALTER EVENT e11 DISABLE;
|
||||
CALL p11(10, '');
|
||||
END|
|
||||
|
||||
# Create functions and procedures used for events
|
||||
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
IF x > 5 THEN
|
||||
RETURN UUID();
|
||||
END IF;
|
||||
RETURN '';
|
||||
END|
|
||||
|
||||
CREATE FUNCTION f2 (x INT) RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
RETURN f1(x);
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
|
||||
BEGIN
|
||||
INSERT IGNORE INTO t1 VALUES (x,x,y);
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
|
||||
BEGIN
|
||||
INSERT IGNORE INTO t11 VALUES (x,x,y);
|
||||
END|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
|
||||
#
|
||||
# Start test case
|
||||
#
|
||||
|
||||
# Do some actions for non-transactional tables
|
||||
--echo
|
||||
CREATE TABLE t3 SELECT * FROM v1;
|
||||
INSERT INTO t1 VALUES (3,3,'');
|
||||
UPDATE t1 SET c='2' WHERE a = 1;
|
||||
--disable_warnings
|
||||
INSERT INTO t1 VALUES(4,4,f1(4));
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES (100,100,'');
|
||||
--disable_warnings
|
||||
CALL p1(5, UUID());
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES (101,101,'');
|
||||
--disable_warnings
|
||||
INSERT INTO t1 VALUES(6,6,f1(6));
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES (102,102,'');
|
||||
--disable_warnings
|
||||
INSERT INTO t1 VALUES(7,7,f2(7));
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES (103,103,'');
|
||||
|
||||
# Do some actions for transactional tables
|
||||
--echo
|
||||
CREATE TABLE t13 SELECT * FROM v11;
|
||||
INSERT INTO t11 VALUES (3,3,'');
|
||||
UPDATE t11 SET c='2' WHERE a = 1;
|
||||
--disable_warnings
|
||||
INSERT INTO t11 VALUES(4,4,f1(4));
|
||||
--enable_warnings
|
||||
INSERT INTO t11 VALUES (100,100,'');
|
||||
--disable_warnings
|
||||
CALL p11(5, UUID());
|
||||
--enable_warnings
|
||||
INSERT INTO t11 VALUES (101,101,'');
|
||||
--disable_warnings
|
||||
INSERT INTO t11 VALUES(6,6,f1(6));
|
||||
--enable_warnings
|
||||
INSERT INTO t11 VALUES (102,102,'');
|
||||
--disable_warnings
|
||||
INSERT INTO t11 VALUES(7,7,f2(7));
|
||||
--enable_warnings
|
||||
INSERT INTO t11 VALUES (103,103,'');
|
||||
|
||||
# Scheduler is on
|
||||
--echo
|
||||
# Temporally events fire sequentally due Bug#29020.
|
||||
SET GLOBAL EVENT_SCHEDULER = on;
|
||||
# Wait while events will executed
|
||||
ALTER EVENT e1 ENABLE;
|
||||
let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE t1.a = 10;
|
||||
--source include/wait_condition.inc
|
||||
ALTER EVENT e11 ENABLE;
|
||||
let $wait_condition= SELECT COUNT(*) = 1 FROM t11 WHERE t11.a = 10;
|
||||
--source include/wait_condition.inc
|
||||
SET GLOBAL EVENT_SCHEDULER = off;
|
||||
|
||||
# Check original objects
|
||||
--echo
|
||||
--sorted_result
|
||||
SHOW TABLES LIKE 't%';
|
||||
--sorted_result
|
||||
SELECT table_name FROM information_schema.views WHERE table_schema='test';
|
||||
--sorted_result
|
||||
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
|
||||
--sorted_result
|
||||
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
|
||||
--sorted_result
|
||||
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
|
||||
|
||||
# Check original data
|
||||
--echo
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT a,b FROM t1 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
SELECT a,b FROM t2 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t3;
|
||||
SELECT a,b FROM t3 ORDER BY a;
|
||||
SELECT a,b FROM v1 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t11;
|
||||
SELECT a,b FROM t11 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t12;
|
||||
SELECT a,b FROM t12 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t13;
|
||||
SELECT a,b FROM t13 ORDER BY a;
|
||||
SELECT a,b FROM v11 ORDER BY a;
|
||||
|
||||
--sync_slave_with_master slave
|
||||
|
||||
# Check replicated objects
|
||||
--echo
|
||||
--sorted_result
|
||||
SHOW TABLES LIKE 't%';
|
||||
--sorted_result
|
||||
SELECT table_name FROM information_schema.views WHERE table_schema='test';
|
||||
--sorted_result
|
||||
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
|
||||
--sorted_result
|
||||
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
|
||||
--sorted_result
|
||||
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
|
||||
|
||||
# Check replicated data
|
||||
--echo
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT a,b FROM t1 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
SELECT a,b FROM t2 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t3;
|
||||
SELECT a,b FROM t3 ORDER BY a;
|
||||
SELECT a,b FROM v1 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t11;
|
||||
SELECT a,b FROM t11 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t12;
|
||||
SELECT a,b FROM t12 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t13;
|
||||
SELECT a,b FROM t13 ORDER BY a;
|
||||
SELECT a,b FROM v11 ORDER BY a;
|
||||
|
||||
# Remove UUID() before comparing and sort tables
|
||||
|
||||
--connection master
|
||||
--echo
|
||||
UPDATE t1 SET c='';
|
||||
UPDATE t2 SET c='';
|
||||
UPDATE t3 SET c='';
|
||||
UPDATE t11 SET c='';
|
||||
UPDATE t12 SET c='';
|
||||
UPDATE t13 SET c='';
|
||||
|
||||
ALTER TABLE t3 ORDER BY a;
|
||||
ALTER TABLE t13 ORDER BY a;
|
||||
|
||||
--sync_slave_with_master slave
|
||||
|
||||
# Compare a data from master and slave
|
||||
--echo
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
|
||||
--diff_files $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
|
||||
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
|
||||
# Remove dumps
|
||||
--echo
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
|
||||
|
||||
# Remove tables,views,procedures,functions
|
||||
--connection master
|
||||
--echo
|
||||
DROP VIEW IF EXISTS v1,v11;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p11;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP EVENT IF EXISTS e1;
|
||||
DROP EVENT IF EXISTS e11;
|
||||
|
||||
--sync_slave_with_master slave
|
||||
|
||||
# End 5.1 test case
|
||||
--source include/rpl_end.inc
|
||||
357
build/lib/mysql/mysql-test/suite/rpl/t/rpl_killed_ddl.test
Normal file
357
build/lib/mysql/mysql-test/suite/rpl/t/rpl_killed_ddl.test
Normal file
@@ -0,0 +1,357 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# This test check if DDL statements are correctly binlogged when the
|
||||
# thread is killed
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Start a DDL query and kill it, check if the error code of the binlog
|
||||
# event is correct.
|
||||
#
|
||||
# DDL statements tested:
|
||||
# CREATE/ALTER/RENAME/DROP DATABASE
|
||||
# CREATE/ALTER/DROP EVENT
|
||||
# CREATE/ALTER/DROP FUNCTION
|
||||
# CREATE/ALTER/DROP PROCEDURE
|
||||
# CREATE/ALTER/DROP SERVER
|
||||
# CREATE/ALTER/RENAME/DROP TABLE
|
||||
# CREATE/DROP TRIGGER
|
||||
# CREATE/ALTER/DROP VIEW
|
||||
#
|
||||
# ==== Bugs =====
|
||||
#
|
||||
# BUG#37145
|
||||
#
|
||||
# ==== TODO ====
|
||||
#
|
||||
# There are some part of the test are temporarily disabled because of
|
||||
# the following bugs, please enable then once they get fixed:
|
||||
# - BUG#44041
|
||||
# - BUG#43353
|
||||
# - BUG#25705
|
||||
# - BUG#44171
|
||||
|
||||
source include/have_debug.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
# Use the DBUG_SYNC_POINT to make sure the thread running the DDL is
|
||||
# waiting before creating the query log event
|
||||
|
||||
let $debug_lock= "debug_lock.before_query_log_event";
|
||||
|
||||
######## INITIALIZATION ########
|
||||
|
||||
disable_warnings;
|
||||
DROP DATABASE IF EXISTS d1;
|
||||
DROP DATABASE IF EXISTS d2;
|
||||
DROP DATABASE IF EXISTS d3;
|
||||
DROP DATABASE IF EXISTS d4;
|
||||
DROP EVENT IF EXISTS e1;
|
||||
DROP EVENT IF EXISTS e2;
|
||||
DROP EVENT IF EXISTS e3;
|
||||
DROP EVENT IF EXISTS e4;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
DROP FUNCTION IF EXISTS f4;
|
||||
DROP SERVER IF EXISTS s1;
|
||||
DROP SERVER IF EXISTS s2;
|
||||
DROP SERVER IF EXISTS s3;
|
||||
DROP SERVER IF EXISTS s4;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
DROP TABLE IF EXISTS t4;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
DROP PROCEDURE IF EXISTS p4;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP TRIGGER IF EXISTS tr2;
|
||||
DROP TRIGGER IF EXISTS tr3;
|
||||
DROP TRIGGER IF EXISTS tr4;
|
||||
enable_warnings;
|
||||
|
||||
CREATE DATABASE d1;
|
||||
|
||||
CREATE EVENT e1
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
|
||||
DO INSERT INTO test.t1 VALUES (1);
|
||||
|
||||
CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
|
||||
RETURN 1;
|
||||
|
||||
DELIMITER //;
|
||||
CREATE PROCEDURE p1 (OUT rows INT)
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO rows FROM t1;
|
||||
END;
|
||||
//
|
||||
DELIMITER ;//
|
||||
|
||||
CREATE SERVER s1
|
||||
FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (USER 'user1', HOST '192.168.1.106', DATABASE 'test');
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t3 (a int);
|
||||
|
||||
DELIMITER //;
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1
|
||||
FOR EACH ROW BEGIN
|
||||
DELETE FROM t4 WHERE a=NEW.a;
|
||||
END;
|
||||
//
|
||||
DELIMITER ;//
|
||||
|
||||
CREATE INDEX i1 ON t1 (a);
|
||||
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 WHERE a < 100;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master1;
|
||||
let $connection_name= master1;
|
||||
let $connection_id= `SELECT CONNECTION_ID()`;
|
||||
|
||||
connection master;
|
||||
echo [on master];
|
||||
|
||||
# This will block the execution of a statement at the DBUG_SYNC_POINT
|
||||
# with given lock name
|
||||
if ($debug_lock)
|
||||
{
|
||||
disable_query_log;
|
||||
disable_result_log;
|
||||
eval SELECT IS_FREE_LOCK($debug_lock);
|
||||
eval SELECT GET_LOCK($debug_lock, 10);
|
||||
eval SELECT IS_FREE_LOCK($debug_lock);
|
||||
enable_query_log;
|
||||
enable_result_log;
|
||||
}
|
||||
|
||||
######## START TEST ########
|
||||
|
||||
connection master1;
|
||||
echo [on master1];
|
||||
|
||||
disable_warnings;
|
||||
|
||||
######## DATABASE ########
|
||||
|
||||
--let $rpl_diff_statement= SHOW DATABASES LIKE \'d%\'
|
||||
|
||||
send CREATE DATABASE d2;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# Temporarily disabled, see BUG#44041, the ALTER DATABASE can affect the
|
||||
# collation of other database on slave
|
||||
#send ALTER DATABASE d1
|
||||
# DEFAULT CHARACTER SET = 'utf8';
|
||||
#source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP DATABASE d1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP DATABASE IF EXISTS d2;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## EVENT ########
|
||||
|
||||
--let $rpl_diff_statement= SELECT event_name, event_body, execute_at FROM information_schema.events where event_name like \'e%\'
|
||||
|
||||
send CREATE EVENT e2
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
|
||||
DO INSERT INTO test.t1 VALUES (2);
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# Temporarily disabled because of BUG#44171, killing ALTER EVENT can
|
||||
# crash the server
|
||||
#send ALTER EVENT e1
|
||||
# ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 DAY;
|
||||
#source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP EVENT e1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP EVENT IF EXISTS e2;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## FUNCTION ########
|
||||
|
||||
--let $rpl_diff_statement= SHOW FUNCTION STATUS LIKE \'f%\'
|
||||
|
||||
send CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC
|
||||
RETURN 1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send ALTER FUNCTION f1 SQL SECURITY INVOKER;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# function f1 probably does not exist because the ALTER query was
|
||||
# killed
|
||||
send DROP FUNCTION f1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# function f2 probably does not exist because the CREATE query was
|
||||
# killed
|
||||
#
|
||||
# Temporarily disabled. Because of BUG#43353, KILL the query may
|
||||
# result in function not found, and for 5.1, DROP statements will be
|
||||
# logged if the function is not found on master, so the following DROP
|
||||
# FUNCTION statement may be interrupted and not drop the function on
|
||||
# master, but still get logged and executed on slave and cause
|
||||
# inconsistence. Also disable the following DROP PROCEDURE IF EXITS
|
||||
# below.
|
||||
#send DROP FUNCTION IF EXISTS f2;
|
||||
#source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## PROCEDURE ########
|
||||
|
||||
--let $rpl_diff_statement= SHOW PROCEDURE STATUS LIKE \'p%\'
|
||||
|
||||
DELIMITER //;
|
||||
send CREATE PROCEDURE p2 (OUT rows INT)
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO rows FROM t2;
|
||||
END;
|
||||
//
|
||||
DELIMITER ;//
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1';
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP PROCEDURE p1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# Temporarily disabled because of bug#43353, see comment above for DROP FUNCTION IF EXISTS
|
||||
#send DROP PROCEDURE IF EXISTS p2;
|
||||
#source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## TABLE ########
|
||||
|
||||
--let $rpl_diff_statement= SHOW TABLES LIKE \'t%\'
|
||||
|
||||
send CREATE TABLE t2 (b int);
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send ALTER TABLE t1 ADD (d int);
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send RENAME TABLE t3 TO t4;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## INDEX ########
|
||||
|
||||
--let $rpl_diff_statement= SHOW INDEX FROM t1
|
||||
|
||||
send CREATE INDEX i2 on t1 (a);
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP INDEX i1 on t1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
|
||||
######## SERVER ########
|
||||
|
||||
# Tempoarily disabled, see bug#25705
|
||||
|
||||
# --let $rpl_diff_statement= SELECT * FROM mysql.server WHERE name like \'s%\'
|
||||
|
||||
# send CREATE SERVER s2
|
||||
# FOREIGN DATA WRAPPER mysql
|
||||
# OPTIONS (USER 'user2', HOST '192.168.1.108', DATABASE 'test');
|
||||
# source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# send ALTER SERVER s1
|
||||
# OPTIONS (DATABASE 'test1');
|
||||
# source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# send DROP SERVER s1;
|
||||
# source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
# send DROP SERVER IF EXIST s1;
|
||||
# source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## TRIGGER ########
|
||||
|
||||
# Make sure table t4 exists
|
||||
connection master;
|
||||
CREATE TABLE IF NOT EXISTS t4 (a int);
|
||||
connection master1;
|
||||
|
||||
--let $rpl_diff_statement= SHOW TRIGGERS LIKE \'v%\'
|
||||
|
||||
DELIMITER //;
|
||||
send CREATE TRIGGER tr2 BEFORE INSERT ON t4
|
||||
FOR EACH ROW BEGIN
|
||||
DELETE FROM t1 WHERE a=NEW.a;
|
||||
END;
|
||||
//
|
||||
DELIMITER ;//
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP TRIGGER tr1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP TRIGGER IF EXISTS tr2;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## VIEW ########
|
||||
|
||||
--let $rpl_diff_statement= SHOW TABLES LIKE \'v%\'
|
||||
|
||||
send CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP VIEW v1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP VIEW IF EXISTS v2;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## DROP TABLE ########
|
||||
|
||||
--let $rpl_diff_statement= SHOW TABLES LIKE \'t%\'
|
||||
|
||||
send DROP TABLE t1;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
send DROP TABLE IF EXISTS t2;
|
||||
source include/kill_query_and_diff_master_slave.inc;
|
||||
|
||||
######## CLEAN UP ########
|
||||
|
||||
connection master;
|
||||
|
||||
# The DROP statements above are killed during the process, so they
|
||||
# does not make sure the objects are dropped.
|
||||
|
||||
disable_warnings;
|
||||
DROP DATABASE IF EXISTS d1;
|
||||
DROP DATABASE IF EXISTS d2;
|
||||
DROP DATABASE IF EXISTS d3;
|
||||
DROP DATABASE IF EXISTS d4;
|
||||
DROP EVENT IF EXISTS e1;
|
||||
DROP EVENT IF EXISTS e2;
|
||||
DROP EVENT IF EXISTS e3;
|
||||
DROP EVENT IF EXISTS e4;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
DROP FUNCTION IF EXISTS f4;
|
||||
DROP SERVER IF EXISTS s1;
|
||||
DROP SERVER IF EXISTS s2;
|
||||
DROP SERVER IF EXISTS s3;
|
||||
DROP SERVER IF EXISTS s4;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
DROP TABLE IF EXISTS t4;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
DROP PROCEDURE IF EXISTS p4;
|
||||
enable_warnings;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,106 @@
|
||||
# Test to see if slave can detect certain known bugs present
|
||||
# on the master, and appropriately decides to stop
|
||||
# (assuming the bug is fixed in the slave, slave cannot of course
|
||||
# imitate the bug, so it has to stop).
|
||||
|
||||
source include/have_debug.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
# Currently only statement-based-specific bugs are here
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
|
||||
#
|
||||
# This is to test that slave properly detects if
|
||||
# master may suffer from:
|
||||
# BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values"
|
||||
# (i.e. on master, INSERT ON DUPLICATE KEY UPDATE is used and manipulates
|
||||
# an auto_increment column, and is binlogged statement-based).
|
||||
#
|
||||
|
||||
# testcase with INSERT VALUES
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
|
||||
UNIQUE(b));
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
|
||||
SELECT * FROM t1;
|
||||
connection slave;
|
||||
|
||||
# show the error message
|
||||
#1105 = ER_UNKNOWN_ERROR
|
||||
--let $slave_sql_errno= 1105
|
||||
--let $show_slave_sql_error= 1
|
||||
call mtr.add_suppression("Slave SQL.*suffer.*http:..bugs.mysql.com.bug.php.id=24432");
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
# show that it was not replicated
|
||||
SELECT * FROM t1;
|
||||
|
||||
# restart replication for the next testcase
|
||||
stop slave;
|
||||
reset slave;
|
||||
connection master;
|
||||
reset master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
start slave;
|
||||
|
||||
# testcase with INSERT SELECT
|
||||
connection master;
|
||||
CREATE TABLE t1 (
|
||||
id bigint(20) unsigned NOT NULL auto_increment,
|
||||
field_1 int(10) unsigned NOT NULL,
|
||||
field_2 varchar(255) NOT NULL,
|
||||
field_3 varchar(255) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY field_1 (field_1, field_2)
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
field_a int(10) unsigned NOT NULL,
|
||||
field_b varchar(255) NOT NULL,
|
||||
field_c varchar(255) NOT NULL
|
||||
);
|
||||
INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
|
||||
INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
|
||||
INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
|
||||
INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
|
||||
INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
# Updating table t1 based on values from table t2
|
||||
INSERT INTO t1 (field_1, field_2, field_3)
|
||||
SELECT t2.field_a, t2.field_b, t2.field_c
|
||||
FROM t2
|
||||
ON DUPLICATE KEY UPDATE
|
||||
t1.field_3 = t2.field_c;
|
||||
# Inserting new record into t2
|
||||
INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
|
||||
# Updating t1 again
|
||||
INSERT INTO t1 (field_1, field_2, field_3)
|
||||
SELECT t2.field_a, t2.field_b, t2.field_c
|
||||
FROM t2
|
||||
ON DUPLICATE KEY UPDATE
|
||||
t1.field_3 = t2.field_c;
|
||||
SELECT * FROM t1;
|
||||
connection slave;
|
||||
|
||||
# show the error message
|
||||
#1105 = ER_UNKNOWN_ERROR
|
||||
--let $slave_sql_errno= 1105
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
# show that it was not replicated
|
||||
SELECT * FROM t1;
|
||||
connection master;
|
||||
|
||||
# clean up
|
||||
drop table t1, t2;
|
||||
connection slave;
|
||||
drop table t1, t2;
|
||||
# clear error message in sql thread
|
||||
--source include/stop_slave_io.inc
|
||||
RESET SLAVE;
|
||||
|
||||
# End of 5.0 tests
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
182
build/lib/mysql/mysql-test/suite/rpl/t/rpl_load_from_master.test
Normal file
182
build/lib/mysql/mysql-test/suite/rpl/t/rpl_load_from_master.test
Normal file
@@ -0,0 +1,182 @@
|
||||
# This one assumes we are ignoring updates on tables in database mysqltest2,
|
||||
# but doing the ones in database mysqltest
|
||||
#################################################################
|
||||
# Change Author: JBM
|
||||
# Change Date: 2006-02-02
|
||||
# Change: Added ENGINE=MyISAM
|
||||
# Reason: LOAD from master is only supported by MyISAM
|
||||
#################################################################
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
connection slave;
|
||||
drop database if exists mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
drop database if exists mysqltest3;
|
||||
connection master;
|
||||
create database mysqltest2;
|
||||
create database mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
create database mysqltest2;
|
||||
create table mysqltest2.foo (n int)ENGINE=MyISAM;
|
||||
insert into mysqltest2.foo values(4);
|
||||
connection master;
|
||||
create table mysqltest2.foo (n int)ENGINE=MyISAM;
|
||||
insert into mysqltest2.foo values(5);
|
||||
create table mysqltest.bar (m int)ENGINE=MyISAM;
|
||||
insert into mysqltest.bar values(15);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
|
||||
connection master;
|
||||
drop database mysqltest;
|
||||
drop database if exists mysqltest2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
--error 1008
|
||||
drop database mysqltest;
|
||||
drop database mysqltest2;
|
||||
|
||||
# Now let's test load data from master
|
||||
|
||||
# First create some databases and tables on the master
|
||||
|
||||
connection master;
|
||||
set sql_log_bin = 0;
|
||||
create database mysqltest2;
|
||||
create database mysqltest;
|
||||
show databases like 'mysql%';
|
||||
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
|
||||
create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
|
||||
insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
|
||||
insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
|
||||
|
||||
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
|
||||
create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
|
||||
insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
|
||||
insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
|
||||
(13, 'thirteen test');
|
||||
set sql_log_bin = 1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# This should show that the slave is empty at this point
|
||||
show databases like 'mysql%';
|
||||
# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
|
||||
# MASTER will neither touch database mysqltest nor mysqltest3
|
||||
create database mysqltest2;
|
||||
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
|
||||
insert into mysqltest2.t1 values (1, 'original foo.t1');
|
||||
create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
|
||||
insert into mysqltest2.t3 values (1, 'original foo.t3');
|
||||
create database mysqltest3;
|
||||
create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
|
||||
insert into mysqltest3.t1 values (1, 'original foo2.t1');
|
||||
|
||||
# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
|
||||
# and mysqltest.t3 to check that it is not touched (there is no
|
||||
# mysqltest.t3 on master)
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
|
||||
insert into mysqltest.t1 values (1, 'original bar.t1');
|
||||
create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
|
||||
insert into mysqltest.t3 values (1, 'original bar.t3');
|
||||
|
||||
load data from master;
|
||||
|
||||
# Now let's check if we have the right tables and the right data in them
|
||||
show databases like 'mysql%';
|
||||
use mysqltest2;
|
||||
|
||||
# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
|
||||
# databases have to be copied. So it thinks "mysqltest" has to be
|
||||
# copied. Before 4.0.16 it would first drop "mysqltest", then create
|
||||
# "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
|
||||
# here the effect of this bug (BUG#1248) would be to leave an empty
|
||||
# "mysqltest" on the slave.
|
||||
|
||||
show tables; # should be t1 & t3
|
||||
select * from t1; # should be slave's original
|
||||
use mysqltest3;
|
||||
show tables; # should be t1
|
||||
select * from t1; # should be slave's original
|
||||
use mysqltest;
|
||||
show tables; # should contain master's copied t1&t2, slave's original t3
|
||||
select * from mysqltest.t1;
|
||||
select * from mysqltest.t2;
|
||||
select * from mysqltest.t3;
|
||||
|
||||
# Now let's see if replication works
|
||||
connection master;
|
||||
insert into mysqltest.t1 values (4, 'four test');
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from mysqltest.t1;
|
||||
|
||||
# Check that LOAD DATA FROM MASTER is able to create master.info
|
||||
# if needed (if RESET SLAVE was used before), before writing to it (BUG#2922).
|
||||
|
||||
stop slave;
|
||||
reset slave;
|
||||
load data from master;
|
||||
start slave;
|
||||
# see if replication coordinates were restored fine
|
||||
connection master;
|
||||
insert into mysqltest.t1 values (5, 'five bar');
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select * from mysqltest.t1;
|
||||
|
||||
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
|
||||
# table to be overwritten.
|
||||
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
|
||||
# insert into mysqltest.t1 values(10, 'should be there');
|
||||
# flush tables;
|
||||
let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
|
||||
# system chmod 500 $MYSQLD_SLAVE_DATADIR/mysqltest/;
|
||||
# --error 6
|
||||
# load data from master; # should fail (errno 13)
|
||||
# system chmod 700 $MYSQLD_SLAVE_DATADIR/mysqltest/;
|
||||
# select * from mysqltest.t1; # should contain the row (10, ...)
|
||||
|
||||
|
||||
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
|
||||
--error 1050
|
||||
load table mysqltest.t1 from master;
|
||||
drop table mysqltest.t1;
|
||||
load table mysqltest.t1 from master;
|
||||
|
||||
# Check what happens when requestion not existing table
|
||||
#
|
||||
--error 1188
|
||||
load table bar.t1 from master;
|
||||
|
||||
# as LOAD DATA FROM MASTER failed it did not restart slave threads
|
||||
# DISABLED FOR NOW
|
||||
# start slave;
|
||||
|
||||
# Now time for cleanup
|
||||
connection master;
|
||||
drop database mysqltest;
|
||||
drop database mysqltest2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# These have to be dropped on slave because they are not replicated
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,99 @@
|
||||
###########################################################
|
||||
# Change Author: JBM
|
||||
# Change Date: 2006-2-2
|
||||
# Change: Added ENGINE=$engine_type for first create table
|
||||
# Reason: Only MyISAM supports load from master no need to
|
||||
# run test case for other engines, in addition test will
|
||||
# fail if other engines are set as default engine
|
||||
###########################################################
|
||||
# Change Author: JBM
|
||||
# Change Date: 2006-2-3
|
||||
# Change: removed ENGINE=$engine_type for first create table
|
||||
# and renamed test file to rpl_load_table_from_master.test.
|
||||
# In addition added test requirements.
|
||||
# Reason: Request from review.
|
||||
############################################################
|
||||
# REQUIREMENT TEST 1:
|
||||
# LOAD TABLE FROM MASTER must work with a forced timestamp.
|
||||
############################################################
|
||||
#
|
||||
# Test forced timestamp
|
||||
#
|
||||
-- source include/master-slave.inc
|
||||
|
||||
-- echo "******************** Test Requirment 1 *************"
|
||||
|
||||
# Don't log table creating to the slave as we want to test LOAD TABLE
|
||||
SET SQL_LOG_BIN=0,timestamp=200006;
|
||||
eval CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
|
||||
INSERT INTO t1 ( a) VALUE ('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;
|
||||
|
||||
#######################################################
|
||||
# REQUIREMENTi TEST 2:
|
||||
#LOAD TABLE FROM MASTER must work with table checksum
|
||||
#######################################################
|
||||
-- echo "******************** Test Requirment 2 *************"
|
||||
|
||||
eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM 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;
|
||||
|
||||
connection master;
|
||||
set SQL_LOG_BIN=0;
|
||||
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
|
||||
load data infile '../../std_data/words.dat' into table t1;
|
||||
create table t2 (word char(20) not null)ENGINE=MyISAM;
|
||||
load data infile '../../std_data/words.dat' into table t2;
|
||||
create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
|
||||
connection slave;
|
||||
load table t1 from master;
|
||||
load table t2 from master;
|
||||
load table t3 from master;
|
||||
check table t1;
|
||||
select count(*) from t2;
|
||||
select count(*) from t3;
|
||||
connection master;
|
||||
set SQL_LOG_BIN=1;
|
||||
drop table if exists t1,t2,t3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
create table t1(n int);
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
3
build/lib/mysql/mysql-test/suite/rpl/t/rpl_loaddata.test
Normal file
3
build/lib/mysql/mysql-test/suite/rpl/t/rpl_loaddata.test
Normal file
@@ -0,0 +1,3 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
let $engine_type=MyISAM;
|
||||
-- source extra/rpl_tests/rpl_loaddata.test
|
||||
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Check LOAD DATA + character sets + replication
|
||||
#
|
||||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# Bug#15126 character_set_database is not replicated
|
||||
# (LOAD DATA INFILE need it)
|
||||
#
|
||||
connection master;
|
||||
create table t1 (a varchar(10) character set utf8);
|
||||
load data infile '../../std_data/loaddata6.dat' into table t1;
|
||||
set @@character_set_database=koi8r;
|
||||
load data infile '../../std_data/loaddata6.dat' into table t1;
|
||||
set @@character_set_database=DEFAULT;
|
||||
load data infile '../../std_data/loaddata6.dat' into table t1;
|
||||
load data infile '../../std_data/loaddata6.dat' into table t1;
|
||||
load data infile '../../std_data/loaddata6.dat' into table t1;
|
||||
set @@character_set_database=koi8r;
|
||||
load data infile '../../std_data/loaddata6.dat' into table t1;
|
||||
set @@character_set_database=DEFAULT;
|
||||
load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
|
||||
|
||||
select hex(a) from t1;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
select hex(a) from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#45516
|
||||
# When slave SQL thread executing LOAD DATA command, the
|
||||
# thd->variables.collation_database was not set properly to the default
|
||||
# database charset
|
||||
#
|
||||
|
||||
echo -------------test bug#45516------------------;
|
||||
|
||||
# LOAD DATA INFILE
|
||||
let $LOAD_LOCAL=1;
|
||||
source include/rpl_loaddata_charset.inc;
|
||||
|
||||
# LOAD DATA LOCAL INFILE
|
||||
let $LOAD_LOCAL=0;
|
||||
source include/rpl_loaddata_charset.inc;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,13 @@
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
CREATE TABLE t1 (c1 char(50));
|
||||
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||
LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||
-- source include/show_binlog_events.inc
|
||||
DROP TABLE t1;
|
||||
|
||||
let $lock_option= CONCURRENT;
|
||||
let $engine_type=MyISAM;
|
||||
-- source extra/rpl_tests/rpl_loaddata.test
|
||||
@@ -0,0 +1,27 @@
|
||||
source include/have_binlog_format_statement.inc;
|
||||
source include/have_debug.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
# We do this little stunt to make sure that the slave has started
|
||||
# before we stop it again.
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,10);
|
||||
sync_slave_with_master;
|
||||
|
||||
# Now we feed it a load data infile, which should make it stop with a
|
||||
# fatal error.
|
||||
connection master;
|
||||
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
|
||||
|
||||
connection slave;
|
||||
call mtr.add_suppression("Slave SQL.*Fatal error: Not enough memory, Error_code: 1593");
|
||||
let $slave_sql_errno= 1593;
|
||||
let $show_slave_sql_error= 1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
53
build/lib/mysql/mysql-test/suite/rpl/t/rpl_loaddata_m.test
Normal file
53
build/lib/mysql/mysql-test/suite/rpl/t/rpl_loaddata_m.test
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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).
|
||||
######################################################
|
||||
# Change Author: JBM
|
||||
# Change Date: 2005-12-22
|
||||
# Change: Test rewritten to remove show binlog events
|
||||
# and to test the option better + Cleanup
|
||||
######################################################
|
||||
-- source include/master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
connection master;
|
||||
# 'test' database should be ignored by the slave
|
||||
USE test;
|
||||
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
|
||||
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
|
||||
SELECT COUNT(*) FROM test.t1;
|
||||
|
||||
# 'mysqltest' database should NOT be ignored by the slave
|
||||
CREATE DATABASE mysqltest;
|
||||
USE mysqltest;
|
||||
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
|
||||
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
|
||||
SELECT COUNT(*) FROM mysqltest.t1;
|
||||
|
||||
# Now lets check the slave to see what we have :-)
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
SHOW DATABASES;
|
||||
|
||||
USE test;
|
||||
SHOW TABLES;
|
||||
|
||||
USE mysqltest;
|
||||
SHOW TABLES;
|
||||
SELECT COUNT(*) FROM mysqltest.t1;
|
||||
|
||||
#show binlog events;
|
||||
|
||||
# Cleanup
|
||||
connection master;
|
||||
DROP DATABASE mysqltest;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of test
|
||||
--source include/rpl_end.inc
|
||||
74
build/lib/mysql/mysql-test/suite/rpl/t/rpl_loaddata_map.test
Normal file
74
build/lib/mysql/mysql-test/suite/rpl/t/rpl_loaddata_map.test
Normal file
@@ -0,0 +1,74 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# check replication of load data with the server parameters subjected to
|
||||
# read_buffer_size > max_allowed_packet
|
||||
#
|
||||
# ==== Implementation ====
|
||||
#
|
||||
# Insert many rows into t1, write t1 to file.
|
||||
# Load the file into t2.
|
||||
# See that t2 came out as expected on slave.
|
||||
#
|
||||
# ==== Related Bugs ====
|
||||
#
|
||||
# BUG#30435 loading large LOAD DATA INFILE breaks slave with
|
||||
# read_buffer_size set on master
|
||||
# BUG#33413 show binlog events fails if binlog has event size of close
|
||||
# to max_allowed_packet
|
||||
|
||||
source include/have_binlog_format_statement.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
|
||||
--echo ==== Create a big file ====
|
||||
|
||||
# We turn off binlogging to avoid too much noise in the binlog. t1 is
|
||||
# just an auxiliary construction anyways, it is not needed on the
|
||||
# slave.
|
||||
|
||||
--disable_query_log
|
||||
SET @@sql_log_bin= 0;
|
||||
|
||||
let $rows= 5000;
|
||||
create table t1 (id int not null primary key auto_increment);
|
||||
|
||||
while($rows)
|
||||
{
|
||||
eval insert into t1 values (null);
|
||||
dec $rows;
|
||||
}
|
||||
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
SET @@sql_log_bin= 1;
|
||||
--enable_query_log
|
||||
|
||||
|
||||
--echo ==== Load our big file into a table ====
|
||||
create table t2 (id int not null primary key auto_increment);
|
||||
|
||||
select @@session.read_buffer_size - @@session.max_allowed_packet > 0 ;
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval load data infile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2;
|
||||
select count(*) from t2 /* 5 000 */;
|
||||
|
||||
# the binlog will show fragmented Append_block events
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
|
||||
--echo ==== Verify results on slave ====
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
select count(*) from t2 /* 5 000 */;
|
||||
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
drop table t2;
|
||||
sync_slave_with_master;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug30435_5k.txt;
|
||||
--source include/rpl_end.inc
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user