初版
This commit is contained in:
360
build/lib/mysql/mysql-test/extra/binlog_tests/binlog.test
Normal file
360
build/lib/mysql/mysql-test/extra/binlog_tests/binlog.test
Normal file
@@ -0,0 +1,360 @@
|
||||
#
|
||||
# misc binlogging tests that do not require a slave running
|
||||
#
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_debug.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
reset master;
|
||||
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (a int) engine=innodb;
|
||||
begin;
|
||||
insert t1 values (5);
|
||||
commit;
|
||||
begin;
|
||||
insert t2 values (5);
|
||||
commit;
|
||||
# first COMMIT must be Query_log_event, second - Xid_log_event
|
||||
source include/show_binlog_events.inc;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# binlog rotation after one big transaction
|
||||
#
|
||||
reset master;
|
||||
let $1=100;
|
||||
|
||||
create table t1 (n int) engine=innodb;
|
||||
begin;
|
||||
--disable_query_log
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values($1 + 4);
|
||||
dec $1;
|
||||
}
|
||||
--enable_query_log
|
||||
commit;
|
||||
drop table t1;
|
||||
--source include/show_binlog_events.inc
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--source include/show_binlog_events.inc
|
||||
--let $binlog_file=
|
||||
|
||||
#
|
||||
# Bug#22540 - Incorrect value in column End_log_pos of
|
||||
# SHOW BINLOG EVENTS using InnoDB
|
||||
#
|
||||
|
||||
# the following tests will show that certain queries now return
|
||||
# absolute offsets (from binlog start, rather than relative to
|
||||
# the beginning of the current transaction). under what
|
||||
# conditions it should be allowed / is sensible to put the
|
||||
# slider into the middle of a transaction is not our concern
|
||||
# here; we just guarantee that if and when it's done, the
|
||||
# user has valid offsets to use. if the setter function still
|
||||
# wants to throw a "positioning into middle of transaction"
|
||||
# warning, that's its prerogative and handled elsewhere.
|
||||
|
||||
set @ac = @@autocommit;
|
||||
|
||||
# first show this to work for SHOW BINLOG EVENTS
|
||||
|
||||
set autocommit= 0;
|
||||
reset master;
|
||||
create table t1(n int) engine=innodb;
|
||||
begin;
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (3);
|
||||
commit;
|
||||
drop table t1;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# now show that nothing breaks if we need to read from the cache more
|
||||
# than once, resulting in split event-headers
|
||||
|
||||
set @bcs = @@binlog_cache_size;
|
||||
set global binlog_cache_size=4096;
|
||||
reset master;
|
||||
|
||||
create table t1 (a int) engine=innodb;
|
||||
|
||||
let $1=400;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
enable_query_log;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
drop table t1;
|
||||
|
||||
set global binlog_cache_size=@bcs;
|
||||
set session autocommit = @ac;
|
||||
|
||||
#
|
||||
# Bug#33798: prepared statements improperly handle large unsigned ints
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
reset master;
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
execute stmt using @a, @b;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
|
||||
#
|
||||
# Bug #39182: Binary log producing incompatible character set query from
|
||||
# stored procedure.
|
||||
#
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
DELIMITER //;
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
CALL p1();
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
|
||||
#
|
||||
# Bug#35383: binlog playback and replication breaks due to
|
||||
# name_const substitution
|
||||
#
|
||||
DELIMITER //;
|
||||
CREATE PROCEDURE p1(IN v1 INT)
|
||||
BEGIN
|
||||
CREATE TABLE t1 SELECT v1;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
DECLARE v1 INT;
|
||||
CREATE TABLE t1 SELECT v1+1;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p3(IN v1 INT)
|
||||
BEGIN
|
||||
CREATE TABLE t1 SELECT 1 FROM DUAL WHERE v1!=0;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p4(IN v1 INT)
|
||||
BEGIN
|
||||
DECLARE v2 INT;
|
||||
CREATE TABLE t1 SELECT 1, v1, v2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT 1, v1+1, v2;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
DELIMITER ;//
|
||||
|
||||
CALL p1(1);
|
||||
CALL p2();
|
||||
CALL p3(0);
|
||||
CALL p4(0);
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
DROP PROCEDURE p4;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Test of a too big SET INSERT_ID: see if the truncated value goes
|
||||
# into binlog (right), or the too big value (wrong); we look at the
|
||||
# binlog further down with SHOW BINLOG EVENTS.
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
set insert_id=128;
|
||||
insert into t1 values(null);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# bug#22027
|
||||
create table t1 (a int);
|
||||
create table if not exists t2 select * from t1;
|
||||
|
||||
# bug#22762
|
||||
create temporary table tt1 (a int);
|
||||
create table if not exists t3 like tt1;
|
||||
|
||||
# BUG#25091 (A DELETE statement to mysql database is not logged with
|
||||
# ROW mode format): Checking that some basic operations on tables in
|
||||
# the mysql database is replicated even when the current database is
|
||||
# 'mysql'.
|
||||
|
||||
--disable_warnings
|
||||
USE mysql;
|
||||
INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test');
|
||||
UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@';
|
||||
DELETE FROM user WHERE host='localhost' AND user='@#@';
|
||||
--enable_warnings
|
||||
|
||||
use test;
|
||||
source include/show_binlog_events.inc;
|
||||
drop table t1,t2,t3,tt1;
|
||||
|
||||
-- source extra/binlog_tests/binlog_insert_delayed.test
|
||||
|
||||
#Bug #26079 max_binlog_size + innodb = not make new binlog and hang server
|
||||
# server should not hang, binlog must rotate in the end
|
||||
reset master;
|
||||
--disable_warnings
|
||||
drop table if exists t3;
|
||||
--enable_warnings
|
||||
create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb;
|
||||
source include/show_master_status.inc;
|
||||
let $it=4;
|
||||
while ($it)
|
||||
{
|
||||
insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
dec $it;
|
||||
}
|
||||
# must show new binlog index after rotating;
|
||||
source include/show_master_status.inc;
|
||||
drop table t3;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #45998: database crashes when running "create as select"
|
||||
--echo #
|
||||
CREATE DATABASE test1;
|
||||
USE test1;
|
||||
DROP DATABASE test1;
|
||||
CREATE TABLE test.t1(a int);
|
||||
INSERT INTO test.t1 VALUES (1), (2);
|
||||
CREATE TABLE test.t2 SELECT * FROM test.t1;
|
||||
USE test;
|
||||
DROP TABLES t1, t2;
|
||||
|
||||
#
|
||||
# Bug#46640
|
||||
# This test verifies if the server_id stored in the "format
|
||||
# description BINLOG statement" will override the server_id
|
||||
# of the server executing the statements.
|
||||
#
|
||||
|
||||
connect (fresh,localhost,root,,test);
|
||||
connection fresh;
|
||||
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
|
||||
# Format description event, with server_id = 10;
|
||||
BINLOG '
|
||||
3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
||||
';
|
||||
|
||||
# What server_id is logged for a statement? Should be our own, not the
|
||||
# one from the format description event.
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# INSERT INTO t1 VALUES (2), with server_id=20. Check that this is logged
|
||||
# with our own server id, not the 20 from the BINLOG statement.
|
||||
BINLOG '
|
||||
3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
|
||||
3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
|
||||
';
|
||||
|
||||
# Show binlog events to check that server ids are correct.
|
||||
--replace_column 1 # 2 # 5 #
|
||||
--replace_regex /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
|
||||
SHOW BINLOG EVENTS;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
--echo # BUG#54903 BINLOG statement toggles session variables
|
||||
--echo # ----------------------------------------------------------------------
|
||||
--echo # This test verify that BINLOG statement doesn't change current session's
|
||||
--echo # variables foreign_key_checks and unique_checks.
|
||||
--echo
|
||||
CREATE TABLE t1 (c1 INT KEY);
|
||||
|
||||
SET @@SESSION.foreign_key_checks= ON;
|
||||
SET @@SESSION.unique_checks= ON;
|
||||
|
||||
--echo # INSERT INTO t1 VALUES (1)
|
||||
--echo # foreign_key_checks=0 and unique_checks=0
|
||||
BINLOG '
|
||||
dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
|
||||
dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA==
|
||||
';
|
||||
|
||||
SELECT * FROM t1;
|
||||
--echo # Their values should be ON
|
||||
SHOW SESSION VARIABLES LIKE "%_checks";
|
||||
|
||||
--echo
|
||||
SET @@SESSION.foreign_key_checks= OFF;
|
||||
SET @@SESSION.unique_checks= OFF;
|
||||
|
||||
--echo # INSERT INTO t1 VALUES(2)
|
||||
--echo # foreign_key_checks=1 and unique_checks=1
|
||||
BINLOG '
|
||||
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
|
||||
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
|
||||
';
|
||||
|
||||
SELECT * FROM t1;
|
||||
--echo # Their values should be OFF
|
||||
SHOW SESSION VARIABLES LIKE "%_checks";
|
||||
|
||||
--echo # INSERT INTO t1 VALUES(2)
|
||||
--echo # foreign_key_checks=1 and unique_checks=1
|
||||
--echo # It should not change current session's variables, even error happens
|
||||
call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062");
|
||||
--error 1062
|
||||
BINLOG '
|
||||
dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE=
|
||||
dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA==
|
||||
';
|
||||
|
||||
SELECT * FROM t1;
|
||||
--echo # Their values should be OFF
|
||||
SHOW SESSION VARIABLES LIKE "%_checks";
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
disconnect fresh;
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
################################################################################
|
||||
# Let
|
||||
# - B be begin, C commit and R rollback.
|
||||
# - T a statement that accesses and changes only transactional tables, i.e.
|
||||
# T-tables
|
||||
# - N a statement that accesses and changes only non-transactional tables,
|
||||
# i.e, N-tables.
|
||||
# - M be a mixed statement, i.e. a statement that updates both T- and
|
||||
# N-tables.
|
||||
# - M* be a mixed statement that fails while updating either a T
|
||||
# or N-table.
|
||||
# - N* be a statement that fails while updating a N-table.
|
||||
#
|
||||
# In this test case, when changes are logged as rows either in the RBR or MIXED
|
||||
# modes, we check if a M* statement that happens early in a transaction is
|
||||
# written to the binary log outside the boundaries of the transaction and
|
||||
# wrapped up in a BEGIN/ROLLBACK. This is done to keep the slave consistent with
|
||||
# the master as the rollback will keep the changes on N-tables and undo them on
|
||||
# T-tables. In particular, we expect the following behavior:
|
||||
#
|
||||
# 1. B M* T C would generate in the binlog B M* R B T C.
|
||||
# 2. B M M* C would generate in the binlog B M M* C.
|
||||
# 3. B M* M* T C would generate in the binlog B M* R B M* R B T C.
|
||||
#
|
||||
# SBR is not considered in this test because a failing statement is written to
|
||||
# the binary along with the error code such that a slave executes and rolls it
|
||||
# back, thus undoing the effects on T-tables.
|
||||
#
|
||||
# Note that, in the first case, we are not preserving history from the master as
|
||||
# we are introducing a rollback that never happened. However, this seems to be
|
||||
# more acceptable than making the slave diverge. In the second case, the slave
|
||||
# will diverge as the changes on T-tables that originated from the M statement
|
||||
# are rolled back on the master but not on the slave. Unfortunately, we cannot
|
||||
# simply roll the transaction back as this would undo any uncommitted changes
|
||||
# on T-tables.
|
||||
#
|
||||
# We check two more cases. First, INSERT...SELECT* which produces the following
|
||||
# results:
|
||||
#
|
||||
# 1. B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
|
||||
# the binlog the following entries: "Nothing".
|
||||
# 2. B INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
|
||||
# the binlog the following entries: B INSERT M...SELECT* R.
|
||||
#
|
||||
# Finally, we also check if any N statement that happens early in a transaction
|
||||
# (i.e. before any T or M statement) is written to the binary log outside the
|
||||
# boundaries of the transaction. In particular, we expect the following
|
||||
# behavior:
|
||||
#
|
||||
# 1. B N N T C would generate in the binlog B N C B N C B T C.
|
||||
# 2. B N N T R would generate in the binlog B N C B N C B T R.
|
||||
# 3. B N* N* T C would generate in the binlog B N R B N R B T C.
|
||||
# 4. B N* N* T R would generate in the binlog B N R B N R B T R.
|
||||
# 5. B N N T N T C would generate in the binlog B N C B N C B T N T C.
|
||||
# 6. B N N T N T R would generate in the binlog the B N C B N C B T N T R.
|
||||
#
|
||||
# Such issues do not happen in SBR. In RBR and MBR, a full-fledged fix will be
|
||||
# pushed after the WL#2687.
|
||||
#
|
||||
# Please, remove this test case after pushing WL#2687.
|
||||
################################################################################
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CONFIGURATION
|
||||
--echo ###################################################################################
|
||||
CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
|
||||
CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||
CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
|
||||
END|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CHECK HISTORY IN BINLOG
|
||||
--echo ###################################################################################
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
INSERT INTO nt_1 VALUES ("new text 1", 1);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
|
||||
INSERT INTO tt_2 VALUES ("new text 3", 3);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
INSERT INTO tt_2 VALUES ("new text 4", 4);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
|
||||
INSERT INTO tt_2 VALUES ("new text 6", 6);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
INSERT INTO nt_1 VALUES ("new text 10", 10);
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
|
||||
INSERT INTO tt_2 VALUES ("new text 11", 11);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
INSERT INTO tt_2 VALUES ("new text 15", 15);
|
||||
BEGIN;
|
||||
INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
|
||||
INSERT INTO tt_2 VALUES ("new text 16", 16);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
INSERT INTO nt_1 VALUES ("new text 18", 18);
|
||||
INSERT INTO nt_1 VALUES ("new text 20", 20);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
|
||||
INSERT INTO tt_2 VALUES ("new text 21", 21);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
INSERT INTO tt_2 VALUES ("new text 23", 23);
|
||||
INSERT INTO tt_2 VALUES ("new text 25", 25);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
|
||||
INSERT INTO tt_2 VALUES ("new text 26", 26);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
|
||||
--echo *** in the binlog the following entries: "Nothing".
|
||||
--echo *** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
TRUNCATE TABLE nt_2;
|
||||
TRUNCATE TABLE tt_2;
|
||||
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||
BEGIN;
|
||||
INSERT INTO tt_2 VALUES ("new text 27", 27);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 28", 28);
|
||||
ROLLBACK;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
|
||||
--echo *** in the binlog the following entries: "B INSERT M..SELECT* R".
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
TRUNCATE TABLE nt_2;
|
||||
TRUNCATE TABLE tt_2;
|
||||
INSERT INTO tt_2 VALUES ("new text 7", 7);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
TRUNCATE TABLE nt_1;
|
||||
TRUNCATE TABLE tt_2;
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES (USER(), 1);
|
||||
INSERT INTO nt_1 VALUES (USER(), 2);
|
||||
INSERT INTO tt_2 VALUES (USER(), 3);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES (USER(), 4);
|
||||
INSERT INTO nt_1 VALUES (USER(), 5);
|
||||
INSERT INTO tt_2 VALUES (USER(), 6);
|
||||
ROLLBACK;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
|
||||
INSERT INTO tt_2 VALUES (USER(), 9);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
|
||||
INSERT INTO tt_2 VALUES (USER(), 12);
|
||||
ROLLBACK;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES (USER(), 13);
|
||||
INSERT INTO nt_1 VALUES (USER(), 14);
|
||||
INSERT INTO tt_2 VALUES (USER(), 15);
|
||||
INSERT INTO nt_1 VALUES (USER(), 16);
|
||||
INSERT INTO tt_2 VALUES (USER(), 17);
|
||||
COMMIT;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo *** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES (USER(), 18);
|
||||
INSERT INTO nt_1 VALUES (USER(), 19);
|
||||
INSERT INTO tt_2 VALUES (USER(), 20);
|
||||
INSERT INTO nt_1 VALUES (USER(), 21);
|
||||
INSERT INTO tt_2 VALUES (USER(), 22);
|
||||
ROLLBACK;
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CLEAN
|
||||
--echo ###################################################################################
|
||||
|
||||
DROP TABLE tt_1;
|
||||
DROP TABLE tt_2;
|
||||
DROP TABLE nt_1;
|
||||
DROP TABLE nt_2;
|
||||
@@ -0,0 +1,64 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Verify that INSERT DELAYED in mixed or row mode writes events to the
|
||||
# binlog, and that AUTO_INCREMENT works correctly.
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Insert both single and multiple rows into an autoincrement column,
|
||||
# both with specified value and with NULL.
|
||||
#
|
||||
# With INSERT DELAYED, the rows do not show up in the table
|
||||
# immediately, so we must do source include/wait_until_rows_count.inc
|
||||
# between any two INSERT DELAYED statements. Moreover, if mixed or
|
||||
# row-based logging is used, there is also a delay between when rows
|
||||
# show up in the table and when they show up in the binlog. To ensure
|
||||
# that the rows show up in the binlog, we call FLUSH TABLES, which
|
||||
# waits until the delayed_insert thread has finished.
|
||||
#
|
||||
# We cannot read the binlog after executing INSERT DELAYED statements
|
||||
# that insert multiple rows, because that is nondeterministic. More
|
||||
# precisely, rows may be written in batches to the binlog, where each
|
||||
# batch has one Table_map_log_event and one or more
|
||||
# Write_rows_log_event. The number of rows included in each batch is
|
||||
# nondeterministic.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
|
||||
# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild
|
||||
|
||||
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
|
||||
let $table=t1;
|
||||
let $count=0;
|
||||
|
||||
insert delayed into t1 values (207);
|
||||
inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
insert delayed into t1 values (null);
|
||||
inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
insert delayed into t1 values (300);
|
||||
inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
# It is not enough to wait until all rows have been inserted into the
|
||||
# table. FLUSH TABLES ensures that they are in the binlog too. See
|
||||
# comment above.
|
||||
FLUSH TABLES;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
insert delayed into t1 values (null),(null),(null),(null);
|
||||
inc $count; inc $count; inc $count; inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
insert delayed into t1 values (null),(null),(400),(null);
|
||||
inc $count; inc $count; inc $count; inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
@@ -0,0 +1,27 @@
|
||||
# BUG #36763: TRUNCATE TABLE fails to replicate when stmt-based
|
||||
# binlogging is not supported.
|
||||
|
||||
# This should always be logged as a statement, even when executed as a
|
||||
# row-by-row deletion.
|
||||
|
||||
# $before_truncate A statement to execute (just) before issuing the
|
||||
# TRUNCATE TABLE
|
||||
|
||||
|
||||
eval CREATE TABLE t1 (a INT) ENGINE=$engine;
|
||||
eval CREATE TABLE t2 (a INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1),(2),(3);
|
||||
let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
if (`select length('$before_truncate') > 0`) {
|
||||
eval $before_truncate;
|
||||
}
|
||||
--echo **** Truncate of empty table shall be logged
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
if (`select length('$before_truncate') > 0`) {
|
||||
eval $before_truncate;
|
||||
}
|
||||
TRUNCATE TABLE t2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
206
build/lib/mysql/mysql-test/extra/binlog_tests/blackhole.test
Normal file
206
build/lib/mysql/mysql-test/extra/binlog_tests/blackhole.test
Normal file
@@ -0,0 +1,206 @@
|
||||
#
|
||||
# Simple test for blackhole example
|
||||
# Taken from the select test
|
||||
#
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_blackhole.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
# The server need to be started in $MYSQLTEST_VARDIR since it
|
||||
# uses ../../std_data/
|
||||
-- source include/uses_vardir.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
|
||||
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
|
||||
) ENGINE=blackhole;
|
||||
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
|
||||
select period from t1;
|
||||
select * from t1;
|
||||
select t1.* from t1;
|
||||
|
||||
#
|
||||
# Create test table
|
||||
#
|
||||
|
||||
CREATE TABLE t2 (
|
||||
auto int NOT NULL auto_increment,
|
||||
fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
|
||||
companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
|
||||
fld3 char(30) DEFAULT '' NOT NULL,
|
||||
fld4 char(35) DEFAULT '' NOT NULL,
|
||||
fld5 char(35) DEFAULT '' NOT NULL,
|
||||
fld6 char(4) DEFAULT '' NOT NULL,
|
||||
primary key (auto)
|
||||
) ENGINE=blackhole;
|
||||
|
||||
INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
|
||||
INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# Search with a key
|
||||
#
|
||||
|
||||
select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
|
||||
select fld3 from t2 where fld3 like "%cultivation" ;
|
||||
|
||||
#
|
||||
# Search with a key using sorting and limit the same time
|
||||
#
|
||||
|
||||
select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
|
||||
select fld3,companynr from t2 where companynr = 58 order by fld3;
|
||||
|
||||
select fld3 from t2 order by fld3 desc limit 10;
|
||||
select fld3 from t2 order by fld3 desc limit 5;
|
||||
select fld3 from t2 order by fld3 desc limit 5,5;
|
||||
|
||||
#
|
||||
# Search with a key having a constant with each unique key.
|
||||
# The table is read directly with read-next on fld3
|
||||
#
|
||||
|
||||
select t2.fld3 from t2 where fld3 = 'honeysuckle';
|
||||
select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
|
||||
select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
|
||||
select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
|
||||
select t2.fld3 from t2 where fld3 LIKE 'h%le';
|
||||
|
||||
select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
|
||||
select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
|
||||
|
||||
#
|
||||
# Test sorting with a used key (there is no need for sorting)
|
||||
#
|
||||
|
||||
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
|
||||
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
|
||||
|
||||
|
||||
# Test for fulltext
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
|
||||
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
|
||||
('Full-text indexes', 'are called collections'),
|
||||
('Only MyISAM tables','support collections'),
|
||||
('Function MATCH ... AGAINST()','is used to do a search'),
|
||||
('Full-text search in MySQL', 'implements vector space model');
|
||||
SHOW INDEX FROM t1;
|
||||
|
||||
# nl search
|
||||
|
||||
select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||
explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||
select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
|
||||
select * from t1 where MATCH(a,b) AGAINST ("only");
|
||||
|
||||
# Test that every DML (except SELECT) and DDL gets into binlog
|
||||
# so that blackhole can be used as "binlog propagator"
|
||||
|
||||
reset master;
|
||||
drop table t1,t2;
|
||||
create table t1 (a int) engine=blackhole;
|
||||
delete from t1 where a=10;
|
||||
update t1 set a=11 where a=15;
|
||||
insert into t1 values(1);
|
||||
insert ignore into t1 values(1);
|
||||
replace into t1 values(100);
|
||||
create table t2 (a varchar(200)) engine=blackhole;
|
||||
eval load data infile '../../std_data/words.dat' into table t2;
|
||||
alter table t1 add b int;
|
||||
alter table t1 drop b;
|
||||
create table t3 like t1;
|
||||
insert into t1 select * from t3;
|
||||
replace into t1 select * from t3;
|
||||
# Just to verify
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
select * from t3;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# BUG#27998 - mysqld crashed when executing INSERT DELAYED on a BLACKHOLE
|
||||
# table
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
|
||||
INSERT DELAYED INTO t1 VALUES(1);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
#Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX
|
||||
#
|
||||
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
|
||||
DELETE FROM t1 WHERE a=10;
|
||||
ALTER TABLE t1 ADD INDEX(a);
|
||||
DELETE FROM t1 WHERE a=10;
|
||||
ALTER TABLE t1 DROP INDEX a;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(a);
|
||||
DELETE FROM t1 WHERE a=10;
|
||||
ALTER TABLE t1 DROP INDEX a;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
DELETE FROM t1 WHERE a=10;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# Test that a transaction which is rolled back does not go into binlog
|
||||
# and that a transaction which is committed does
|
||||
|
||||
reset master;
|
||||
create table t1 (a int) engine=blackhole;
|
||||
set autocommit=0;
|
||||
start transaction;
|
||||
insert into t1 values(1);
|
||||
commit;
|
||||
|
||||
let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
start transaction;
|
||||
insert into t1 values(2);
|
||||
rollback;
|
||||
|
||||
let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
if (`SELECT $master_log_pos_2 <> $master_log_pos_1`)
|
||||
{
|
||||
echo $master_log_pos_1 $master_log_pos_2;
|
||||
die Rollbacked transaction has been binlogged;
|
||||
}
|
||||
|
||||
set autocommit=1;
|
||||
drop table if exists t1;
|
||||
|
||||
#
|
||||
# Bug#35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables
|
||||
#
|
||||
#
|
||||
# the test checks that explicitly prescribed with set insert_id= value
|
||||
# preceeds the following autoincrement insert in a blachhole
|
||||
#
|
||||
|
||||
reset master;
|
||||
create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
|
||||
|
||||
# not insert_id prescribed insert binlogs with the default set insert_id 1
|
||||
insert into t1 values (11), (NULL), (NULL), (NULL);
|
||||
set insert_id= 3;
|
||||
insert into t1 values (NULL), (33), (NULL);
|
||||
set insert_id= 5;
|
||||
insert into t1 values (55), (NULL);
|
||||
source include/show_binlog_events2.inc;
|
||||
|
||||
# cleanup
|
||||
drop table t1;
|
||||
|
||||
|
||||
# End of tests
|
||||
468
build/lib/mysql/mysql-test/extra/binlog_tests/ctype_cp932.test
Normal file
468
build/lib/mysql/mysql-test/extra/binlog_tests/ctype_cp932.test
Normal file
@@ -0,0 +1,468 @@
|
||||
-- source include/have_cp932.inc
|
||||
|
||||
--character_set cp932
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
drop table if exists t4;
|
||||
--enable_warnings
|
||||
|
||||
SET @test_character_set= 'cp932';
|
||||
SET @test_collation= 'cp932_japanese_ci';
|
||||
-- source include/ctype_common.inc
|
||||
|
||||
set names cp932;
|
||||
set character_set_database = cp932;
|
||||
|
||||
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932;
|
||||
|
||||
#Characters which are converted to Unicode ambiguously
|
||||
INSERT INTO t1 VALUES
|
||||
(0x05),(0x7E),(0x815C),(0x815F),(0x8160),(0x8161),(0x817C),(0x8191),(0x8192),(0x81CA);
|
||||
|
||||
#NEC ROW 13 characters (0x8740 - 0x879C)
|
||||
INSERT INTO t1 VALUES
|
||||
(0x8740),(0x8741),(0x8742),(0x8743),(0x8744),(0x8745),(0x8746),(0x8747),
|
||||
(0x8748),(0x8749),(0x874A),(0x874B),(0x874C),(0x874D),(0x874E),(0x874F),
|
||||
(0x8750),(0x8751),(0x8752),(0x8753),(0x8754),(0x8755),(0x8756),(0x8757),
|
||||
(0x8758),(0x8759),(0x875A),(0x875B),(0x875C),(0x875D),(0x875F),
|
||||
(0x8760),(0x8761),(0x8762),(0x8763),(0x8764),(0x8765),(0x8766),(0x8767),
|
||||
(0x8768),(0x8769),(0x876A),(0x876B),(0x876C),(0x876D),(0x876E),(0x876F),
|
||||
(0x8770),(0x8771),(0x8772),(0x8773),(0x8774),(0x8775),(0x877E),
|
||||
(0x8780),(0x8781),(0x8782),(0x8783),(0x8784),(0x8785),(0x8786),(0x8787),
|
||||
(0x8788),(0x8789),(0x878A),(0x878B),(0x878C),(0x878D),(0x878E),(0x878F),
|
||||
(0x8790),(0x8791),(0x8792),(0x8793),(0x8794),(0x8795),(0x8796),(0x8797),
|
||||
(0x8798),(0x8799),(0x879A),(0x879B),(0x879C);
|
||||
|
||||
#IBM selected characters kanji & non-kanji, NEC implementation (0xED40 - 0xEEFC)
|
||||
INSERT INTO t1 VALUES
|
||||
(0xED40),(0xED41),(0xED42),(0xED43),(0xED44),(0xED45),(0xED46),(0xED47),
|
||||
(0xED48),(0xED49),(0xED4A),(0xED4B),(0xED4C),(0xED4D),(0xED4E),(0xED4F),
|
||||
(0xED50),(0xED51),(0xED52),(0xED53),(0xED54),(0xED55),(0xED56),(0xED57),
|
||||
(0xED58),(0xED59),(0xED5A),(0xED5B),(0xED5C),(0xED5D),(0xED5E),(0xED5F),
|
||||
(0xED60),(0xED61),(0xED62),(0xED63),(0xED64),(0xED65),(0xED66),(0xED67),
|
||||
(0xED68),(0xED69),(0xED6A),(0xED6B),(0xED6C),(0xED6D),(0xED6E),(0xED6F),
|
||||
(0xED70),(0xED71),(0xED72),(0xED73),(0xED74),(0xED75),(0xED76),(0xED77),
|
||||
(0xED78),(0xED79),(0xED7A),(0xED7B),(0xED7C),(0xED7D),(0xED7E),
|
||||
(0xED80),(0xED81),(0xED82),(0xED83),(0xED84),(0xED85),(0xED86),(0xED87),
|
||||
(0xED88),(0xED89),(0xED8A),(0xED8B),(0xED8C),(0xED8D),(0xED8E),(0xED8F),
|
||||
(0xED90),(0xED91),(0xED92),(0xED93),(0xED94),(0xED95),(0xED96),(0xED97),
|
||||
(0xED98),(0xED99),(0xED9A),(0xED9B),(0xED9C),(0xED9D),(0xED9E),(0xED9F),
|
||||
(0xEDA0),(0xEDA1),(0xEDA2),(0xEDA3),(0xEDA4),(0xEDA5),(0xEDA6),(0xEDA7),
|
||||
(0xEDA8),(0xEDA9),(0xEDAA),(0xEDAB),(0xEDAC),(0xEDAD),(0xEDAE),(0xEDAF),
|
||||
(0xEDB0),(0xEDB1),(0xEDB2),(0xEDB3),(0xEDB4),(0xEDB5),(0xEDB6),(0xEDB7),
|
||||
(0xEDB8),(0xEDB9),(0xEDBA),(0xEDBB),(0xEDBC),(0xEDBD),(0xEDBE),(0xEDBF),
|
||||
(0xEDC0),(0xEDC1),(0xEDC2),(0xEDC3),(0xEDC4),(0xEDC5),(0xEDC6),(0xEDC7),
|
||||
(0xEDC8),(0xEDC9),(0xEDCA),(0xEDCB),(0xEDCC),(0xEDCD),(0xEDCE),(0xEDCF),
|
||||
(0xEDD0),(0xEDD1),(0xEDD2),(0xEDD3),(0xEDD4),(0xEDD5),(0xEDD6),(0xEDD7),
|
||||
(0xEDD8),(0xEDD9),(0xEDDA),(0xEDDB),(0xEDDC),(0xEDDD),(0xEDDE),(0xEDDF),
|
||||
(0xEDE0),(0xEDE1),(0xEDE2),(0xEDE3),(0xEDE4),(0xEDE5),(0xEDE6),(0xEDE7),
|
||||
(0xEDE8),(0xEDE9),(0xEDEA),(0xEDEB),(0xEDEC),(0xEDED),(0xEDEE),(0xEDEF),
|
||||
(0xEDF0),(0xEDF1),(0xEDF2),(0xEDF3),(0xEDF4),(0xEDF5),(0xEDF6),(0xEDF7),
|
||||
(0xEDF8),(0xEDF9),(0xEDFA),(0xEDFB),(0xEDFC),
|
||||
(0xEE40),(0xEE41),(0xEE42),(0xEE43),(0xEE44),(0xEE45),(0xEE46),(0xEE47),
|
||||
(0xEE48),(0xEE49),(0xEE4A),(0xEE4B),(0xEE4C),(0xEE4D),(0xEE4E),(0xEE4F),
|
||||
(0xEE50),(0xEE51),(0xEE52),(0xEE53),(0xEE54),(0xEE55),(0xEE56),(0xEE57),
|
||||
(0xEE58),(0xEE59),(0xEE5A),(0xEE5B),(0xEE5C),(0xEE5D),(0xEE5E),(0xEE5F),
|
||||
(0xEE60),(0xEE61),(0xEE62),(0xEE63),(0xEE64),(0xEE65),(0xEE66),(0xEE67),
|
||||
(0xEE68),(0xEE69),(0xEE6A),(0xEE6B),(0xEE6C),(0xEE6D),(0xEE6E),(0xEE6F),
|
||||
(0xEE70),(0xEE71),(0xEE72),(0xEE73),(0xEE74),(0xEE75),(0xEE76),(0xEE77),
|
||||
(0xEE78),(0xEE79),(0xEE7A),(0xEE7B),(0xEE7C),(0xEE7D),(0xEE7E),
|
||||
(0xEE80),(0xEE81),(0xEE82),(0xEE83),(0xEE84),(0xEE85),(0xEE86),(0xEE87),
|
||||
(0xEE88),(0xEE89),(0xEE8A),(0xEE8B),(0xEE8C),(0xEE8D),(0xEE8E),(0xEE8F),
|
||||
(0xEE90),(0xEE91),(0xEE92),(0xEE93),(0xEE94),(0xEE95),(0xEE96),(0xEE97),
|
||||
(0xEE98),(0xEE99),(0xEE9A),(0xEE9B),(0xEE9C),(0xEE9D),(0xEE9E),(0xEE9F),
|
||||
(0xEEA0),(0xEEA1),(0xEEA2),(0xEEA3),(0xEEA4),(0xEEA5),(0xEEA6),(0xEEA7),
|
||||
(0xEEA8),(0xEEA9),(0xEEAA),(0xEEAB),(0xEEAC),(0xEEAD),(0xEEAE),(0xEEAF),
|
||||
(0xEEB0),(0xEEB1),(0xEEB2),(0xEEB3),(0xEEB4),(0xEEB5),(0xEEB6),(0xEEB7),
|
||||
(0xEEB8),(0xEEB9),(0xEEBA),(0xEEBB),(0xEEBC),(0xEEBD),(0xEEBE),(0xEEBF),
|
||||
(0xEEC0),(0xEEC1),(0xEEC2),(0xEEC3),(0xEEC4),(0xEEC5),(0xEEC6),(0xEEC7),
|
||||
(0xEEC8),(0xEEC9),(0xEECA),(0xEECB),(0xEECC),(0xEECD),(0xEECE),(0xEECF),
|
||||
(0xEED0),(0xEED1),(0xEED2),(0xEED3),(0xEED4),(0xEED5),(0xEED6),(0xEED7),
|
||||
(0xEED8),(0xEED9),(0xEEDA),(0xEEDB),(0xEEDC),(0xEEDD),(0xEEDE),(0xEEDF),
|
||||
(0xEEE0),(0xEEE1),(0xEEE2),(0xEEE3),(0xEEE4),(0xEEE5),(0xEEE6),(0xEEE7),
|
||||
(0xEEE8),(0xEEE9),(0xEEEA),(0xEEEB),(0xEEEC),(0xEEEF),
|
||||
(0xEEF0),(0xEEF1),(0xEEF2),(0xEEF3),(0xEEF4),(0xEEF5),(0xEEF6),(0xEEF7),
|
||||
(0xEEF8),(0xEEF9),(0xEEFA),(0xEEFB),(0xEEFC);
|
||||
|
||||
#IBM selected kanji & non-kanji (0xFA40 - 0xFC4B)
|
||||
INSERT INTO t1 VALUES
|
||||
(0xFA40),(0xFA41),(0xFA42),(0xFA43),(0xFA44),(0xFA45),(0xFA46),(0xFA47),
|
||||
(0xFA48),(0xFA49),(0xFA4A),(0xFA4B),(0xFA4C),(0xFA4D),(0xFA4E),(0xFA4F),
|
||||
(0xFA50),(0xFA51),(0xFA52),(0xFA53),(0xFA54),(0xFA55),(0xFA56),(0xFA57),
|
||||
(0xFA58),(0xFA59),(0xFA5A),(0xFA5B),(0xFA5C),(0xFA5D),(0xFA5E),(0xFA5F),
|
||||
(0xFA60),(0xFA61),(0xFA62),(0xFA63),(0xFA64),(0xFA65),(0xFA66),(0xFA67),
|
||||
(0xFA68),(0xFA69),(0xFA6A),(0xFA6B),(0xFA6C),(0xFA6D),(0xFA6E),(0xFA6F),
|
||||
(0xFA70),(0xFA71),(0xFA72),(0xFA73),(0xFA74),(0xFA75),(0xFA76),(0xFA77),
|
||||
(0xFA78),(0xFA79),(0xFA7A),(0xFA7B),(0xFA7C),(0xFA7D),(0xFA7E),
|
||||
(0xFA80),(0xFA81),(0xFA82),(0xFA83),(0xFA84),(0xFA85),(0xFA86),(0xFA87),
|
||||
(0xFA88),(0xFA89),(0xFA8A),(0xFA8B),(0xFA8C),(0xFA8D),(0xFA8E),(0xFA8F),
|
||||
(0xFA90),(0xFA91),(0xFA92),(0xFA93),(0xFA94),(0xFA95),(0xFA96),(0xFA97),
|
||||
(0xFA98),(0xFA99),(0xFA9A),(0xFA9B),(0xFA9C),(0xFA9D),(0xFA9E),(0xFA9F),
|
||||
(0xFAA0),(0xFAA1),(0xFAA2),(0xFAA3),(0xFAA4),(0xFAA5),(0xFAA6),(0xFAA7),
|
||||
(0xFAA8),(0xFAA9),(0xFAAA),(0xFAAB),(0xFAAC),(0xFAAD),(0xFAAE),(0xFAAF),
|
||||
(0xFAB0),(0xFAB1),(0xFAB2),(0xFAB3),(0xFAB4),(0xFAB5),(0xFAB6),(0xFAB7),
|
||||
(0xFAB8),(0xFAB9),(0xFABA),(0xFABB),(0xFABC),(0xFABD),(0xFABE),(0xFABF),
|
||||
(0xFAC0),(0xFAC1),(0xFAC2),(0xFAC3),(0xFAC4),(0xFAC5),(0xFAC6),(0xFAC7),
|
||||
(0xFAC8),(0xFAC9),(0xFACA),(0xFACB),(0xFACC),(0xFACD),(0xFACE),(0xFACF),
|
||||
(0xFAD0),(0xFAD1),(0xFAD2),(0xFAD3),(0xFAD4),(0xFAD5),(0xFAD6),(0xFAD7),
|
||||
(0xFAD8),(0xFAD9),(0xFADA),(0xFADB),(0xFADC),(0xFADD),(0xFADE),(0xFADF),
|
||||
(0xFAE0),(0xFAE1),(0xFAE2),(0xFAE3),(0xFAE4),(0xFAE5),(0xFAE6),(0xFAE7),
|
||||
(0xFAE8),(0xFAE9),(0xFAEA),(0xFAEB),(0xFAEC),(0xFAED),(0xFAEE),(0xFAEF),
|
||||
(0xFAF0),(0xFAF1),(0xFAF2),(0xFAF3),(0xFAF4),(0xFAF5),(0xFAF6),(0xFAF7),
|
||||
(0xFAF8),(0xFAF9),(0xFAFA),(0xFAFB),(0xFAFC),
|
||||
(0xFB40),(0xFB41),(0xFB42),(0xFB43),(0xFB44),(0xFB45),(0xFB46),(0xFB47),
|
||||
(0xFB48),(0xFB49),(0xFB4A),(0xFB4B),(0xFB4C),(0xFB4D),(0xFB4E),(0xFB4F),
|
||||
(0xFB50),(0xFB51),(0xFB52),(0xFB53),(0xFB54),(0xFB55),(0xFB56),(0xFB57),
|
||||
(0xFB58),(0xFB59),(0xFB5A),(0xFB5B),(0xFB5C),(0xFB5D),(0xFB5E),(0xFB5F),
|
||||
(0xFB60),(0xFB61),(0xFB62),(0xFB63),(0xFB64),(0xFB65),(0xFB66),(0xFB67),
|
||||
(0xFB68),(0xFB69),(0xFB6A),(0xFB6B),(0xFB6C),(0xFB6D),(0xFB6E),(0xFB6F),
|
||||
(0xFB70),(0xFB71),(0xFB72),(0xFB73),(0xFB74),(0xFB75),(0xFB76),(0xFB77),
|
||||
(0xFB78),(0xFB79),(0xFB7A),(0xFB7B),(0xFB7C),(0xFB7D),(0xFB7E),
|
||||
(0xFB80),(0xFB81),(0xFB82),(0xFB83),(0xFB84),(0xFB85),(0xFB86),(0xFB87),
|
||||
(0xFB88),(0xFB89),(0xFB8A),(0xFB8B),(0xFB8C),(0xFB8D),(0xFB8E),(0xFB8F),
|
||||
(0xFB90),(0xFB91),(0xFB92),(0xFB93),(0xFB94),(0xFB95),(0xFB96),(0xFB97),
|
||||
(0xFB98),(0xFB99),(0xFB9A),(0xFB9B),(0xFB9C),(0xFB9D),(0xFB9E),(0xFB9F),
|
||||
(0xFBA0),(0xFBA1),(0xFBA2),(0xFBA3),(0xFBA4),(0xFBA5),(0xFBA6),(0xFBA7),
|
||||
(0xFBA8),(0xFBA9),(0xFBAA),(0xFBAB),(0xFBAC),(0xFBAD),(0xFBAE),(0xFBAF),
|
||||
(0xFBB0),(0xFBB1),(0xFBB2),(0xFBB3),(0xFBB4),(0xFBB5),(0xFBB6),(0xFBB7),
|
||||
(0xFBB8),(0xFBB9),(0xFBBA),(0xFBBB),(0xFBBC),(0xFBBD),(0xFBBE),(0xFBBF),
|
||||
(0xFBC0),(0xFBC1),(0xFBC2),(0xFBC3),(0xFBC4),(0xFBC5),(0xFBC6),(0xFBC7),
|
||||
(0xFBC8),(0xFBC9),(0xFBCA),(0xFBCB),(0xFBCC),(0xFBCD),(0xFBCE),(0xFBCF),
|
||||
(0xFBD0),(0xFBD1),(0xFBD2),(0xFBD3),(0xFBD4),(0xFBD5),(0xFBD6),(0xFBD7),
|
||||
(0xFBD8),(0xFBD9),(0xFBDA),(0xFBDB),(0xFBDC),(0xFBDD),(0xFBDE),(0xFBDF),
|
||||
(0xFBE0),(0xFBE1),(0xFBE2),(0xFBE3),(0xFBE4),(0xFBE5),(0xFBE6),(0xFBE7),
|
||||
(0xFBE8),(0xFBE9),(0xFBEA),(0xFBEB),(0xFBEC),(0xFBED),(0xFBEE),(0xFBEF),
|
||||
(0xFBF0),(0xFBF1),(0xFBF2),(0xFBF3),(0xFBF4),(0xFBF5),(0xFBF6),(0xFBF7),
|
||||
(0xFBF8),(0xFBF9),(0xFBFA),(0xFBFB),(0xFBFC),
|
||||
(0xFC40),(0xFC41),(0xFC42),(0xFC43),(0xFC44),(0xFC45),(0xFC46),(0xFC47),
|
||||
(0xFC48),(0xFC49),(0xFC4A),(0xFC4B);
|
||||
|
||||
#User defined characters (0xF040-0xF9FC)
|
||||
INSERT INTO t1 VALUES
|
||||
(0xF040),(0xF041),(0xF042),(0xF043),(0xF044),(0xF045),(0xF046),(0xF047),
|
||||
(0xF048),(0xF049),(0xF04A),(0xF04B),(0xF04C),(0xF04D),(0xF04E),(0xF04F),
|
||||
(0xF050),(0xF051),(0xF052),(0xF053),(0xF054),(0xF055),(0xF056),(0xF057),
|
||||
(0xF058),(0xF059),(0xF05A),(0xF05B),(0xF05C),(0xF05D),(0xF05E),(0xF05F),
|
||||
(0xF060),(0xF061),(0xF062),(0xF063),(0xF064),(0xF065),(0xF066),(0xF067),
|
||||
(0xF068),(0xF069),(0xF06A),(0xF06B),(0xF06C),(0xF06D),(0xF06E),(0xF06F),
|
||||
(0xF070),(0xF071),(0xF072),(0xF073),(0xF074),(0xF075),(0xF076),(0xF077),
|
||||
(0xF078),(0xF079),(0xF07A),(0xF07B),(0xF07C),(0xF07D),(0xF07E),
|
||||
(0xF080),(0xF081),(0xF082),(0xF083),(0xF084),(0xF085),(0xF086),(0xF087),
|
||||
(0xF088),(0xF089),(0xF08A),(0xF08B),(0xF08C),(0xF08D),(0xF08E),(0xF08F),
|
||||
(0xF090),(0xF091),(0xF092),(0xF093),(0xF094),(0xF095),(0xF096),(0xF097),
|
||||
(0xF098),(0xF099),(0xF09A),(0xF09B),(0xF09C),(0xF09D),(0xF09E),(0xF09F),
|
||||
(0xF0A0),(0xF0A1),(0xF0A2),(0xF0A3),(0xF0A4),(0xF0A5),(0xF0A6),(0xF0A7),
|
||||
(0xF0A8),(0xF0A9),(0xF0AA),(0xF0AB),(0xF0AC),(0xF0AD),(0xF0AE),(0xF0AF),
|
||||
(0xF0B0),(0xF0B1),(0xF0B2),(0xF0B3),(0xF0B4),(0xF0B5),(0xF0B6),(0xF0B7),
|
||||
(0xF0B8),(0xF0B9),(0xF0BA),(0xF0BB),(0xF0BC),(0xF0BD),(0xF0BE),(0xF0BF),
|
||||
(0xF0C0),(0xF0C1),(0xF0C2),(0xF0C3),(0xF0C4),(0xF0C5),(0xF0C6),(0xF0C7),
|
||||
(0xF0C8),(0xF0C9),(0xF0CA),(0xF0CB),(0xF0CC),(0xF0CD),(0xF0CE),(0xF0CF),
|
||||
(0xF0D0),(0xF0D1),(0xF0D2),(0xF0D3),(0xF0D4),(0xF0D5),(0xF0D6),(0xF0D7),
|
||||
(0xF0D8),(0xF0D9),(0xF0DA),(0xF0DB),(0xF0DC),(0xF0DD),(0xF0DE),(0xF0DF),
|
||||
(0xF0E0),(0xF0E1),(0xF0E2),(0xF0E3),(0xF0E4),(0xF0E5),(0xF0E6),(0xF0E7),
|
||||
(0xF0E8),(0xF0E9),(0xF0EA),(0xF0EB),(0xF0EC),(0xF0ED),(0xF0EE),(0xF0EF),
|
||||
(0xF0F0),(0xF0F1),(0xF0F2),(0xF0F3),(0xF0F4),(0xF0F5),(0xF0F6),(0xF0F7),
|
||||
(0xF0F8),(0xF0F9),(0xF0FA),(0xF0FB),(0xF0FC),
|
||||
(0xF140),(0xF141),(0xF142),(0xF143),(0xF144),(0xF145),(0xF146),(0xF147),
|
||||
(0xF148),(0xF149),(0xF14A),(0xF14B),(0xF14C),(0xF14D),(0xF14E),(0xF14F),
|
||||
(0xF150),(0xF151),(0xF152),(0xF153),(0xF154),(0xF155),(0xF156),(0xF157),
|
||||
(0xF158),(0xF159),(0xF15A),(0xF15B),(0xF15C),(0xF15D),(0xF15E),(0xF15F),
|
||||
(0xF160),(0xF161),(0xF162),(0xF163),(0xF164),(0xF165),(0xF166),(0xF167),
|
||||
(0xF168),(0xF169),(0xF16A),(0xF16B),(0xF16C),(0xF16D),(0xF16E),(0xF16F),
|
||||
(0xF170),(0xF171),(0xF172),(0xF173),(0xF174),(0xF175),(0xF176),(0xF177),
|
||||
(0xF178),(0xF179),(0xF17A),(0xF17B),(0xF17C),(0xF17D),(0xF17E),
|
||||
(0xF180),(0xF181),(0xF182),(0xF183),(0xF184),(0xF185),(0xF186),(0xF187),
|
||||
(0xF188),(0xF189),(0xF18A),(0xF18B),(0xF18C),(0xF18D),(0xF18E),(0xF18F),
|
||||
(0xF190),(0xF191),(0xF192),(0xF193),(0xF194),(0xF195),(0xF196),(0xF197),
|
||||
(0xF198),(0xF199),(0xF19A),(0xF19B),(0xF19C),(0xF19D),(0xF19E),(0xF19F),
|
||||
(0xF1A0),(0xF1A1),(0xF1A2),(0xF1A3),(0xF1A4),(0xF1A5),(0xF1A6),(0xF1A7),
|
||||
(0xF1A8),(0xF1A9),(0xF1AA),(0xF1AB),(0xF1AC),(0xF1AD),(0xF1AE),(0xF1AF),
|
||||
(0xF1B0),(0xF1B1),(0xF1B2),(0xF1B3),(0xF1B4),(0xF1B5),(0xF1B6),(0xF1B7),
|
||||
(0xF1B8),(0xF1B9),(0xF1BA),(0xF1BB),(0xF1BC),(0xF1BD),(0xF1BE),(0xF1BF),
|
||||
(0xF1C0),(0xF1C1),(0xF1C2),(0xF1C3),(0xF1C4),(0xF1C5),(0xF1C6),(0xF1C7),
|
||||
(0xF1C8),(0xF1C9),(0xF1CA),(0xF1CB),(0xF1CC),(0xF1CD),(0xF1CE),(0xF1CF),
|
||||
(0xF1D0),(0xF1D1),(0xF1D2),(0xF1D3),(0xF1D4),(0xF1D5),(0xF1D6),(0xF1D7),
|
||||
(0xF1D8),(0xF1D9),(0xF1DA),(0xF1DB),(0xF1DC),(0xF1DD),(0xF1DE),(0xF1DF),
|
||||
(0xF1E0),(0xF1E1),(0xF1E2),(0xF1E3),(0xF1E4),(0xF1E5),(0xF1E6),(0xF1E7),
|
||||
(0xF1E8),(0xF1E9),(0xF1EA),(0xF1EB),(0xF1EC),(0xF1ED),(0xF1EE),(0xF1EF),
|
||||
(0xF1F0),(0xF1F1),(0xF1F2),(0xF1F3),(0xF1F4),(0xF1F5),(0xF1F6),(0xF1F7),
|
||||
(0xF1F8),(0xF1F9),(0xF1FA),(0xF1FB),(0xF1FC),
|
||||
(0xF240),(0xF241),(0xF242),(0xF243),(0xF244),(0xF245),(0xF246),(0xF247),
|
||||
(0xF248),(0xF249),(0xF24A),(0xF24B),(0xF24C),(0xF24D),(0xF24E),(0xF24F),
|
||||
(0xF250),(0xF251),(0xF252),(0xF253),(0xF254),(0xF255),(0xF256),(0xF257),
|
||||
(0xF258),(0xF259),(0xF25A),(0xF25B),(0xF25C),(0xF25D),(0xF25E),(0xF25F),
|
||||
(0xF260),(0xF261),(0xF262),(0xF263),(0xF264),(0xF265),(0xF266),(0xF267),
|
||||
(0xF268),(0xF269),(0xF26A),(0xF26B),(0xF26C),(0xF26D),(0xF26E),(0xF26F),
|
||||
(0xF270),(0xF271),(0xF272),(0xF273),(0xF274),(0xF275),(0xF276),(0xF277),
|
||||
(0xF278),(0xF279),(0xF27A),(0xF27B),(0xF27C),(0xF27D),(0xF27E),
|
||||
(0xF280),(0xF281),(0xF282),(0xF283),(0xF284),(0xF285),(0xF286),(0xF287),
|
||||
(0xF288),(0xF289),(0xF28A),(0xF28B),(0xF28C),(0xF28D),(0xF28E),(0xF28F),
|
||||
(0xF290),(0xF291),(0xF292),(0xF293),(0xF294),(0xF295),(0xF296),(0xF297),
|
||||
(0xF298),(0xF299),(0xF29A),(0xF29B),(0xF29C),(0xF29D),(0xF29E),(0xF29F),
|
||||
(0xF2A0),(0xF2A1),(0xF2A2),(0xF2A3),(0xF2A4),(0xF2A5),(0xF2A6),(0xF2A7),
|
||||
(0xF2A8),(0xF2A9),(0xF2AA),(0xF2AB),(0xF2AC),(0xF2AD),(0xF2AE),(0xF2AF),
|
||||
(0xF2B0),(0xF2B1),(0xF2B2),(0xF2B3),(0xF2B4),(0xF2B5),(0xF2B6),(0xF2B7),
|
||||
(0xF2B8),(0xF2B9),(0xF2BA),(0xF2BB),(0xF2BC),(0xF2BD),(0xF2BE),(0xF2BF),
|
||||
(0xF2C0),(0xF2C1),(0xF2C2),(0xF2C3),(0xF2C4),(0xF2C5),(0xF2C6),(0xF2C7),
|
||||
(0xF2C8),(0xF2C9),(0xF2CA),(0xF2CB),(0xF2CC),(0xF2CD),(0xF2CE),(0xF2CF),
|
||||
(0xF2D0),(0xF2D1),(0xF2D2),(0xF2D3),(0xF2D4),(0xF2D5),(0xF2D6),(0xF2D7),
|
||||
(0xF2D8),(0xF2D9),(0xF2DA),(0xF2DB),(0xF2DC),(0xF2DD),(0xF2DE),(0xF2DF),
|
||||
(0xF2E0),(0xF2E1),(0xF2E2),(0xF2E3),(0xF2E4),(0xF2E5),(0xF2E6),(0xF2E7),
|
||||
(0xF2E8),(0xF2E9),(0xF2EA),(0xF2EB),(0xF2EC),(0xF2ED),(0xF2EE),(0xF2EF),
|
||||
(0xF2F0),(0xF2F1),(0xF2F2),(0xF2F3),(0xF2F4),(0xF2F5),(0xF2F6),(0xF2F7),
|
||||
(0xF2F8),(0xF2F9),(0xF2FA),(0xF2FB),(0xF2FC),
|
||||
(0xF340),(0xF341),(0xF342),(0xF343),(0xF344),(0xF345),(0xF346),(0xF347),
|
||||
(0xF348),(0xF349),(0xF34A),(0xF34B),(0xF34C),(0xF34D),(0xF34E),(0xF34F),
|
||||
(0xF350),(0xF351),(0xF352),(0xF353),(0xF354),(0xF355),(0xF356),(0xF357),
|
||||
(0xF358),(0xF359),(0xF35A),(0xF35B),(0xF35C),(0xF35D),(0xF35E),(0xF35F),
|
||||
(0xF360),(0xF361),(0xF362),(0xF363),(0xF364),(0xF365),(0xF366),(0xF367),
|
||||
(0xF368),(0xF369),(0xF36A),(0xF36B),(0xF36C),(0xF36D),(0xF36E),(0xF36F),
|
||||
(0xF370),(0xF371),(0xF372),(0xF373),(0xF374),(0xF375),(0xF376),(0xF377),
|
||||
(0xF378),(0xF379),(0xF37A),(0xF37B),(0xF37C),(0xF37D),(0xF37E),
|
||||
(0xF380),(0xF381),(0xF382),(0xF383),(0xF384),(0xF385),(0xF386),(0xF387),
|
||||
(0xF388),(0xF389),(0xF38A),(0xF38B),(0xF38C),(0xF38D),(0xF38E),(0xF38F),
|
||||
(0xF390),(0xF391),(0xF392),(0xF393),(0xF394),(0xF395),(0xF396),(0xF397),
|
||||
(0xF398),(0xF399),(0xF39A),(0xF39B),(0xF39C),(0xF39D),(0xF39E),(0xF39F),
|
||||
(0xF3A0),(0xF3A1),(0xF3A2),(0xF3A3),(0xF3A4),(0xF3A5),(0xF3A6),(0xF3A7),
|
||||
(0xF3A8),(0xF3A9),(0xF3AA),(0xF3AB),(0xF3AC),(0xF3AD),(0xF3AE),(0xF3AF),
|
||||
(0xF3B0),(0xF3B1),(0xF3B2),(0xF3B3),(0xF3B4),(0xF3B5),(0xF3B6),(0xF3B7),
|
||||
(0xF3B8),(0xF3B9),(0xF3BA),(0xF3BB),(0xF3BC),(0xF3BD),(0xF3BE),(0xF3BF),
|
||||
(0xF3C0),(0xF3C1),(0xF3C2),(0xF3C3),(0xF3C4),(0xF3C5),(0xF3C6),(0xF3C7),
|
||||
(0xF3C8),(0xF3C9),(0xF3CA),(0xF3CB),(0xF3CC),(0xF3CD),(0xF3CE),(0xF3CF),
|
||||
(0xF3D0),(0xF3D1),(0xF3D2),(0xF3D3),(0xF3D4),(0xF3D5),(0xF3D6),(0xF3D7),
|
||||
(0xF3D8),(0xF3D9),(0xF3DA),(0xF3DB),(0xF3DC),(0xF3DD),(0xF3DE),(0xF3DF),
|
||||
(0xF3E0),(0xF3E1),(0xF3E2),(0xF3E3),(0xF3E4),(0xF3E5),(0xF3E6),(0xF3E7),
|
||||
(0xF3E8),(0xF3E9),(0xF3EA),(0xF3EB),(0xF3EC),(0xF3ED),(0xF3EE),(0xF3EF),
|
||||
(0xF3F0),(0xF3F1),(0xF3F2),(0xF3F3),(0xF3F4),(0xF3F5),(0xF3F6),(0xF3F7),
|
||||
(0xF3F8),(0xF3F9),(0xF3FA),(0xF3FB),(0xF3FC),
|
||||
(0xF440),(0xF441),(0xF442),(0xF443),(0xF444),(0xF445),(0xF446),(0xF447),
|
||||
(0xF448),(0xF449),(0xF44A),(0xF44B),(0xF44C),(0xF44D),(0xF44E),(0xF44F),
|
||||
(0xF450),(0xF451),(0xF452),(0xF453),(0xF454),(0xF455),(0xF456),(0xF457),
|
||||
(0xF458),(0xF459),(0xF45A),(0xF45B),(0xF45C),(0xF45D),(0xF45E),(0xF45F),
|
||||
(0xF460),(0xF461),(0xF462),(0xF463),(0xF464),(0xF465),(0xF466),(0xF467),
|
||||
(0xF468),(0xF469),(0xF46A),(0xF46B),(0xF46C),(0xF46D),(0xF46E),(0xF46F),
|
||||
(0xF470),(0xF471),(0xF472),(0xF473),(0xF474),(0xF475),(0xF476),(0xF477),
|
||||
(0xF478),(0xF479),(0xF47A),(0xF47B),(0xF47C),(0xF47D),(0xF47E),
|
||||
(0xF480),(0xF481),(0xF482),(0xF483),(0xF484),(0xF485),(0xF486),(0xF487),
|
||||
(0xF488),(0xF489),(0xF48A),(0xF48B),(0xF48C),(0xF48D),(0xF48E),(0xF48F),
|
||||
(0xF490),(0xF491),(0xF492),(0xF493),(0xF494),(0xF495),(0xF496),(0xF497),
|
||||
(0xF498),(0xF499),(0xF49A),(0xF49B),(0xF49C),(0xF49D),(0xF49E),(0xF49F),
|
||||
(0xF4A0),(0xF4A1),(0xF4A2),(0xF4A3),(0xF4A4),(0xF4A5),(0xF4A6),(0xF4A7),
|
||||
(0xF4A8),(0xF4A9),(0xF4AA),(0xF4AB),(0xF4AC),(0xF4AD),(0xF4AE),(0xF4AF),
|
||||
(0xF4B0),(0xF4B1),(0xF4B2),(0xF4B3),(0xF4B4),(0xF4B5),(0xF4B6),(0xF4B7),
|
||||
(0xF4B8),(0xF4B9),(0xF4BA),(0xF4BB),(0xF4BC),(0xF4BD),(0xF4BE),(0xF4BF),
|
||||
(0xF4C0),(0xF4C1),(0xF4C2),(0xF4C3),(0xF4C4),(0xF4C5),(0xF4C6),(0xF4C7),
|
||||
(0xF4C8),(0xF4C9),(0xF4CA),(0xF4CB),(0xF4CC),(0xF4CD),(0xF4CE),(0xF4CF),
|
||||
(0xF4D0),(0xF4D1),(0xF4D2),(0xF4D3),(0xF4D4),(0xF4D5),(0xF4D6),(0xF4D7),
|
||||
(0xF4D8),(0xF4D9),(0xF4DA),(0xF4DB),(0xF4DC),(0xF4DD),(0xF4DE),(0xF4DF),
|
||||
(0xF4E0),(0xF4E1),(0xF4E2),(0xF4E3),(0xF4E4),(0xF4E5),(0xF4E6),(0xF4E7),
|
||||
(0xF4E8),(0xF4E9),(0xF4EA),(0xF4EB),(0xF4EC),(0xF4ED),(0xF4EE),(0xF4EF),
|
||||
(0xF4F0),(0xF4F1),(0xF4F2),(0xF4F3),(0xF4F4),(0xF4F5),(0xF4F6),(0xF4F7),
|
||||
(0xF4F8),(0xF4F9),(0xF4FA),(0xF4FB),(0xF4FC),
|
||||
(0xF540),(0xF541),(0xF542),(0xF543),(0xF544),(0xF545),(0xF546),(0xF547),
|
||||
(0xF548),(0xF549),(0xF54A),(0xF54B),(0xF54C),(0xF54D),(0xF54E),(0xF54F),
|
||||
(0xF550),(0xF551),(0xF552),(0xF553),(0xF554),(0xF555),(0xF556),(0xF557),
|
||||
(0xF558),(0xF559),(0xF55A),(0xF55B),(0xF55C),(0xF55D),(0xF55E),(0xF55F),
|
||||
(0xF560),(0xF561),(0xF562),(0xF563),(0xF564),(0xF565),(0xF566),(0xF567),
|
||||
(0xF568),(0xF569),(0xF56A),(0xF56B),(0xF56C),(0xF56D),(0xF56E),(0xF56F),
|
||||
(0xF570),(0xF571),(0xF572),(0xF573),(0xF574),(0xF575),(0xF576),(0xF577),
|
||||
(0xF578),(0xF579),(0xF57A),(0xF57B),(0xF57C),(0xF57D),(0xF57E),
|
||||
(0xF580),(0xF581),(0xF582),(0xF583),(0xF584),(0xF585),(0xF586),(0xF587),
|
||||
(0xF588),(0xF589),(0xF58A),(0xF58B),(0xF58C),(0xF58D),(0xF58E),(0xF58F),
|
||||
(0xF590),(0xF591),(0xF592),(0xF593),(0xF594),(0xF595),(0xF596),(0xF597),
|
||||
(0xF598),(0xF599),(0xF59A),(0xF59B),(0xF59C),(0xF59D),(0xF59E),(0xF59F),
|
||||
(0xF5A0),(0xF5A1),(0xF5A2),(0xF5A3),(0xF5A4),(0xF5A5),(0xF5A6),(0xF5A7),
|
||||
(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),(0xF5AF),
|
||||
(0xF5B0),(0xF5B1),(0xF5B2),(0xF5B3),(0xF5B4),(0xF5B5),(0xF5B6),(0xF5B7),
|
||||
(0xF5B8),(0xF5B9),(0xF5BA),(0xF5BB),(0xF5BC),(0xF5BD),(0xF5BE),(0xF5BF),
|
||||
(0xF5C0),(0xF5C1),(0xF5C2),(0xF5C3),(0xF5C4),(0xF5C5),(0xF5C6),(0xF5C7),
|
||||
(0xF5C8),(0xF5C9),(0xF5CA),(0xF5CB),(0xF5CC),(0xF5CD),(0xF5CE),(0xF5CF),
|
||||
(0xF5D0),(0xF5D1),(0xF5D2),(0xF5D3),(0xF5D4),(0xF5D5),(0xF5D6),(0xF5D7),
|
||||
(0xF5D8),(0xF5D9),(0xF5DA),(0xF5DB),(0xF5DC),(0xF5DD),(0xF5DE),(0xF5DF),
|
||||
(0xF5E0),(0xF5E1),(0xF5E2),(0xF5E3),(0xF5E4),(0xF5E5),(0xF5E6),(0xF5E7),
|
||||
(0xF5E8),(0xF5E9),(0xF5EA),(0xF5EB),(0xF5EC),(0xF5ED),(0xF5EE),(0xF5EF),
|
||||
(0xF5F0),(0xF5F1),(0xF5F2),(0xF5F3),(0xF5F4),(0xF5F5),(0xF5F6),(0xF5F7),
|
||||
(0xF5F8),(0xF5F9),(0xF5FA),(0xF5FB),(0xF5FC),
|
||||
(0xF640),(0xF641),(0xF642),(0xF643),(0xF644),(0xF645),(0xF646),(0xF647),
|
||||
(0xF648),(0xF649),(0xF64A),(0xF64B),(0xF64C),(0xF64D),(0xF64E),(0xF64F),
|
||||
(0xF650),(0xF651),(0xF652),(0xF653),(0xF654),(0xF655),(0xF656),(0xF657),
|
||||
(0xF658),(0xF659),(0xF65A),(0xF65B),(0xF65C),(0xF65D),(0xF65E),(0xF65F),
|
||||
(0xF660),(0xF661),(0xF662),(0xF663),(0xF664),(0xF665),(0xF666),(0xF667),
|
||||
(0xF668),(0xF669),(0xF66A),(0xF66B),(0xF66C),(0xF66D),(0xF66E),(0xF66F),
|
||||
(0xF670),(0xF671),(0xF672),(0xF673),(0xF674),(0xF675),(0xF676),(0xF677),
|
||||
(0xF678),(0xF679),(0xF67A),(0xF67B),(0xF67C),(0xF67D),(0xF67E),
|
||||
(0xF680),(0xF681),(0xF682),(0xF683),(0xF684),(0xF685),(0xF686),(0xF687),
|
||||
(0xF688),(0xF689),(0xF68A),(0xF68B),(0xF68C),(0xF68D),(0xF68E),(0xF68F),
|
||||
(0xF690),(0xF691),(0xF692),(0xF693),(0xF694),(0xF695),(0xF696),(0xF697),
|
||||
(0xF698),(0xF699),(0xF69A),(0xF69B),(0xF69C),(0xF69D),(0xF69E),(0xF69F),
|
||||
(0xF6A0),(0xF6A1),(0xF6A2),(0xF6A3),(0xF6A4),(0xF6A5),(0xF6A6),(0xF6A7),
|
||||
(0xF6A8),(0xF6A9),(0xF6AA),(0xF6AB),(0xF6AC),(0xF6AD),(0xF6AE),(0xF6AF),
|
||||
(0xF6B0),(0xF6B1),(0xF6B2),(0xF6B3),(0xF6B4),(0xF6B5),(0xF6B6),(0xF6B7),
|
||||
(0xF6B8),(0xF6B9),(0xF6BA),(0xF6BB),(0xF6BC),(0xF6BD),(0xF6BE),(0xF6BF),
|
||||
(0xF6C0),(0xF6C1),(0xF6C2),(0xF6C3),(0xF6C4),(0xF6C5),(0xF6C6),(0xF6C7),
|
||||
(0xF6C8),(0xF6C9),(0xF6CA),(0xF6CB),(0xF6CC),(0xF6CD),(0xF6CE),(0xF6CF),
|
||||
(0xF6D0),(0xF6D1),(0xF6D2),(0xF6D3),(0xF6D4),(0xF6D5),(0xF6D6),(0xF6D7),
|
||||
(0xF6D8),(0xF6D9),(0xF6DA),(0xF6DB),(0xF6DC),(0xF6DD),(0xF6DE),(0xF6DF),
|
||||
(0xF6E0),(0xF6E1),(0xF6E2),(0xF6E3),(0xF6E4),(0xF6E5),(0xF6E6),(0xF6E7),
|
||||
(0xF6E8),(0xF6E9),(0xF6EA),(0xF6EB),(0xF6EC),(0xF6ED),(0xF6EE),(0xF6EF),
|
||||
(0xF6F0),(0xF6F1),(0xF6F2),(0xF6F3),(0xF6F4),(0xF6F5),(0xF6F6),(0xF6F7),
|
||||
(0xF6F8),(0xF6F9),(0xF6FA),(0xF6FB),(0xF6FC),
|
||||
(0xF740),(0xF741),(0xF742),(0xF743),(0xF744),(0xF745),(0xF746),(0xF747),
|
||||
(0xF748),(0xF749),(0xF74A),(0xF74B),(0xF74C),(0xF74D),(0xF74E),(0xF74F),
|
||||
(0xF750),(0xF751),(0xF752),(0xF753),(0xF754),(0xF755),(0xF756),(0xF757),
|
||||
(0xF758),(0xF759),(0xF75A),(0xF75B),(0xF75C),(0xF75D),(0xF75E),(0xF75F),
|
||||
(0xF760),(0xF761),(0xF762),(0xF763),(0xF764),(0xF765),(0xF766),(0xF767),
|
||||
(0xF768),(0xF769),(0xF76A),(0xF76B),(0xF76C),(0xF76D),(0xF76E),(0xF76F),
|
||||
(0xF770),(0xF771),(0xF772),(0xF773),(0xF774),(0xF775),(0xF776),(0xF777),
|
||||
(0xF778),(0xF779),(0xF77A),(0xF77B),(0xF77C),(0xF77D),(0xF77E),
|
||||
(0xF780),(0xF781),(0xF782),(0xF783),(0xF784),(0xF785),(0xF786),(0xF787),
|
||||
(0xF788),(0xF789),(0xF78A),(0xF78B),(0xF78C),(0xF78D),(0xF78E),(0xF78F),
|
||||
(0xF790),(0xF791),(0xF792),(0xF793),(0xF794),(0xF795),(0xF796),(0xF797),
|
||||
(0xF798),(0xF799),(0xF79A),(0xF79B),(0xF79C),(0xF79D),(0xF79E),(0xF79F),
|
||||
(0xF7A0),(0xF7A1),(0xF7A2),(0xF7A3),(0xF7A4),(0xF7A5),(0xF7A6),(0xF7A7),
|
||||
(0xF7A8),(0xF7A9),(0xF7AA),(0xF7AB),(0xF7AC),(0xF7AD),(0xF7AE),(0xF7AF),
|
||||
(0xF7B0),(0xF7B1),(0xF7B2),(0xF7B3),(0xF7B4),(0xF7B5),(0xF7B6),(0xF7B7),
|
||||
(0xF7B8),(0xF7B9),(0xF7BA),(0xF7BB),(0xF7BC),(0xF7BD),(0xF7BE),(0xF7BF),
|
||||
(0xF7C0),(0xF7C1),(0xF7C2),(0xF7C3),(0xF7C4),(0xF7C5),(0xF7C6),(0xF7C7),
|
||||
(0xF7C8),(0xF7C9),(0xF7CA),(0xF7CB),(0xF7CC),(0xF7CD),(0xF7CE),(0xF7CF),
|
||||
(0xF7D0),(0xF7D1),(0xF7D2),(0xF7D3),(0xF7D4),(0xF7D5),(0xF7D6),(0xF7D7),
|
||||
(0xF7D8),(0xF7D9),(0xF7DA),(0xF7DB),(0xF7DC),(0xF7DD),(0xF7DE),(0xF7DF),
|
||||
(0xF7E0),(0xF7E1),(0xF7E2),(0xF7E3),(0xF7E4),(0xF7E5),(0xF7E6),(0xF7E7),
|
||||
(0xF7E8),(0xF7E9),(0xF7EA),(0xF7EB),(0xF7EC),(0xF7ED),(0xF7EE),(0xF7EF),
|
||||
(0xF7F0),(0xF7F1),(0xF7F2),(0xF7F3),(0xF7F4),(0xF7F5),(0xF7F6),(0xF7F7),
|
||||
(0xF7F8),(0xF7F9),(0xF7FA),(0xF7FB),(0xF7FC),
|
||||
(0xF840),(0xF841),(0xF842),(0xF843),(0xF844),(0xF845),(0xF846),(0xF847),
|
||||
(0xF848),(0xF849),(0xF84A),(0xF84B),(0xF84C),(0xF84D),(0xF84E),(0xF84F),
|
||||
(0xF850),(0xF851),(0xF852),(0xF853),(0xF854),(0xF855),(0xF856),(0xF857),
|
||||
(0xF858),(0xF859),(0xF85A),(0xF85B),(0xF85C),(0xF85D),(0xF85E),(0xF85F),
|
||||
(0xF860),(0xF861),(0xF862),(0xF863),(0xF864),(0xF865),(0xF866),(0xF867),
|
||||
(0xF868),(0xF869),(0xF86A),(0xF86B),(0xF86C),(0xF86D),(0xF86E),(0xF86F),
|
||||
(0xF870),(0xF871),(0xF872),(0xF873),(0xF874),(0xF875),(0xF876),(0xF877),
|
||||
(0xF878),(0xF879),(0xF87A),(0xF87B),(0xF87C),(0xF87D),(0xF87E),
|
||||
(0xF880),(0xF881),(0xF882),(0xF883),(0xF884),(0xF885),(0xF886),(0xF887),
|
||||
(0xF888),(0xF889),(0xF88A),(0xF88B),(0xF88C),(0xF88D),(0xF88E),(0xF88F),
|
||||
(0xF890),(0xF891),(0xF892),(0xF893),(0xF894),(0xF895),(0xF896),(0xF897),
|
||||
(0xF898),(0xF899),(0xF89A),(0xF89B),(0xF89C),(0xF89D),(0xF89E),(0xF89F),
|
||||
(0xF8A0),(0xF8A1),(0xF8A2),(0xF8A3),(0xF8A4),(0xF8A5),(0xF8A6),(0xF8A7),
|
||||
(0xF8A8),(0xF8A9),(0xF8AA),(0xF8AB),(0xF8AC),(0xF8AD),(0xF8AE),(0xF8AF),
|
||||
(0xF8B0),(0xF8B1),(0xF8B2),(0xF8B3),(0xF8B4),(0xF8B5),(0xF8B6),(0xF8B7),
|
||||
(0xF8B8),(0xF8B9),(0xF8BA),(0xF8BB),(0xF8BC),(0xF8BD),(0xF8BE),(0xF8BF),
|
||||
(0xF8C0),(0xF8C1),(0xF8C2),(0xF8C3),(0xF8C4),(0xF8C5),(0xF8C6),(0xF8C7),
|
||||
(0xF8C8),(0xF8C9),(0xF8CA),(0xF8CB),(0xF8CC),(0xF8CD),(0xF8CE),(0xF8CF),
|
||||
(0xF8D0),(0xF8D1),(0xF8D2),(0xF8D3),(0xF8D4),(0xF8D5),(0xF8D6),(0xF8D7),
|
||||
(0xF8D8),(0xF8D9),(0xF8DA),(0xF8DB),(0xF8DC),(0xF8DD),(0xF8DE),(0xF8DF),
|
||||
(0xF8E0),(0xF8E1),(0xF8E2),(0xF8E3),(0xF8E4),(0xF8E5),(0xF8E6),(0xF8E7),
|
||||
(0xF8E8),(0xF8E9),(0xF8EA),(0xF8EB),(0xF8EC),(0xF8ED),(0xF8EE),(0xF8EF),
|
||||
(0xF8F0),(0xF8F1),(0xF8F2),(0xF8F3),(0xF8F4),(0xF8F5),(0xF8F6),(0xF8F7),
|
||||
(0xF8F8),(0xF8F9),(0xF8FA),(0xF8FB),(0xF8FC),
|
||||
(0xF940),(0xF941),(0xF942),(0xF943),(0xF944),(0xF945),(0xF946),(0xF947),
|
||||
(0xF948),(0xF949),(0xF94A),(0xF94B),(0xF94C),(0xF94D),(0xF94E),(0xF94F),
|
||||
(0xF950),(0xF951),(0xF952),(0xF953),(0xF954),(0xF955),(0xF956),(0xF957),
|
||||
(0xF958),(0xF959),(0xF95A),(0xF95B),(0xF95C),(0xF95D),(0xF95E),(0xF95F),
|
||||
(0xF960),(0xF961),(0xF962),(0xF963),(0xF964),(0xF965),(0xF966),(0xF967),
|
||||
(0xF968),(0xF969),(0xF96A),(0xF96B),(0xF96C),(0xF96D),(0xF96E),(0xF96F),
|
||||
(0xF970),(0xF971),(0xF972),(0xF973),(0xF974),(0xF975),(0xF976),(0xF977),
|
||||
(0xF978),(0xF979),(0xF97A),(0xF97B),(0xF97C),(0xF97D),(0xF97E),
|
||||
(0xF980),(0xF981),(0xF982),(0xF983),(0xF984),(0xF985),(0xF986),(0xF987),
|
||||
(0xF988),(0xF989),(0xF98A),(0xF98B),(0xF98C),(0xF98D),(0xF98E),(0xF98F),
|
||||
(0xF990),(0xF991),(0xF992),(0xF993),(0xF994),(0xF995),(0xF996),(0xF997),
|
||||
(0xF998),(0xF999),(0xF99A),(0xF99B),(0xF99C),(0xF99D),(0xF99E),(0xF99F),
|
||||
(0xF9A0),(0xF9A1),(0xF9A2),(0xF9A3),(0xF9A4),(0xF9A5),(0xF9A6),(0xF9A7),
|
||||
(0xF9A8),(0xF9A9),(0xF9AA),(0xF9AB),(0xF9AC),(0xF9AD),(0xF9AE),(0xF9AF),
|
||||
(0xF9B0),(0xF9B1),(0xF9B2),(0xF9B3),(0xF9B4),(0xF9B5),(0xF9B6),(0xF9B7),
|
||||
(0xF9B8),(0xF9B9),(0xF9BA),(0xF9BB),(0xF9BC),(0xF9BD),(0xF9BE),(0xF9BF),
|
||||
(0xF9C0),(0xF9C1),(0xF9C2),(0xF9C3),(0xF9C4),(0xF9C5),(0xF9C6),(0xF9C7),
|
||||
(0xF9C8),(0xF9C9),(0xF9CA),(0xF9CB),(0xF9CC),(0xF9CD),(0xF9CE),(0xF9CF),
|
||||
(0xF9D0),(0xF9D1),(0xF9D2),(0xF9D3),(0xF9D4),(0xF9D5),(0xF9D6),(0xF9D7),
|
||||
(0xF9D8),(0xF9D9),(0xF9DA),(0xF9DB),(0xF9DC),(0xF9DD),(0xF9DE),(0xF9DF),
|
||||
(0xF9E0),(0xF9E1),(0xF9E2),(0xF9E3),(0xF9E4),(0xF9E5),(0xF9E6),(0xF9E7),
|
||||
(0xF9E8),(0xF9E9),(0xF9EA),(0xF9EB),(0xF9EC),(0xF9ED),(0xF9EE),(0xF9EF),
|
||||
(0xF9F0),(0xF9F1),(0xF9F2),(0xF9F3),(0xF9F4),(0xF9F5),(0xF9F6),(0xF9F7),
|
||||
(0xF9F8),(0xF9F9),(0xF9FA),(0xF9FB),(0xF9FC);
|
||||
|
||||
#Test that all the characters are stored correctly
|
||||
SELECT HEX(c1) FROM t1;
|
||||
|
||||
#Test conversion to ucs2
|
||||
CREATE TABLE t2 SELECT CONVERT(c1 USING ucs2) AS c1 FROM t1;
|
||||
SELECT HEX(c1) FROM t2;
|
||||
|
||||
#Test round trip conversion
|
||||
CREATE TABLE t3 SELECT CONVERT(c1 USING cp932) AS c1 FROM t2;
|
||||
SELECT HEX(c1) FROM t3;
|
||||
|
||||
#Test conversion to eucjpms
|
||||
CREATE TABLE t4 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t1;
|
||||
SELECT HEX(c1) FROM t4;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t4;
|
||||
|
||||
SET collation_connection='cp932_japanese_ci';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_range_f1f2.inc
|
||||
SET collation_connection='cp932_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_range_f1f2.inc
|
||||
|
||||
#
|
||||
# Bug#29333 myisam corruption with
|
||||
# character set cp932 collate cp932_japanese_ci
|
||||
#
|
||||
create table t2 (a char(1));
|
||||
insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
|
||||
insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
|
||||
create table t1 (
|
||||
a varchar(2) character set cp932
|
||||
) engine=myisam;
|
||||
--disable_warnings
|
||||
insert into t1
|
||||
select unhex(concat(t24.a, t23.a, t22.a, t21.a))
|
||||
from t2 t21, t2 t22, t2 t23, t2 t24;
|
||||
--enable_warnings
|
||||
delete from t1 where a='';
|
||||
alter table t1 add key(a);
|
||||
check table t1;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug#12547: Inserting long string into varchar causes table crash in cp932
|
||||
#
|
||||
create table t1 (col1 varchar(1)) character set cp932;
|
||||
insert into t1 values ('a');
|
||||
insert into t1 values ('ab');
|
||||
select * from t1;
|
||||
insert into t1 values ('abc');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#25815 Data truncated for column TEXT
|
||||
#
|
||||
set names utf8;
|
||||
create table t1 (a text) default character set cp932;
|
||||
insert into t1 values (_utf8 0xE38182);
|
||||
show warnings;
|
||||
select * from t1;
|
||||
select hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#16217 - MySQL client misinterpretes multi-byte char as escape `\'
|
||||
#
|
||||
|
||||
# new command \C or charset
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
|
||||
--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
|
||||
|
||||
# its usage to switch internally in mysql to requested charset
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'"
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'"
|
||||
@@ -0,0 +1,35 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_cp932.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
--character_set cp932
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
set names cp932;
|
||||
set character_set_database = cp932;
|
||||
|
||||
# Test prepared statement with 0x8300 sequence in parameter while
|
||||
# running with cp932 client character set.
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1(f1 blob);
|
||||
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
|
||||
SET @var1= x'8300';
|
||||
# TODO: Note that this doesn't actually test the code which was added for
|
||||
# bug#11338 because this syntax for prepared statements causes the PS to
|
||||
# be replicated differently than if we executed the PS from C or Java.
|
||||
# Using this syntax, variable names are inserted into the binlog instead
|
||||
# of values. The real goal of this test is to check the code that was
|
||||
# added to Item_param::query_val_str() in order to do hex encoding of
|
||||
# PS parameters when the client character set is cp932;
|
||||
# Bug#11338 has an example java program which can be used to verify this
|
||||
# code (and I have used it to test the fix) until there is some way to
|
||||
# exercise this code from mysql-test-run.
|
||||
EXECUTE stmt1 USING @var1;
|
||||
source include/show_binlog_events.inc;
|
||||
SELECT HEX(f1) FROM t1;
|
||||
DROP table t1;
|
||||
# end test for bug#11338
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,23 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
#
|
||||
# Check correct binlogging of UCS2 user variables (BUG#3875)
|
||||
#
|
||||
SET TIMESTAMP=10000;
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
reset master;
|
||||
insert into t2 values (@v);
|
||||
source include/show_binlog_events.inc;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
flush logs;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
|
||||
drop table t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
32
build/lib/mysql/mysql-test/extra/binlog_tests/database.test
Normal file
32
build/lib/mysql/mysql-test/extra/binlog_tests/database.test
Normal file
@@ -0,0 +1,32 @@
|
||||
source include/have_log_bin.inc;
|
||||
source include/not_embedded.inc;
|
||||
|
||||
# Checking that the drop of a database does not replicate anything in
|
||||
# addition to the drop of the database
|
||||
|
||||
reset master;
|
||||
create database testing_1;
|
||||
use testing_1;
|
||||
create table t1 (a int);
|
||||
create function sf1 (a int) returns int return a+1;
|
||||
create trigger tr1 before insert on t1 for each row insert into t2 values (2*new.a);
|
||||
create procedure sp1 (a int) insert into t1 values(a);
|
||||
drop database testing_1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# BUG#38773: DROP DATABASE cause switch to stmt-mode when there are
|
||||
# temporary tables open
|
||||
|
||||
use test;
|
||||
reset master;
|
||||
create temporary table tt1 (a int);
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
disable_warnings;
|
||||
drop database if exists mysqltest1;
|
||||
enable_warnings;
|
||||
insert into t1 values (1);
|
||||
drop table tt1, t1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
FLUSH STATUS;
|
||||
@@ -0,0 +1,72 @@
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS `drop-temp+table-test`;
|
||||
--enable_warnings
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
connection con1;
|
||||
RESET MASTER;
|
||||
CREATE DATABASE `drop-temp+table-test`;
|
||||
USE `drop-temp+table-test`;
|
||||
CREATE TEMPORARY TABLE shortn1 (a INT);
|
||||
CREATE TEMPORARY TABLE `table:name` (a INT);
|
||||
CREATE TEMPORARY TABLE shortn2 (a INT);
|
||||
|
||||
##############################################################################
|
||||
# BUG#46572 DROP TEMPORARY table IF EXISTS does not have a consistent behavior
|
||||
# in ROW mode
|
||||
#
|
||||
# In RBR, 'DROP TEMPORARY TABLE ...' statement should never be binlogged no
|
||||
# matter if the tables exist or not. In contrast, both in SBR and MBR, the
|
||||
# statement should be always binlogged no matter if the tables exist or not.
|
||||
##############################################################################
|
||||
CREATE TEMPORARY TABLE tmp(c1 int);
|
||||
CREATE TEMPORARY TABLE tmp1(c1 int);
|
||||
CREATE TEMPORARY TABLE tmp2(c1 int);
|
||||
CREATE TEMPORARY TABLE tmp3(c1 int);
|
||||
CREATE TABLE t(c1 int);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp;
|
||||
|
||||
--disable_warnings
|
||||
# Before fixing BUG#46572, 'DROP TEMPORARY TABLE IF EXISTS...' statement was
|
||||
# binlogged when the table did not exist in RBR.
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp;
|
||||
|
||||
# In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged no matter if
|
||||
# the tables exist or not.
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
|
||||
DROP TEMPORARY TABLE tmp3;
|
||||
|
||||
#In RBR, tmp2 will NOT be binlogged, because it is a temporary table.
|
||||
DROP TABLE IF EXISTS tmp2, t;
|
||||
|
||||
#In RBR, tmp2 will be binlogged, because it does not exist and master do not know
|
||||
# whether it is a temporary table or not.
|
||||
DROP TABLE IF EXISTS tmp2, t;
|
||||
--enable_warnings
|
||||
|
||||
SELECT GET_LOCK("a",10);
|
||||
|
||||
#
|
||||
# BUG48216 Replication fails on all slaves after upgrade to 5.0.86 on master
|
||||
#
|
||||
# When the session is closed, any temporary tables of the session are dropped
|
||||
# and are binlogged. But it will be binlogged with a wrong database name when
|
||||
# the length of the database name('drop-temp-table-test') is greater than the
|
||||
# current database name('test').
|
||||
#
|
||||
USE test;
|
||||
disconnect con1;
|
||||
|
||||
connection con2;
|
||||
# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
|
||||
# guarantee that logging of the terminated con1 has been done yet.
|
||||
# To be sure that logging has been done, we use a user lock.
|
||||
SELECT GET_LOCK("a",10);
|
||||
let $VERSION=`SELECT VERSION()`;
|
||||
source include/show_binlog_events.inc;
|
||||
DROP DATABASE `drop-temp+table-test`;
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,41 @@
|
||||
# Embedded server doesn't support binlog
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
#
|
||||
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
|
||||
# Actually this test has nothing to do with innodb per se, it just requires
|
||||
# transactional table.
|
||||
#
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int) engine=innodb;
|
||||
|
||||
# Now we are going to create transaction which is long enough so its
|
||||
# transaction binlog will be flushed to disk...
|
||||
let $1=2000;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
enable_query_log;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
|
||||
# Transaction which should not be flushed to disk and so should not
|
||||
# increase binlog_cache_disk_use.
|
||||
begin;
|
||||
delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
drop table t1;
|
||||
@@ -0,0 +1,38 @@
|
||||
# Embedded server doesn't support binlog
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
# Check if a partly-completed INSERT SELECT in a MyISAM table goes into the
|
||||
# binlog
|
||||
|
||||
create table t1(a int, unique(a));
|
||||
insert into t1 values(2);
|
||||
create table t2(a int);
|
||||
insert into t2 values(1),(2);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 select * from t2;
|
||||
# The above should produce an error, but still be in the binlog;
|
||||
# verify the binlog :
|
||||
let $VERSION=`select version()`;
|
||||
source include/show_binlog_events.inc;
|
||||
select * from t1;
|
||||
drop table t1, t2;
|
||||
|
||||
# Verify that a partly-completed CREATE TABLE .. SELECT does not
|
||||
# get into the binlog (Bug #6682)
|
||||
create table t1(a int);
|
||||
insert into t1 values(1),(1);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY
|
||||
create table t2(unique(a)) select a from t1;
|
||||
# The above should produce an error, *and* not appear in the binlog
|
||||
let $VERSION=`select version()`;
|
||||
source include/show_binlog_events.inc;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,639 @@
|
||||
# Check that binlog is ok when a transaction mixes updates to InnoDB and
|
||||
# MyISAM.
|
||||
# It would be nice to make this a replication test, but in 4.0 the
|
||||
# slave is always with --skip-innodb in the testsuite. I (Guilhem) however
|
||||
# did some tests manually on a slave; tables are replicated fine and
|
||||
# Exec_Master_Log_Pos advances as expected.
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
connection con1;
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (a int) engine=myisam;
|
||||
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
insert into t2 select * from t1;
|
||||
commit;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(2);
|
||||
insert into t2 select * from t1;
|
||||
# should say some changes to non-transact1onal tables couldn't be rolled back
|
||||
rollback;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(3);
|
||||
savepoint my_savepoint;
|
||||
insert into t1 values(4);
|
||||
insert into t2 select * from t1;
|
||||
rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(5);
|
||||
savepoint my_savepoint;
|
||||
insert into t1 values(6);
|
||||
insert into t2 select * from t1;
|
||||
rollback to savepoint my_savepoint;
|
||||
insert into t1 values(7);
|
||||
commit;
|
||||
select a from t1 order by a; # check that savepoints work :)
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# and when ROLLBACK is not explicit?
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
select get_lock("a",10);
|
||||
begin;
|
||||
insert into t1 values(8);
|
||||
insert into t2 select * from t1;
|
||||
disconnect con1;
|
||||
|
||||
connection con2;
|
||||
# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
|
||||
# guarantee that logging of the terminated con1 has been done yet (it may not
|
||||
# even be started, so con1 may have not even attempted to lock the binlog yet;
|
||||
# so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that
|
||||
# logging has been done, we use a user lock.
|
||||
select get_lock("a",10);
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# and when not in a transact1on?
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
insert into t1 values(9);
|
||||
insert into t2 select * from t1;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# Check that when the query updat1ng the MyISAM table is the first in the
|
||||
# transaction, we log it immediately.
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
insert into t1 values(10); # first make t1 non-empty
|
||||
begin;
|
||||
insert into t2 select * from t1;
|
||||
source include/show_binlog_events.inc;
|
||||
insert into t1 values(11);
|
||||
commit;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# Check that things work like before this BEGIN/ROLLBACK code was added,
|
||||
# when t2 is INNODB
|
||||
|
||||
alter table t2 engine=INNODB;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(12);
|
||||
insert into t2 select * from t1;
|
||||
commit;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(13);
|
||||
insert into t2 select * from t1;
|
||||
rollback;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(14);
|
||||
savepoint my_savepoint;
|
||||
insert into t1 values(15);
|
||||
insert into t2 select * from t1;
|
||||
rollback to savepoint my_savepoint;
|
||||
commit;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values(16);
|
||||
savepoint my_savepoint;
|
||||
insert into t1 values(17);
|
||||
insert into t2 select * from t1;
|
||||
rollback to savepoint my_savepoint;
|
||||
insert into t1 values(18);
|
||||
commit;
|
||||
select a from t1 order by a; # check that savepoints work :)
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# Test for BUG#5714, where a MyISAM update in the transaction used to
|
||||
# release row-level locks in InnoDB
|
||||
|
||||
connect (con3,localhost,root,,);
|
||||
|
||||
connection con3;
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
--disable_warnings
|
||||
alter table t2 engine=MyISAM;
|
||||
--enable_warnings
|
||||
insert into t1 values (1);
|
||||
begin;
|
||||
select * from t1 for update;
|
||||
|
||||
connection con2;
|
||||
select (@before:=unix_timestamp())*0; # always give repeatable output
|
||||
begin;
|
||||
send select * from t1 for update;
|
||||
|
||||
connection con3;
|
||||
insert into t2 values (20);
|
||||
|
||||
connection con2;
|
||||
--error 1205
|
||||
reap;
|
||||
select (@after:=unix_timestamp())*0; # always give repeatable output
|
||||
# verify that innodb_lock_wait_timeout was exceeded. When there was
|
||||
# the bug, the reap would return immediately after the insert into t2.
|
||||
select (@after-@before) >= 2;
|
||||
|
||||
drop table t1,t2;
|
||||
commit;
|
||||
|
||||
# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in
|
||||
# the middle of a transaction
|
||||
|
||||
connection con2;
|
||||
begin;
|
||||
create temporary table ti (a int) engine=innodb;
|
||||
rollback;
|
||||
insert into ti values(1);
|
||||
set autocommit=0;
|
||||
create temporary table t1 (a int) engine=myisam;
|
||||
commit;
|
||||
insert t1 values (1);
|
||||
rollback;
|
||||
create table t0 (n int);
|
||||
insert t0 select * from t1;
|
||||
set autocommit=1;
|
||||
insert into t0 select GET_LOCK("lock1",null);
|
||||
set autocommit=0;
|
||||
create table t2 (n int) engine=innodb;
|
||||
insert into t2 values (3);
|
||||
disconnect con2;
|
||||
connection con3;
|
||||
select get_lock("lock1",60);
|
||||
source include/show_binlog_events.inc;
|
||||
do release_lock("lock1");
|
||||
drop table t0,t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Test behaviour of CREATE ... SELECT when mixing MyISAM and InnoDB tables
|
||||
#
|
||||
|
||||
set autocommit=0;
|
||||
CREATE TABLE t1 (a int, b int) engine=myisam;
|
||||
reset master;
|
||||
INSERT INTO t1 values (1,1),(1,2);
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TABLE t2 (primary key (a)) engine=innodb select * from t1;
|
||||
# This should give warning
|
||||
DROP TABLE if exists t2;
|
||||
INSERT INTO t1 values (3,3);
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1;
|
||||
ROLLBACK;
|
||||
# This should give warning
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
|
||||
INSERT INTO t1 VALUES (4,4);
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
|
||||
SELECT * from t2;
|
||||
TRUNCATE table t2;
|
||||
INSERT INTO t1 VALUES (5,5);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t2 select * from t1;
|
||||
SELECT * FROM t2;
|
||||
DROP TABLE t2;
|
||||
|
||||
INSERT INTO t1 values (6,6);
|
||||
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb ;
|
||||
INSERT INTO t1 values (7,7);
|
||||
ROLLBACK;
|
||||
INSERT INTO t1 values (8,8);
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
|
||||
COMMIT;
|
||||
INSERT INTO t1 values (9,9);
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
|
||||
ROLLBACK;
|
||||
SELECT * from t2;
|
||||
TRUNCATE table t2;
|
||||
INSERT INTO t1 values (10,10);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t2 select * from t1;
|
||||
SELECT * from t1;
|
||||
INSERT INTO t2 values (100,100);
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
|
||||
COMMIT;
|
||||
INSERT INTO t2 values (101,101);
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
|
||||
ROLLBACK;
|
||||
SELECT * from t2;
|
||||
DROP TABLE t1,t2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# Test for BUG#16559 (ROLLBACK should always have a zero error code in
|
||||
# binlog). Has to be here and not earlier, as the SELECTs influence
|
||||
# XIDs differently between normal and ps-protocol (and SHOW BINLOG
|
||||
# EVENTS above read XIDs).
|
||||
|
||||
connect (con4,localhost,root,,);
|
||||
connection con3;
|
||||
reset master;
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (a int) engine=myisam;
|
||||
select get_lock("a",10);
|
||||
begin;
|
||||
insert into t1 values(8);
|
||||
insert into t2 select * from t1;
|
||||
disconnect con3;
|
||||
|
||||
connection con4;
|
||||
select get_lock("a",10); # wait for rollback to finish
|
||||
flush logs;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
# we check that the error code of the "ROLLBACK" event is 0 and not
|
||||
# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
|
||||
# and does not make slave to stop)
|
||||
if (`select @@binlog_format = 'ROW'`)
|
||||
{
|
||||
--exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
|
||||
}
|
||||
|
||||
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
--exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
|
||||
}
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval select
|
||||
@a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
|
||||
@a like "%#%error_code=0%ROLLBACK\\r\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
|
||||
@a not like "%#%error_code=%error_code=%";
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
|
||||
# bug #28960 non-trans temp table changes with insert .. select
|
||||
# not binlogged after rollback
|
||||
#
|
||||
# testing appearence of insert into temp_table in binlog.
|
||||
# There are two branches of execution that require different setup.
|
||||
|
||||
## send_eof() branch
|
||||
|
||||
# prepare
|
||||
|
||||
create temporary table tt (a int unique);
|
||||
create table ti (a int) engine=innodb;
|
||||
reset master;
|
||||
|
||||
# action
|
||||
|
||||
begin;
|
||||
insert into ti values (1);
|
||||
insert into ti values (2) ;
|
||||
insert into tt select * from ti;
|
||||
rollback;
|
||||
|
||||
# check
|
||||
|
||||
select count(*) from tt /* 2 */;
|
||||
source include/show_binlog_events.inc;
|
||||
select count(*) from ti /* zero */;
|
||||
insert into ti select * from tt;
|
||||
select * from ti /* that is what slave would miss - a bug */;
|
||||
|
||||
|
||||
## send_error() branch
|
||||
delete from ti;
|
||||
delete from tt where a=1;
|
||||
reset master;
|
||||
|
||||
# action
|
||||
|
||||
begin;
|
||||
insert into ti values (1);
|
||||
insert into ti values (2) /* to make the dup error in the following */;
|
||||
--error ER_DUP_ENTRY
|
||||
insert into tt select * from ti /* one affected and error */;
|
||||
rollback;
|
||||
|
||||
# check
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
select count(*) from ti /* zero */;
|
||||
insert into ti select * from tt;
|
||||
select * from tt /* that is what otherwise slave missed - the bug */;
|
||||
|
||||
drop table ti, tt;
|
||||
|
||||
|
||||
#
|
||||
# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
|
||||
#
|
||||
# Testing asserts: if there is a side effect of modifying non-transactional
|
||||
# table thd->no_trans_update.stmt must be TRUE;
|
||||
# the assert is active with debug build
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop function if exists bug27417;
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
# side effect table
|
||||
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
|
||||
# target tables
|
||||
CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a));
|
||||
|
||||
delimiter |;
|
||||
create function bug27417(n int)
|
||||
RETURNS int(11)
|
||||
begin
|
||||
insert into t1 values (null);
|
||||
return n;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
|
||||
insert into t2 values (bug27417(1));
|
||||
insert into t2 select bug27417(2);
|
||||
reset master;
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t2 values (bug27417(2));
|
||||
source include/show_binlog_events.inc; /* only (!) with fixes for #23333 will show there is the query */;
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
|
||||
reset master;
|
||||
select count(*) from t2;
|
||||
delete from t2 where a=bug27417(3);
|
||||
select count(*) from t2 /* nothing got deleted */;
|
||||
source include/show_binlog_events.inc; /* the query must be in regardless of #23333 */;
|
||||
select count(*) from t1 /* must be 5 */;
|
||||
|
||||
--enable_info
|
||||
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
|
||||
--disable_info
|
||||
select count(*) from t1 /* must be 7 */;
|
||||
|
||||
# function bug27417 remains for the following testing of bug#23333
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#23333 using the patch (and the test) for bug#27471
|
||||
#
|
||||
# throughout the bug tests
|
||||
# t1 - non-trans side effects gatherer;
|
||||
# t2 - transactional table;
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM;
|
||||
CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb;
|
||||
CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
|
||||
|
||||
#
|
||||
# INSERT
|
||||
#
|
||||
|
||||
# prepare
|
||||
|
||||
insert into t2 values (1);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t2 values (bug27417(1));
|
||||
|
||||
# check
|
||||
|
||||
source include/show_binlog_events.inc; /* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
#
|
||||
# INSERT SELECT
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t2 values (2);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t2 select bug27417(1) union select bug27417(2);
|
||||
|
||||
# check
|
||||
|
||||
source include/show_binlog_events.inc; /* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
|
||||
#
|
||||
# UPDATE inc multi-update
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
insert into t3 values (1,1),(2,3),(3,4);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
update t3 set b=b+bug27417(1);
|
||||
|
||||
# check
|
||||
source include/show_binlog_events.inc; /* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
|
||||
## multi_update::send_eof() branch
|
||||
|
||||
# prepare
|
||||
delete from t3;
|
||||
delete from t4;
|
||||
insert into t3 values (1,1);
|
||||
insert into t4 values (1,1),(2,2);
|
||||
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
|
||||
|
||||
# check
|
||||
source include/show_binlog_events.inc; /* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
|
||||
## send_error() branch of multi_update
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t3;
|
||||
delete from t4;
|
||||
insert into t3 values (1,1),(2,2);
|
||||
insert into t4 values (1,1),(2,2);
|
||||
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
|
||||
|
||||
# check
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
# cleanup
|
||||
drop table t4;
|
||||
|
||||
|
||||
#
|
||||
# DELETE incl multi-delete
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
delete from t3;
|
||||
insert into t2 values (1);
|
||||
insert into t3 values (1,1);
|
||||
create trigger trg_del before delete on t2 for each row
|
||||
insert into t3 values (bug27417(1), 2);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
delete from t2;
|
||||
# check
|
||||
source include/show_binlog_events.inc; /* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
# cleanup
|
||||
drop trigger trg_del;
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
delete from t5;
|
||||
create trigger trg_del_t2 after delete on t2 for each row
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (2),(3);
|
||||
insert into t5 values (1),(2);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
delete t2.* from t2,t5 where t2.a=t5.a + 1;
|
||||
|
||||
# check
|
||||
source include/show_binlog_events.inc; /* the output must denote there is the query */;
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
|
||||
#
|
||||
# LOAD DATA
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
create table t4 (a int default 0, b int primary key) engine=innodb;
|
||||
insert into t4 values (0, 17);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
|
||||
# check
|
||||
select * from t4;
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
source include/show_binlog_events.inc; /* the output must denote there is the query */;
|
||||
|
||||
#
|
||||
# bug#23333 cleanup
|
||||
#
|
||||
|
||||
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
drop function bug27417;
|
||||
|
||||
|
||||
--echo end of tests
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
# the file to be sourced from binlog.binlog_mix_innodb_myisam
|
||||
|
||||
#
|
||||
# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
|
||||
# bug #28960 non-trans temp table changes with insert .. select
|
||||
# not binlogged after rollback
|
||||
#
|
||||
# testing appearence of insert into temp_table in binlog.
|
||||
# There are two branches of execution that require different setup.
|
||||
|
||||
# checking binlog content filled with row-based events due to
|
||||
# a used stored function modifies non-transactional table
|
||||
|
||||
## send_eof() branch
|
||||
|
||||
# prepare
|
||||
|
||||
create temporary table tt (a int unique);
|
||||
create table ti (a int) engine=innodb;
|
||||
reset master;
|
||||
|
||||
# action
|
||||
|
||||
begin;
|
||||
insert into ti values (1);
|
||||
insert into ti values (2) ;
|
||||
insert into tt select * from ti;
|
||||
rollback;
|
||||
|
||||
# check
|
||||
|
||||
select count(*) from tt /* 2 */;
|
||||
source include/show_binlog_events.inc;
|
||||
select count(*) from ti /* zero */;
|
||||
insert into ti select * from tt;
|
||||
select * from ti /* that is what slave would miss - bug#28960 */;
|
||||
|
||||
|
||||
## send_error() branch
|
||||
delete from ti;
|
||||
delete from tt where a=1;
|
||||
reset master;
|
||||
|
||||
# action
|
||||
|
||||
begin;
|
||||
insert into ti values (1);
|
||||
insert into ti values (2) /* to make the dup error in the following */;
|
||||
--error ER_DUP_ENTRY
|
||||
insert into tt select * from ti /* one affected and error */;
|
||||
rollback;
|
||||
|
||||
# check
|
||||
|
||||
source include/show_binlog_events.inc; # nothing in binlog with row bilog format
|
||||
select count(*) from ti /* zero */;
|
||||
insert into ti select * from tt;
|
||||
select * from tt /* that is what otherwise slave missed - the bug */;
|
||||
|
||||
drop table ti;
|
||||
|
||||
|
||||
#
|
||||
# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
|
||||
#
|
||||
# Testing asserts: if there is a side effect of modifying non-transactional
|
||||
# table thd->no_trans_update.stmt must be TRUE;
|
||||
# the assert is active with debug build
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop function if exists bug27417;
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
# side effect table
|
||||
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
|
||||
# target tables
|
||||
CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a));
|
||||
|
||||
delimiter |;
|
||||
create function bug27417(n int)
|
||||
RETURNS int(11)
|
||||
begin
|
||||
insert into t1 values (null);
|
||||
return n;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
|
||||
insert into t2 values (bug27417(1));
|
||||
insert into t2 select bug27417(2);
|
||||
reset master;
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t2 values (bug27417(2));
|
||||
source include/show_binlog_events.inc; #only (!) with fixes for #23333 will show there is the query
|
||||
select count(*) from t1 /* must be 3 */;
|
||||
|
||||
reset master;
|
||||
select count(*) from t2;
|
||||
delete from t2 where a=bug27417(3);
|
||||
select count(*) from t2 /* nothing got deleted */;
|
||||
source include/show_binlog_events.inc; # the query must be in regardless of #23333
|
||||
select count(*) from t1 /* must be 5 */;
|
||||
|
||||
--enable_info
|
||||
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
|
||||
--disable_info
|
||||
select count(*) from t1 /* must be 7 */;
|
||||
|
||||
# function bug27417 remains for the following testing of bug#23333
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#23333 using the patch (and the test) for bug#27471
|
||||
# throughout the bug tests
|
||||
# t1 - non-trans side effects gatherer;
|
||||
# t2 - transactional table;
|
||||
#
|
||||
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique) ENGINE=MyISAM;
|
||||
CREATE TABLE t4 (a int, PRIMARY KEY (a), b int unique) ENGINE=Innodb;
|
||||
CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
|
||||
|
||||
#
|
||||
# INSERT
|
||||
#
|
||||
|
||||
# prepare
|
||||
|
||||
insert into t2 values (1);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t2 values (bug27417(1));
|
||||
|
||||
# check
|
||||
|
||||
source include/show_binlog_events.inc; # must be event of the query
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
#
|
||||
# INSERT SELECT
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t2 values (2);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t2 select bug27417(1) union select bug27417(2);
|
||||
|
||||
# check
|
||||
|
||||
source include/show_binlog_events.inc; # must be events of the query
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
|
||||
#
|
||||
# UPDATE inc multi-update
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
insert into t3 values (1,1),(2,3),(3,4);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
update t3 set b=b+bug27417(1);
|
||||
|
||||
# check
|
||||
source include/show_binlog_events.inc; # must be events of the query
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
|
||||
## multi_update::send_eof() branch
|
||||
|
||||
# prepare
|
||||
delete from t3;
|
||||
delete from t4;
|
||||
insert into t3 values (1,1);
|
||||
insert into t4 values (1,1),(2,2);
|
||||
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
|
||||
|
||||
# check
|
||||
source include/show_binlog_events.inc; # the offset must denote there is the query
|
||||
select count(*) from t1 /* must be 4 */;
|
||||
|
||||
## send_error() branch of multi_update
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t3;
|
||||
delete from t4;
|
||||
insert into t3 values (1,1),(2,2);
|
||||
insert into t4 values (1,1),(2,2);
|
||||
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t3,t4 SET t3.a = t4.a + bug27417(1) where t3.a = 1;
|
||||
|
||||
# check
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
# cleanup
|
||||
drop table t4;
|
||||
|
||||
|
||||
#
|
||||
# DELETE incl multi-delete
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
delete from t3;
|
||||
insert into t2 values (1);
|
||||
insert into t3 values (1,1);
|
||||
create trigger trg_del before delete on t2 for each row
|
||||
insert into t3 values (bug27417(1), 2);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
delete from t2;
|
||||
# check
|
||||
source include/show_binlog_events.inc; # the offset must denote there is the query
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
# cleanup
|
||||
drop trigger trg_del;
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
delete from t5;
|
||||
create trigger trg_del_t2 after delete on t2 for each row
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (2),(3);
|
||||
insert into t5 values (1),(2);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
delete t2.* from t2,t5 where t2.a=t5.a + 1;
|
||||
|
||||
# check
|
||||
source include/show_binlog_events.inc; # must be events of the query
|
||||
select count(*) from t1 /* must be 1 */;
|
||||
|
||||
|
||||
#
|
||||
# LOAD DATA
|
||||
#
|
||||
|
||||
# prepare
|
||||
delete from t1;
|
||||
create table t4 (a int default 0, b int primary key) engine=innodb;
|
||||
insert into t4 values (0, 17);
|
||||
reset master;
|
||||
|
||||
# execute
|
||||
--error ER_DUP_ENTRY
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
|
||||
# check
|
||||
select * from t4;
|
||||
select count(*) from t1 /* must be 2 */;
|
||||
source include/show_binlog_events.inc; # must be events of the query
|
||||
|
||||
#
|
||||
# bug#23333 cleanup
|
||||
#
|
||||
|
||||
|
||||
drop trigger trg_del_t2;
|
||||
drop table t1,t2,t3,t4,t5;
|
||||
drop function bug27417;
|
||||
File diff suppressed because it is too large
Load Diff
23
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_EE_err.test
Normal file
23
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_EE_err.test
Normal file
@@ -0,0 +1,23 @@
|
||||
# The test is not relevant when testing replication of error codes for
|
||||
# statements that are not replicated. The test below could be changed
|
||||
# to rely on the replication of error codes for statements that are not
|
||||
# replicated row-based.
|
||||
#
|
||||
# See if an EE_ error in one event of the master's binlog stops replication
|
||||
# (it should not: in this configuration the EE_ error is probably not
|
||||
# critical). Example: you do a DROP TABLE on a table which has no MYI file
|
||||
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
|
||||
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
|
||||
####################################
|
||||
#"REQUIREMENT: A master DROP TABLE on a table with non-existing MYI
|
||||
# file must be correctly replicated to the slave"
|
||||
####################################
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval create table t1 (a int) engine=$engine_type;
|
||||
flush tables;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
remove_file $MYSQLD_DATADIR/test/t1.MYI ;
|
||||
drop table if exists t1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,259 @@
|
||||
#
|
||||
# Test of auto_increment with offset
|
||||
#
|
||||
-- source include/not_ndb_default.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3;
|
||||
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2;
|
||||
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
|
||||
delete from t1 where b=4;
|
||||
insert into t1 values (NULL,5),(NULL,6);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
|
||||
drop table t1;
|
||||
|
||||
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
|
||||
show variables like "%auto_inc%";
|
||||
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL);
|
||||
insert into t1 values (250),(NULL);
|
||||
select * from t1;
|
||||
insert into t1 values (1000);
|
||||
set @@insert_id=400;
|
||||
insert into t1 values(NULL),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Same test with innodb (as the innodb code is a bit different)
|
||||
#
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL);
|
||||
insert into t1 values (250),(NULL);
|
||||
select * from t1;
|
||||
insert into t1 values (1000);
|
||||
set @@insert_id=400;
|
||||
insert into t1 values(NULL),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL),(NULL);
|
||||
insert into t1 values (500),(NULL),(502),(NULL),(NULL);
|
||||
select * from t1;
|
||||
set @@insert_id=600;
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 values(600),(NULL),(NULL);
|
||||
set @@insert_id=600;
|
||||
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that auto-increment works when slave has rows in the table
|
||||
#
|
||||
set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
|
||||
|
||||
eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2;
|
||||
|
||||
sync_slave_with_master;
|
||||
insert into t1 values(2),(12),(22),(32),(42);
|
||||
connection master;
|
||||
|
||||
insert into t1 values (NULL),(NULL);
|
||||
insert into t1 values (3),(NULL),(NULL);
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
|
||||
# Test for BUG#20524 "auto_increment_* not observed when inserting
|
||||
# a too large value". When an autogenerated value was bigger than the
|
||||
# maximum possible value of the field, it was truncated to that max
|
||||
# possible value, without being "rounded down" to still honour
|
||||
# auto_increment_* variables.
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
create table t1 (a tinyint not null auto_increment primary key) engine=myisam;
|
||||
insert into t1 values(103);
|
||||
set auto_increment_increment=11;
|
||||
set auto_increment_offset=4;
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 values(null);
|
||||
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
|
||||
|
||||
# same but with a larger value
|
||||
create table t2 (a tinyint unsigned not null auto_increment primary key) engine=myisam;
|
||||
set auto_increment_increment=10;
|
||||
set auto_increment_offset=1;
|
||||
set insert_id=1000;
|
||||
insert into t2 values(null);
|
||||
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
|
||||
|
||||
# An offset so big that even first value does not fit
|
||||
create table t3 like t1;
|
||||
set auto_increment_increment=1000;
|
||||
set auto_increment_offset=700;
|
||||
insert into t3 values(null);
|
||||
select * from t3 order by a;
|
||||
sync_slave_with_master;
|
||||
select * from t1 order by a;
|
||||
select * from t2 order by a;
|
||||
select * from t3 order by a;
|
||||
|
||||
connection master;
|
||||
|
||||
drop table t1,t2,t3;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#41986 Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables
|
||||
#
|
||||
connection master;
|
||||
set auto_increment_increment=1;
|
||||
set auto_increment_offset=1;
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb;
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
show create table t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
show create table t1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#45999 Row based replication fails when auto_increment field = 0.
|
||||
# Store engine of Slaves auto-generates new sequence numbers for
|
||||
# auto_increment fields if the values of them are 0. There is an inconsistency
|
||||
# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat
|
||||
#
|
||||
source include/rpl_reset.inc;
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type2;
|
||||
SET SQL_MODE='';
|
||||
# Value of the id will be 1;
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
INSERT INTO t2 VALUES(NULL);
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
# Value of the id will be 2;
|
||||
INSERT INTO t1 VALUES();
|
||||
INSERT INTO t2 VALUES();
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
# Value of the id will be 3. The master treats 0 as NULL or empty because
|
||||
# NO_AUTO_VALUE_ON_ZERO is not assign to SQL_MODE.
|
||||
INSERT INTO t1 VALUES(0);
|
||||
INSERT INTO t2 VALUES(0);
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
||||
# Value of the id will be 0. The master does not treat 0 as NULL or empty
|
||||
# because NO_AUTO_VALUE_ON_ZERO has assigned to SQL_MODE.
|
||||
INSERT INTO t1 VALUES(0);
|
||||
INSERT INTO t2 VALUES(0);
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
INSERT INTO t1 VALUES(4);
|
||||
INSERT INTO t2 VALUES(4);
|
||||
FLUSH LOGS;
|
||||
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;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
|
||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test
|
||||
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;
|
||||
|
||||
# End cleanup
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SET SQL_MODE='';
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#56662
|
||||
# The test verifies if the assertion of "next_insert_id == 0"
|
||||
# will fail in ha_external_lock() function.
|
||||
#
|
||||
connection master;
|
||||
CREATE TABLE t1 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, data INT) ENGINE=innodb;
|
||||
|
||||
BEGIN;
|
||||
--echo # Set sql_mode with NO_AUTO_VALUE_ON_ZERO for allowing
|
||||
--echo # zero to fill the auto_increment field.
|
||||
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
||||
INSERT INTO t1(id,data) VALUES(0,2);
|
||||
--echo # Resetting sql_mode without NO_AUTO_VALUE_ON_ZERO to
|
||||
--echo # affect the execution of the transaction on slave.
|
||||
SET SQL_MODE=0;
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# This test verifies if inserting data into view that invokes a
|
||||
# trigger will make the autoinc values become inconsistent on
|
||||
# master and slave.
|
||||
#
|
||||
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;
|
||||
CREATE TABLE t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
|
||||
eval create trigger tr16 $insert_action on t1 for each row insert into t3(a) values(new.c1);
|
||||
eval create trigger tr17 $insert_action on t2 for each row insert into t3(a) values(new.c2);
|
||||
begin;
|
||||
INSERT INTO t1(c1) VALUES (11), (12);
|
||||
INSERT INTO t2(c2) VALUES (13), (14);
|
||||
|
||||
CREATE VIEW v16 AS SELECT c1, c2 FROM t1, t2;
|
||||
|
||||
INSERT INTO v16(c1) VALUES (15),(16);
|
||||
INSERT INTO v16(c2) VALUES (17),(18);
|
||||
|
||||
connection master1;
|
||||
INSERT INTO v16(c1) VALUES (19),(20);
|
||||
INSERT INTO v16(c2) VALUES (21),(22);
|
||||
|
||||
connection master;
|
||||
INSERT INTO v16(c1) VALUES (23), (24);
|
||||
INSERT INTO v16(c1) VALUES (25), (26);
|
||||
commit;
|
||||
sync_slave_with_master;
|
||||
--echo #Test if the results are consistent on master and slave
|
||||
--echo #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS'
|
||||
let $diff_tables= master:t3, slave:t3;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP VIEW v16;
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
#
|
||||
# This test verifies if concurrent transactions that invoke a
|
||||
# trigger that inserts more than one values into one or more
|
||||
# tables with an auto_increment column will make the autoinc
|
||||
# values become inconsistent on master and slave.
|
||||
#
|
||||
|
||||
connection master;
|
||||
create table t1(a int, b int) engine=innodb;
|
||||
create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
|
||||
eval create trigger tr1 $trigger_action on t1 for each row insert into t2(a) values(6);
|
||||
|
||||
create table t3(a int, b int) engine=innodb;
|
||||
create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
|
||||
create table t5(a int) engine=innodb;
|
||||
delimiter |;
|
||||
eval create trigger tr2 $trigger_action on t3 for each row begin
|
||||
insert into t4(a) values(f1_insert_triggered());
|
||||
insert into t4(a) values(f1_insert_triggered());
|
||||
insert into t5(a) values(8);
|
||||
end |
|
||||
delimiter ;|
|
||||
|
||||
create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
|
||||
delimiter //;
|
||||
CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
|
||||
BEGIN
|
||||
INSERT INTO t6(a) values(2),(3);
|
||||
RETURN 1;
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
begin;
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
insert into t1(a,b) values(1,1),(2,1);
|
||||
insert into t3(a,b) values(1,1),(2,1);
|
||||
update t1 set a = a + 5 where b = 1;
|
||||
update t3 set a = a + 5 where b = 1;
|
||||
delete from t1 where b = 1;
|
||||
delete from t3 where b = 1;
|
||||
|
||||
connection master1;
|
||||
#The default autocommit is set to 1, so the statement is auto committed
|
||||
insert into t2(a) values(3);
|
||||
insert into t4(a) values(3);
|
||||
|
||||
connection master;
|
||||
commit;
|
||||
insert into t1(a,b) values(4,2);
|
||||
insert into t3(a,b) values(4,2);
|
||||
update t1 set a = a + 5 where b = 2;
|
||||
update t3 set a = a + 5 where b = 2;
|
||||
delete from t1 where b = 2;
|
||||
delete from t3 where b = 2;
|
||||
--echo # To verify if insert/update in an autoinc column causes statement to be logged in row format
|
||||
source include/show_binlog_events.inc;
|
||||
commit;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
--echo #Test if the results are consistent on master and slave
|
||||
--echo #for 'INVOKES A TRIGGER with $trigger_action action'
|
||||
let $diff_tables= master:t2, slave:t2;
|
||||
source include/diff_tables.inc;
|
||||
let $diff_tables= master:t4, slave:t4;
|
||||
source include/diff_tables.inc;
|
||||
let $diff_tables= master:t6, slave:t6;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t4;
|
||||
DROP TABLE t5;
|
||||
DROP TABLE t6;
|
||||
DROP FUNCTION f1_insert_triggered;
|
||||
sync_slave_with_master;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# This test verifies if concurrent transactions that call a
|
||||
# function which invokes a 'after/before insert action' trigger
|
||||
# that inserts more than one values into a table with autoinc
|
||||
# column will make the autoinc values become inconsistent on
|
||||
# master and slave.
|
||||
#
|
||||
|
||||
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;
|
||||
create table t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
|
||||
delimiter |;
|
||||
CREATE FUNCTION f1_two_inserts_trigger() RETURNS INTEGER
|
||||
BEGIN
|
||||
INSERT INTO t2(a) values(2),(3);
|
||||
INSERT INTO t2(a) values(2),(3);
|
||||
RETURN 1;
|
||||
END |
|
||||
eval create trigger tr11 $insert_action on t2 for each row begin
|
||||
insert into t3(a) values(new.a);
|
||||
insert into t3(a) values(new.a);
|
||||
end |
|
||||
delimiter ;|
|
||||
begin;
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
insert into t1(a) values(f1_two_inserts_trigger());
|
||||
|
||||
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_trigger());
|
||||
--echo # To verify if insert/update in an autoinc column causes statement to be logged in row format
|
||||
source include/show_binlog_events.inc;
|
||||
commit;
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
--echo #Test if the results are consistent on master and slave
|
||||
--echo #for 'CALLS A FUNCTION which INVOKES A TRIGGER with $insert_action action'
|
||||
let $diff_tables= master:t2, slave:t2;
|
||||
source include/diff_tables.inc;
|
||||
let $diff_tables= master:t3, slave:t3;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop function f1_two_inserts_trigger;
|
||||
sync_slave_with_master;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# Check replication of one statement assuming that the engine on the
|
||||
# slave is a blackhole engine.
|
||||
|
||||
# Input:
|
||||
# $statement Statement to evaluate, it is assumed to change t1
|
||||
|
||||
# 1. Evaluate statement on master, it is assumed to change t1
|
||||
# 2. Wait for statement to be processed on slave
|
||||
# 3. SELECT from table t1 to see what was written
|
||||
# 4. Compare position on slave before executing statement and after
|
||||
# executing statement. If difference is >0, then something was
|
||||
# written to the binary log on the slave.
|
||||
|
||||
connection slave;
|
||||
let $before = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
eval $statement;
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
--echo # Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
let $after = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
let $something_written = `select $after - $before != 0`;
|
||||
if ($something_written) {
|
||||
--echo >>> Something was written to binary log <<<
|
||||
}
|
||||
if (!$something_written) {
|
||||
--echo >>> Nothing was written to binary log <<<
|
||||
}
|
||||
152
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_charset.test
Normal file
152
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_charset.test
Normal file
@@ -0,0 +1,152 @@
|
||||
# Replication of character sets.
|
||||
# This test will fail if the server/client does not support enough charsets.
|
||||
|
||||
source include/master-slave.inc;
|
||||
set timestamp=1000000000;
|
||||
|
||||
create database mysqltest2 character set latin2;
|
||||
set @@character_set_server=latin5;
|
||||
create database mysqltest3;
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest2;
|
||||
show create database mysqltest3;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest2;
|
||||
show create database mysqltest3;
|
||||
|
||||
connection master;
|
||||
set @@collation_server=armscii8_bin;
|
||||
drop database mysqltest3;
|
||||
create database mysqltest3;
|
||||
--disable_query_log
|
||||
select "--- --master--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest3;
|
||||
sync_slave_with_master;
|
||||
--disable_query_log
|
||||
select "--- --slave--" as "";
|
||||
--enable_query_log
|
||||
show create database mysqltest3;
|
||||
|
||||
connection master;
|
||||
use mysqltest2;
|
||||
create table t1 (a int auto_increment primary key, b varchar(100));
|
||||
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
|
||||
insert into t1 (b) values(@@character_set_server);
|
||||
insert into t1 (b) values(@@collation_server);
|
||||
# character_set_database and collation_database are not tested as they
|
||||
# needn't be replicated (Bar said in Jan 2005).
|
||||
insert into t1 (b) values(@@character_set_client);
|
||||
# collation_client does not exist
|
||||
insert into t1 (b) values(@@character_set_connection);
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
--echo --- --master--
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--echo --- --slave--
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
connection master;
|
||||
set character_set_client=latin1, collation_connection=latin1_german1_ci;
|
||||
truncate table t1;
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
insert into t1 (b) values(LEAST("Müller","Muffler"));
|
||||
set collation_connection=latin1_german2_ci;
|
||||
insert into t1 (b) values(@@collation_connection);
|
||||
insert into t1 (b) values(LEAST("Müller","Muffler"));
|
||||
--echo --- --master--
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--echo --- --slave--
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
# Presently charset info is not logged with LOAD DATA but it will
|
||||
# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
|
||||
# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
|
||||
# here.
|
||||
|
||||
# See if user var is prefixed with collation in binlog and replicated well.
|
||||
# Note: replication of user variables is broken as far as derivation is
|
||||
# concerned. That's because when we store a user variable in the binlog,
|
||||
# we lose its derivation. So later on the slave, it's impossible to
|
||||
# know if the collation was explicit or not, so we use DERIVATION_NONE,
|
||||
# which provokes error messages (like 'Illegal mix of collation') when
|
||||
# we replay the master's INSERT/etc statements.
|
||||
connection master;
|
||||
set @a= _cp850 'Müller' collate cp850_general_ci;
|
||||
truncate table t1;
|
||||
insert into t1 (b) values(collation(@a));
|
||||
--echo --- --master--
|
||||
select * from t1 order by a;
|
||||
sync_slave_with_master;
|
||||
--echo --- --slave--
|
||||
select * from mysqltest2.t1 order by a;
|
||||
|
||||
connection master;
|
||||
drop database mysqltest2;
|
||||
drop database mysqltest3;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Check that we can change global.collation_server (since 5.0.3)
|
||||
|
||||
set global character_set_server=latin2;
|
||||
set global character_set_server=latin1; # back
|
||||
connection master;
|
||||
set global character_set_server=latin2;
|
||||
set global character_set_server=latin1; # back
|
||||
|
||||
# Check that SET ONE_SHOT is really one shot
|
||||
|
||||
set one_shot @@character_set_server=latin5;
|
||||
set @@max_join_size=1000;
|
||||
select @@character_set_server;
|
||||
select @@character_set_server;
|
||||
set @@character_set_server=latin5;
|
||||
select @@character_set_server;
|
||||
select @@character_set_server;
|
||||
|
||||
# ONE_SHOT on not charset/collation stuff is not allowed
|
||||
-- error 1382
|
||||
set one_shot max_join_size=10;
|
||||
|
||||
# Test of wrong character set numbers;
|
||||
error 1115;
|
||||
set character_set_client=9999999;
|
||||
error 1273;
|
||||
set collation_server=9999998;
|
||||
|
||||
# This one was contributed by Sergey Petrunia (BUG#3943)
|
||||
|
||||
use test;
|
||||
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
|
||||
SET CHARACTER_SET_CLIENT=koi8r,
|
||||
CHARACTER_SET_CONNECTION=cp1251,
|
||||
CHARACTER_SET_RESULTS=koi8r;
|
||||
INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
|
||||
select hex(c1), hex(c2) from t1;
|
||||
sync_slave_with_master;
|
||||
select hex(c1), hex(c2) from t1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#6676: Derivation of variables must be correct on slave
|
||||
#
|
||||
connection master;
|
||||
eval create table `t1` (
|
||||
`pk` varchar(10) not null default '',
|
||||
primary key (`pk`)
|
||||
) engine=$engine_type default charset=latin1;
|
||||
set @p=_latin1 'test';
|
||||
update t1 set pk='test' where pk=@p;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,14 @@
|
||||
eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
|
||||
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
flush tables with read lock;
|
||||
commit;
|
||||
sync_slave_with_master;
|
||||
# cleanup
|
||||
connection master;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
175
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_conflicts.test
Normal file
175
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_conflicts.test
Normal file
@@ -0,0 +1,175 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test that slave behaves well in some conflict situations. The
|
||||
# following are tested:
|
||||
#
|
||||
# - The slave SQL thread sees an 'INSERT' of a row with a key that
|
||||
# already exists in the table;
|
||||
#
|
||||
# - The slave SQL thread sees a 'DELETE' of a row that does not
|
||||
# exist in the table.
|
||||
#
|
||||
# In statement-logging mode, the first conflict type causes the slave
|
||||
# to stop with an error and the second conflict is ignored.
|
||||
#
|
||||
# In row-logging mode, the slave behavior depends the value of
|
||||
# @@slave_exec_mode on the slave: if @@slave_exec_mode is IDEMPOTENT,
|
||||
# the slave should ignore the conflicting statement and continue
|
||||
# normally. If @@slave_exec_mode is STRICT, the slave should stop
|
||||
# with an error.
|
||||
#
|
||||
# This test was previously named rpl_stm_mystery22/rpl_row_mystery22.
|
||||
#
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Create a table on master and slave, insert a row on slave, and
|
||||
# insert the same row on master.
|
||||
#
|
||||
# Create a table on master and slave, insert a row on master with
|
||||
# binlogging turned off, and remove the row on master with binlogging
|
||||
# turned on.
|
||||
#
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#31552: Replication breaks when deleting rows from out-of-sync table without PK
|
||||
# BUG#31609: Not all RBR slave errors reported as errors
|
||||
#
|
||||
# Bug in this test case:
|
||||
# BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# This file assumes the following:
|
||||
#
|
||||
# - The test language variable $slave_is_idempotent is set to 1 if the
|
||||
# slave is expected to stop on duplicate key errors (i.e., if the
|
||||
# binlog is in statement mode or
|
||||
# @@global.slave_exec_mode=STRICT). It is set to 0 otherwise.
|
||||
#
|
||||
# - Replication has been initialized by include/master-slave.inc
|
||||
#
|
||||
# - The test adds a suppression for the following warning:
|
||||
# Slave: Can't find record in 't1' Error_code: 1032
|
||||
|
||||
|
||||
--echo ==== Initialize ====
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
CREATE TABLE t1(a INT PRIMARY KEY);
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
--echo ==== Test: SQL thread sees 'INSERT' of existing key ====
|
||||
|
||||
--echo ---- Prepare slave so that it will get duplicate key error ----
|
||||
# This row will be in the way of the row inserted by master.
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
--echo ---- Insert rows on master ----
|
||||
--echo [on master]
|
||||
connection master;
|
||||
# Insert the same row on master
|
||||
INSERT INTO t1 VALUES (1);
|
||||
save_master_pos;
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo [on slave]
|
||||
connection slave;
|
||||
|
||||
# If we are statement-logging or if slave_exec_mode=STRICT, we now
|
||||
# expect to see an error on the slave. Otherwise (i.e., we are
|
||||
# row-logging and slave_exec_mode=IDEMPOTENT), we expect that the
|
||||
# duplicate row is ignored by the slave and replication continues.
|
||||
if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRICT'`) {
|
||||
--echo ---- Wait until slave stops with an error ----
|
||||
# Wait until the slave tries to run the query, fails with duplicate
|
||||
# key error, and stops the SQL thread.
|
||||
let $slave_sql_errno= 1062; # ER_DUP_ENTRY
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
--echo Last_SQL_Error = $err (expected "duplicate key" error)
|
||||
call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo ---- Resolve the conflict on the slave and restart SQL thread ----
|
||||
DELETE FROM t1 WHERE a = 1;
|
||||
START SLAVE SQL_THREAD;
|
||||
source include/wait_for_slave_sql_to_start.inc;
|
||||
}
|
||||
|
||||
--echo ---- Sync slave and verify that there is no error ----
|
||||
sync_with_master;
|
||||
let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
--echo Last_SQL_Error = '$err' (expected no error)
|
||||
SELECT * FROM t1;
|
||||
|
||||
|
||||
--echo ==== Test: SQL thread sees 'DELETE' of non-existing row ====
|
||||
|
||||
--echo ---- On master, insert two rows, the second with binlogging off ----
|
||||
--echo [on master]
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
DELETE FROM t1 WHERE a = 1;
|
||||
|
||||
--echo ---- On master, remove the row that does not exist on slave ----
|
||||
--echo [on master]
|
||||
connection master;
|
||||
DELETE FROM t1 WHERE a = 1;
|
||||
SELECT * FROM t1;
|
||||
save_master_pos;
|
||||
|
||||
--echo [on slave]
|
||||
connection slave;
|
||||
|
||||
# If we are row-logging and slave_exec_mode is STRICT, we now expect
|
||||
# an error since the row to delete does not exist on slave. Otherwise
|
||||
# (i.e., either we are statement-logging or slave_exec_mode is
|
||||
# IDEMPOTENT), the absence of the row to delete is ignored and
|
||||
# replication continues.
|
||||
if (`SELECT @@global.binlog_format = 'ROW' AND @@global.slave_exec_mode = 'STRICT'`) {
|
||||
--echo ---- Wait until slave stops with an error ----
|
||||
call mtr.add_suppression("Can.t find record in .t1., Error_code: 1032");
|
||||
let $slave_sql_errno= 1032; # ER_KEY_NOT_FOUND
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
|
||||
--let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
|
||||
--replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
|
||||
--disable_query_log
|
||||
--eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)'
|
||||
--enable_query_log
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo ---- Resolve the conflict on the slave and restart SQL thread ----
|
||||
INSERT INTO t1 VALUES (1);
|
||||
START SLAVE SQL_THREAD;
|
||||
source include/wait_for_slave_sql_to_start.inc;
|
||||
}
|
||||
|
||||
--echo ---- Sync slave and verify that there is no error ----
|
||||
# The slave should sync ok, and SHOW SLAVE STATUS should give no
|
||||
# error.
|
||||
sync_with_master;
|
||||
let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
--echo Last_SQL_Error = $err (expected no error)
|
||||
SELECT * FROM t1;
|
||||
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo [on slave]
|
||||
--sync_slave_with_master
|
||||
613
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_ddl.test
Normal file
613
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_ddl.test
Normal file
@@ -0,0 +1,613 @@
|
||||
################# extra/rpl_tests/rpl_ddl.test ########################
|
||||
# #
|
||||
# DDL statements (sometimes with implicit COMMIT) and other stuff #
|
||||
# executed on the master and it's propagation into the slave. #
|
||||
# #
|
||||
# The variables #
|
||||
# $engine_type -- storage engine to be tested/used for the #
|
||||
# permanent tables within the master #
|
||||
# $temp_engine_type -- storage engine which supports TEMPORARY #
|
||||
# tables <> $engine_type #
|
||||
# $temp_engine_type must point to an all #
|
||||
# time available storage engine #
|
||||
# 2007-02 MySQL 5.1 MyISAM and MEMORY only #
|
||||
# $show_binlog -- print binlog entries #
|
||||
# 0 - no (default) + fits to the file with #
|
||||
# results #
|
||||
# 1 - yes (important for debugging) #
|
||||
# This variable is used within #
|
||||
# include/rpl_stmt_seq.inc. #
|
||||
# $manipulate -- Manipulation of the binary logs #
|
||||
# 0 - do nothing #
|
||||
# 1 - so that the output of SHOW BINLOG #
|
||||
# EVENTS IN <current log> contains only #
|
||||
# commands of the current test sequence #
|
||||
# This is especially useful, if the #
|
||||
# $show_binlog is set to 1 and many #
|
||||
# subtest are executed. #
|
||||
# This variable is used within #
|
||||
# include/rpl_stmt_seq.inc. #
|
||||
# have to be set before sourcing this script. #
|
||||
# #
|
||||
# General assumption about the ideal replication behaviour: #
|
||||
# Whatever on the master is executed the content of the slave must #
|
||||
# be in sync with it. #
|
||||
# #
|
||||
# Tests of special interest: #
|
||||
# a) Which DDL commands cause an implicit COMMIT ? #
|
||||
# This is also of interest outside of replication. #
|
||||
# b) Transactions modifying table content ending with #
|
||||
# - explicit COMMIT or ROLLBACK #
|
||||
# - implicit COMMIT because the connection to the master #
|
||||
# executed a corresponding DDL statement or runs in #
|
||||
# AUTOCOMMIT mode #
|
||||
# - something similar to "implicit COMMIT" if the storage #
|
||||
# engine (master) is not transactional #
|
||||
# c) Command which change no data like SELECT or SHOW #
|
||||
# They do not change anything within the master but #
|
||||
# this must be also valid for the slave. #
|
||||
# #
|
||||
#######################################################################
|
||||
|
||||
# Last update:
|
||||
# 2007-02-12 ML: - slave needs AUTOCOMMIT = 1, because we want to check only
|
||||
# the propagation of actions of the master connection.
|
||||
# - replace comments via SQL by "--echo ..."
|
||||
# - remove some bugs within the testscripts
|
||||
# - remove the use of include/rpl_stmt_seq2.inc
|
||||
#
|
||||
#
|
||||
# NOTES:
|
||||
# 2006-11-15 Lars: Matthias (ML) is the "owner" of this test case.
|
||||
# So, please get him to review it whenever you want to
|
||||
# do changes to it.
|
||||
#
|
||||
# PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
|
||||
#
|
||||
# Typical test architecture (--> include/rpl_stmt_seq.inc)
|
||||
# --------------------------------------------------------
|
||||
# 1. Master (no AUTOCOMMIT!): INSERT INTO mysqltest1.t1 without commit
|
||||
# 2. Master and slave: Check the content of mysqltest1.t1
|
||||
# 3. Master (no AUTOCOMMIT!): EXECUTE the statement to be tested
|
||||
# 4. Master and slave: Check the content of mysqltest1.t1
|
||||
# 5. Master (no AUTOCOMMIT!): ROLLBACK
|
||||
# 6. Master and slave: Check the content of mysqltest1.t1
|
||||
# If the previous into mysqltest1.t1 inserted row is visible,
|
||||
# than the statement to be tested caused an explicit COMMIT
|
||||
# (statement = COMMIT) or an implicit COMMIT (example CREATE TABLE).
|
||||
# If the previous into mysqltest1.t1 inserted row is not visible,
|
||||
# than the statement to be tested caused either an explicit ROLLBACK
|
||||
# (statement = ROLLBACK), an implicit ROLLBACK (deadlock etc. but
|
||||
# not tested here) or it does not cause any transaction end.
|
||||
# 7. Flush the logs
|
||||
#
|
||||
# Some rules:
|
||||
# -----------
|
||||
# 1. Any use of mysqltest1.t1 within the statement to be tested must be
|
||||
# avoided if possible. The only known exception is around LOCK TABLE.
|
||||
#
|
||||
# 2. The test logics needs for
|
||||
# master connection: AUTOCOMMIT = 0
|
||||
# slave connection: AUTOCOMMIT = 1
|
||||
# The master connection is the actor and the slave connection is
|
||||
# only an observer. I.e. the slave connection must not influence
|
||||
# the activities of master connection.
|
||||
#
|
||||
# 3. !All! objects to be dropped, renamed, altered ... must be created
|
||||
# before the tests start.
|
||||
# --> less switching of AUTOCOMMIT mode on master side.
|
||||
#
|
||||
# 4. Never use a test object, which was direct or indirect affected by a
|
||||
# preceeding test sequence again.
|
||||
# If one preceeding test sequence hits a (sometimes not 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.. This means during analysis the first look
|
||||
# points into a totally wrong area.
|
||||
# Except table mysqltest1.t1 where ONLY DML is allowed.
|
||||
#
|
||||
# 5. This file is used in several tests (t/rpl_ddl_<whatever>.test).
|
||||
# Please be aware that every change of the current file affects
|
||||
# the results of these tests.
|
||||
#
|
||||
# ML: Some maybe banal hints:
|
||||
# 1. The fact that we have here a master - slave replication does
|
||||
# not cause that many general MySQL properties do not apply.
|
||||
# Example:
|
||||
# The connection to the slave is just a simple session and not a however
|
||||
# magic working "copy" of the master session or something similar.
|
||||
# - TEMPORARY TABLES and @variables are session specific
|
||||
# - the slave session cannot see these things of the master.
|
||||
# 2. The slave connection must not call sync_slave_with_master.
|
||||
# 3. SHOW STATUS SLAVE must be run within the slave connection.
|
||||
# 4. Testcase analysis becomes much more comfortable if
|
||||
# $show_binlog within include/rpl_stmt_seq.inc is set to 1.
|
||||
#
|
||||
|
||||
###############################################################
|
||||
# Some preparations
|
||||
###############################################################
|
||||
# The sync_slave_with_master is needed to make the xids deterministic.
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
SET AUTOCOMMIT = 1;
|
||||
#
|
||||
# 2. CREATE all objects needed
|
||||
# working database is mysqltest1
|
||||
# working table (transactional!) is mysqltest1.t1
|
||||
#
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE DATABASE mysqltest2;
|
||||
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
||||
# Prevent Bug#26687 rpl_ddl test fails if run with --innodb option
|
||||
# The testscript (suite/rpl/rpl_ddl.test) + the expected result need that the
|
||||
# slave uses MyISAM for the table mysqltest.t1.
|
||||
# This is not valid in case of suite/rpl_ndb/rpl_ndb_ddl.test which sources
|
||||
# also this script.
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = 'mysqltest1' AND TABLE_NAME = 't1'
|
||||
AND ENGINE <> 'MyISAM' AND '$engine_type' <> 'NDB'`)
|
||||
{
|
||||
skip This test needs on slave side: InnoDB disabled, default engine: MyISAM;
|
||||
}
|
||||
connection master;
|
||||
INSERT INTO mysqltest1.t1 SET f1= 0;
|
||||
eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=$engine_type;
|
||||
CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
|
||||
eval CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=$engine_type;
|
||||
INSERT INTO mysqltest1.t7 SET f1= 0;
|
||||
eval CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=$temp_engine_type;
|
||||
|
||||
#
|
||||
# 3. master sessions: never do AUTOCOMMIT
|
||||
# slave sessions: do AUTOCOMMIT
|
||||
#
|
||||
SET AUTOCOMMIT = 0;
|
||||
use mysqltest1;
|
||||
sync_slave_with_master;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SET AUTOCOMMIT = 1;
|
||||
use mysqltest1;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
|
||||
# We don't want to abort the whole test if one statement sent
|
||||
# to the server gets an error, because the following test
|
||||
# sequences are nearly independend of the previous statements.
|
||||
--disable_abort_on_error
|
||||
|
||||
###############################################################
|
||||
# Banal case: commands which should never commit
|
||||
# Just for checking if the test sequence is usable
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= SELECT 1;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $my_stmt= SELECT COUNT(*) FROM t1;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
###############################################################
|
||||
# Banal case: (explicit) COMMIT and ROLLBACK
|
||||
# Just for checking if the test sequence is usable
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= COMMIT;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $my_stmt= ROLLBACK;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
###############################################################
|
||||
# Cases with commands very similar to COMMIT
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= SET AUTOCOMMIT=1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SET AUTOCOMMIT=0;
|
||||
|
||||
let $my_stmt= START TRANSACTION;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $my_stmt= BEGIN;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
###############################################################
|
||||
# Cases with (BASE) TABLES and (UPDATABLE) VIEWs
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= DROP TABLE mysqltest1.t2;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TABLES LIKE 't2';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW TABLES LIKE 't2';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TABLES LIKE 't23';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW TABLES LIKE 't23';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TABLES LIKE 't20';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW TABLES LIKE 't20';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
describe mysqltest1.t4;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
describe mysqltest1.t4;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= $engine_type;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $engine='';
|
||||
let $eng_type='';
|
||||
|
||||
let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=$temp_engine_type;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT * FROM mysqltest1.t7;
|
||||
sync_slave_with_master;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SELECT * FROM mysqltest1.t7;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
###############################################################
|
||||
# Cases with LOCK/UNLOCK
|
||||
###############################################################
|
||||
|
||||
# Attention:
|
||||
# We have to LOCK mysqltest1.t1 here, though it violates the testing
|
||||
# philosophy.
|
||||
# Mysql response in case without previous LOCK TABLES mysqltest1.t1
|
||||
# is:
|
||||
# SELECT MAX(...) FROM mysqltest1.t1 is
|
||||
# ERROR HY000: Table 't1' was not locked with LOCK TABLES
|
||||
let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
UNLOCK TABLES;
|
||||
|
||||
# No prior locking
|
||||
let $my_stmt= UNLOCK TABLES;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
# With prior read locking
|
||||
# Attention:
|
||||
# This subtest generates an error since the rpl_stmt_seq.inc
|
||||
# tries to insert into t1.
|
||||
LOCK TABLES mysqltest1.t1 READ;
|
||||
let $my_stmt= UNLOCK TABLES;
|
||||
let $my_master_commit= false;
|
||||
let $my_slave_commit= false;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
# With prior write locking
|
||||
LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
|
||||
let $my_stmt= UNLOCK TABLES;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
|
||||
###############################################################
|
||||
# Cases with INDEXES
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW INDEX FROM mysqltest1.t6;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW INDEX FROM mysqltest1.t6;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW INDEX FROM mysqltest1.t5;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW INDEX FROM mysqltest1.t5;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
###############################################################
|
||||
# Cases with DATABASE
|
||||
###############################################################
|
||||
|
||||
let $my_stmt= DROP DATABASE mysqltest2;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW DATABASES LIKE "mysqltest2";
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW DATABASES LIKE "mysqltest2";
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= CREATE DATABASE mysqltest3;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW DATABASES LIKE "mysqltest3";
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW DATABASES LIKE "mysqltest3";
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
###############################################################
|
||||
# Cases with STORED PROCEDUREs
|
||||
###############################################################
|
||||
let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--vertical_results
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
--horizontal_results
|
||||
|
||||
let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--vertical_results
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
--replace_column 5 # 6 #
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
--horizontal_results
|
||||
|
||||
let $my_stmt= DROP PROCEDURE p1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--vertical_results
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW PROCEDURE STATUS LIKE 'p1';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
--horizontal_results
|
||||
|
||||
###############################################################
|
||||
# Cases with VIEWs
|
||||
###############################################################
|
||||
let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW CREATE VIEW v1;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW CREATE VIEW v1;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW CREATE VIEW v1;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW CREATE VIEW v1;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= DROP VIEW IF EXISTS v1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
--error 1146
|
||||
SHOW CREATE VIEW v1;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
--error 1146
|
||||
SHOW CREATE VIEW v1;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
###############################################################
|
||||
# Cases with TRIGGERs
|
||||
###############################################################
|
||||
let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TRIGGERS;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW TRIGGERS;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= DROP TRIGGER trg1;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SHOW TRIGGERS;
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW TRIGGERS;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
###############################################################
|
||||
# Cases with USERs
|
||||
###############################################################
|
||||
let $my_stmt= CREATE USER user1@localhost;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT user FROM mysql.user WHERE user = 'user1';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SELECT user FROM mysql.user WHERE user = 'user1';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
|
||||
let $my_stmt= DROP USER rename1@localhost;
|
||||
let $my_master_commit= true;
|
||||
let $my_slave_commit= true;
|
||||
--source include/rpl_stmt_seq.inc
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
--echo
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SELECT user FROM mysql.user WHERE user = 'rename1';
|
||||
|
||||
###############################################################
|
||||
# Cleanup
|
||||
###############################################################
|
||||
use test;
|
||||
--echo
|
||||
--echo -------- switch to master -------
|
||||
connection master;
|
||||
DROP DATABASE mysqltest1;
|
||||
# mysqltest2 was alreday DROPPED some tests before.
|
||||
DROP DATABASE mysqltest3;
|
||||
134
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_deadlock.test
Normal file
134
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_deadlock.test
Normal file
@@ -0,0 +1,134 @@
|
||||
# See if slave restarts the transaction after failing on an InnoDB deadlock error.
|
||||
|
||||
# Note: testing what happens when too many retries is possible, but
|
||||
# needs large waits when running with --debug, so we don't do it.
|
||||
# The same way, this test may not test what is expected when run
|
||||
# under Valgrind, timings are too short then (with --valgrind I
|
||||
# (Guilhem) have seen the test manage to provoke lock wait timeout
|
||||
# error but not deadlock error; that is ok as code deals with the two
|
||||
# errors in exactly the same way.
|
||||
|
||||
--source include/master-slave.inc
|
||||
|
||||
# 0) Prepare tables and data
|
||||
--echo *** Prepare tables and data ***
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (a INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t3 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
|
||||
sync_slave_with_master;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
SHOW CREATE TABLE t3;
|
||||
SHOW VARIABLES LIKE 'slave_transaction_retries';
|
||||
--source include/stop_slave.inc
|
||||
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
# We make a long transaction here
|
||||
INSERT INTO t2 VALUES (2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
|
||||
INSERT INTO t3 VALUES (3);
|
||||
COMMIT;
|
||||
save_master_pos;
|
||||
# Save BEGIN event into variable
|
||||
let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 5);
|
||||
--echo
|
||||
|
||||
# 1) Test deadlock
|
||||
# Block slave SQL thread, wait retries of transaction, unlock slave before lock timeout
|
||||
--echo *** Test deadlock ***
|
||||
|
||||
connection slave;
|
||||
BEGIN;
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
# Save variable 'Slave_retried_transactions' before deadlock
|
||||
let $slave_retried_transactions= query_get_value(SHOW GLOBAL STATUS LIKE 'Slave_retried_transactions', Value, 1);
|
||||
START SLAVE;
|
||||
# Wait until SQL thread blocked: variable 'Slave_retried_transactions' will incremented
|
||||
let $status_var= Slave_retried_transactions;
|
||||
let $status_var_value= $slave_retried_transactions;
|
||||
let $status_type= GLOBAL;
|
||||
let $status_var_comparsion= >;
|
||||
--source include/wait_for_status_var.inc
|
||||
SELECT COUNT(*) FROM t2;
|
||||
COMMIT;
|
||||
sync_with_master;
|
||||
|
||||
# Check the data
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t3;
|
||||
# Check that no error is reported
|
||||
source include/check_slave_is_running.inc;
|
||||
--echo
|
||||
|
||||
# 2) Test lock wait timeout
|
||||
# Block slave and wait lock timeout error
|
||||
--echo *** Test lock wait timeout ***
|
||||
|
||||
connection slave;
|
||||
--source include/stop_slave.inc
|
||||
DELETE FROM t2;
|
||||
# Set slave position to the BEGIN log event
|
||||
--replace_result $master_pos_begin MASTER_POS_BEGIN
|
||||
eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
|
||||
BEGIN;
|
||||
# Hold lock
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
# Wait until slave stopped with error 'Lock wait timeout exceeded'
|
||||
START SLAVE;
|
||||
let $slave_sql_errno= 1205;
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
SELECT COUNT(*) FROM t2;
|
||||
COMMIT;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
# Check data from tables
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t3;
|
||||
# Check that no error is reported
|
||||
source include/check_slave_is_running.inc;
|
||||
--echo
|
||||
|
||||
# 3) Test lock wait timeout and purged relay log
|
||||
# Set max_relay_log_size=0, block slave and wait lock timeout error.
|
||||
# Restart slave and check that no erros appear
|
||||
--echo *** Test lock wait timeout and purged relay logs ***
|
||||
|
||||
connection slave;
|
||||
SET @my_max_relay_log_size= @@global.max_relay_log_size;
|
||||
SET global max_relay_log_size=0;
|
||||
--source include/stop_slave.inc
|
||||
DELETE FROM t2;
|
||||
# Set slave position to the BEGIN log event
|
||||
--replace_result $master_pos_begin MASTER_POS_BEGIN
|
||||
eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
|
||||
BEGIN;
|
||||
# Hold lock
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
# Wait until slave stopped with error 'Lock wait timeout exceeded'
|
||||
START SLAVE;
|
||||
let $slave_sql_errno= 1205;
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
SELECT COUNT(*) FROM t2;
|
||||
COMMIT;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
# Check data from tables
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t3;
|
||||
# Check that no error is reported
|
||||
source include/check_slave_is_running.inc;
|
||||
--echo
|
||||
|
||||
# Clean up
|
||||
--echo *** Clean up ***
|
||||
connection master;
|
||||
DROP TABLE t1,t2,t3;
|
||||
sync_slave_with_master;
|
||||
SET global max_relay_log_size= @my_max_relay_log_size;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,17 @@
|
||||
# Test to see if a DELETE which triggers a fast deletion of all rows
|
||||
# (not internally row-per-row but more like a TRUNCATE, MyISAM
|
||||
# supports that), is replicated (BUG#13576).
|
||||
|
||||
eval create table t1 (a int, b int) engine=$engine_type;
|
||||
insert into t1 values(1,1);
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
delete from t1;
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
|
||||
# cleanup
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
1024
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_extra_col_master.test
Normal file
1024
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_extra_col_master.test
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,913 @@
|
||||
#################################################
|
||||
# Purpose: To test having extra columns on the slave.
|
||||
##################################################
|
||||
|
||||
# Some tests in here requre partitioning
|
||||
-- source include/have_partition.inc
|
||||
|
||||
#################################################
|
||||
############ Different Table Def Test ###########
|
||||
#################################################
|
||||
# Purpose: To have different table def on the #
|
||||
# master and slave. Most of these tests#
|
||||
# should stop the slave. #
|
||||
#################################################
|
||||
|
||||
call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
|
||||
|
||||
--echo **** Diff Table Def Start ****
|
||||
|
||||
##############################################
|
||||
### Try to replicate w/ PK on diff columns ###
|
||||
### Should Stop Slave ###
|
||||
##############################################
|
||||
|
||||
--echo *** On Slave ***
|
||||
sync_slave_with_master;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
||||
d FLOAT DEFAULT '2.00',
|
||||
e CHAR(4) DEFAULT 'TEST')
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t1 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10)
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
|
||||
INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA');
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
--echo *** Select from slave ***
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
--echo *** Drop t1 ***
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
############################################
|
||||
### Try to replicate CHAR(10) to CHAR(5) ###
|
||||
### Should Stop Slave or truncate value ###
|
||||
############################################
|
||||
|
||||
## BUG22086
|
||||
--echo *** Create t2 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
|
||||
d FLOAT DEFAULT '2.00',
|
||||
e CHAR(5) DEFAULT 'TEST2')
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t2 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
|
||||
INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Drop t2 ***
|
||||
connection master;
|
||||
DROP TABLE t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
####################################
|
||||
### Try to replicate BLOB to INT ###
|
||||
### Should Stop Slave ###
|
||||
####################################
|
||||
--echo *** Create t3 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
||||
d FLOAT DEFAULT '2.00',
|
||||
e CHAR(5) DEFAULT 'TEST2')
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t3 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
|
||||
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1535 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $slave_skip_counter= 2
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo *** Drop t3 ***
|
||||
connection master;
|
||||
DROP TABLE t3;
|
||||
sync_slave_with_master;
|
||||
|
||||
#####################################################
|
||||
# Columns with different types, more columns at end #
|
||||
# Expect: proper error message (wrong types) #
|
||||
#####################################################
|
||||
|
||||
--echo *** Create t4 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
||||
d FLOAT DEFAULT '2.00',
|
||||
e CHAR(5) DEFAULT 'TEST2')
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t4 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
|
||||
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
|
||||
(30000.22,4,'QA TESTING');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1535 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $slave_skip_counter= 2
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo *** Drop t4 ***
|
||||
connection master;
|
||||
DROP TABLE t4;
|
||||
sync_slave_with_master;
|
||||
|
||||
#######################################################
|
||||
# Columns with different types, same number of colums #
|
||||
# Expect: Proper error message #
|
||||
#######################################################
|
||||
|
||||
--echo *** Create t5 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
|
||||
c FLOAT, d INT, e DOUBLE,
|
||||
f DECIMAL(8,2))ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t5 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6),
|
||||
c DECIMAL(8,2), d BIT, e BLOB,
|
||||
f FLOAT) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
|
||||
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
|
||||
(2,'JOE',300.01,0,'b2b2',1.0000009);
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1535 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $slave_skip_counter= 2
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo *** Drop t5 ***
|
||||
connection master;
|
||||
DROP TABLE t5;
|
||||
sync_slave_with_master;
|
||||
|
||||
#######################################################
|
||||
################## Continued ##########################
|
||||
#######################################################
|
||||
# Columns with different types, same number of colums #
|
||||
# Expect: Proper error message #
|
||||
#######################################################
|
||||
|
||||
--echo *** Create t6 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
|
||||
c FLOAT, d INT)ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t6 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6),
|
||||
c DECIMAL(8,2), d BIT
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
|
||||
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
|
||||
(2,'JOE',300.01,0);
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1535 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
|
||||
#START SLAVE;
|
||||
|
||||
--echo *** Drop t6 ***
|
||||
connection master;
|
||||
DROP TABLE t6;
|
||||
connection slave;
|
||||
DROP TABLE t6;
|
||||
START SLAVE;
|
||||
#sync_slave_with_master;
|
||||
|
||||
|
||||
--echo **** Diff Table Def End ****
|
||||
|
||||
#######################################
|
||||
#### Extra Column on Slave Testing ####
|
||||
#######################################
|
||||
# Purpose: To test extra colums on the#
|
||||
# Slave #
|
||||
#######################################
|
||||
|
||||
--echo **** Extra Colums Start ****
|
||||
|
||||
##########################################
|
||||
# More columns in slave at end of table, #
|
||||
# added columns have default values #
|
||||
# Expect: it should work, default values #
|
||||
# should be used #
|
||||
##########################################
|
||||
|
||||
--echo *** Create t7 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
|
||||
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
|
||||
e CHAR(20) DEFAULT 'Extra Column Testing')
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t7 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
SELECT * FROM t7 ORDER BY a;
|
||||
|
||||
--echo *** Select from slave ***
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t7 ORDER BY a;
|
||||
|
||||
--echo *** Drop t7 ***
|
||||
connection master;
|
||||
DROP TABLE t7;
|
||||
sync_slave_with_master;
|
||||
|
||||
###########################################
|
||||
# More columns in slave at end of table, #
|
||||
# added columns do not have default values#
|
||||
# Expect: Proper error message #
|
||||
###########################################
|
||||
# NOTE: This should fail but currently #
|
||||
# works. BUG#22101 #
|
||||
###########################################
|
||||
--echo *** Create t8 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
|
||||
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
|
||||
e INT)ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t8 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
|
||||
### Uncomment once bug is fixed
|
||||
|
||||
#connection slave;
|
||||
#--let $slave_sql_errno= SOMETHING
|
||||
#--let $slave_skip_counter= 2
|
||||
#--let $show_slave_sql_error= 1
|
||||
#--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo *** Drop t8 ***
|
||||
connection master;
|
||||
DROP TABLE t8;
|
||||
sync_slave_with_master;
|
||||
|
||||
###########################################
|
||||
############# Continued ###################
|
||||
# More columns in slave at end of table, #
|
||||
# added columns do not have default values#
|
||||
# Expect: Proper error message #
|
||||
###########################################
|
||||
# Bug#22234, Bug#23907 Extra Slave Col is not
|
||||
# erroring on extra col with no default values.
|
||||
###############################################################
|
||||
# Error reaction is up to sql_mode of the slave sql (bug#38173)
|
||||
#--echo *** Create t9 on slave ***
|
||||
# Please, check BUG#47741 to see why you are not testing NDB.
|
||||
if (`SELECT $engine_type != 'NDB'`)
|
||||
{
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
|
||||
d TIMESTAMP,
|
||||
e INT NOT NULL,
|
||||
f text not null,
|
||||
g text,
|
||||
h blob not null,
|
||||
i blob) ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t9 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
|
||||
# the test would stop slave if @@sql_mode for the sql thread
|
||||
# was set to strict. Otherwise, as with this tests setup,
|
||||
# the implicit defaults will be inserted into fields even though
|
||||
# they are declared without DEFAULT clause.
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t9;
|
||||
|
||||
# todo: fix Bug #43992 slave sql thread can't tune own sql_mode ...
|
||||
# and add/restore waiting for stop test
|
||||
|
||||
#--let $slave_sql_errno= SOMETHING
|
||||
#--let $slave_skip_counter= 2
|
||||
#--let $show_slave_sql_error= 1
|
||||
#--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
}
|
||||
|
||||
#--echo *** Drop t9 ***
|
||||
connection master;
|
||||
DROP TABLE t9;
|
||||
sync_slave_with_master;
|
||||
|
||||
############################################
|
||||
# More columns in slave at middle of table #
|
||||
# Expect: Proper error message #
|
||||
############################################
|
||||
--echo *** Create t10 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
|
||||
c CHAR(5), e INT DEFAULT '1')ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t10 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1535 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $slave_skip_counter= 2
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo *** Drop t10 ***
|
||||
connection master;
|
||||
DROP TABLE t10;
|
||||
sync_slave_with_master;
|
||||
|
||||
############################################
|
||||
############## Continued ###################
|
||||
############################################
|
||||
# More columns in slave at middle of table #
|
||||
# Expect: Proper error message #
|
||||
############################################
|
||||
--echo *** Create t11 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
|
||||
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t11 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1535 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $slave_skip_counter= 2
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo *** Drop t11 ***
|
||||
connection master;
|
||||
DROP TABLE t11;
|
||||
sync_slave_with_master;
|
||||
|
||||
############################################
|
||||
############## Continued ###################
|
||||
############################################
|
||||
# More columns in slave at middle of table #
|
||||
# Expect: This one should pass blob-text #
|
||||
############################################
|
||||
--echo *** Create t12 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
|
||||
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t12 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
SELECT * FROM t12 ORDER BY a;
|
||||
|
||||
--echo *** Select on Slave ***
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t12 ORDER BY a;
|
||||
|
||||
--echo *** Drop t12 ***
|
||||
connection master;
|
||||
DROP TABLE t12;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo **** Extra Colums End ****
|
||||
|
||||
###############################
|
||||
# BUG#22177 CURRENT_TIMESTAMP #
|
||||
# Sould work with ^ #
|
||||
###############################
|
||||
--echo *** BUG 22177 Start ***
|
||||
--echo *** Create t13 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
|
||||
d INT DEFAULT '1',
|
||||
e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
||||
)ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t13 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
SELECT * FROM t13 ORDER BY a;
|
||||
|
||||
--echo *** Select on Slave ****
|
||||
sync_slave_with_master;
|
||||
--replace_column 5 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t13 ORDER BY a;
|
||||
|
||||
--echo *** Drop t13 ***
|
||||
connection master;
|
||||
DROP TABLE t13;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo *** 22117 END ***
|
||||
|
||||
##############################
|
||||
# ALTER MASTER TABLE TESTING #
|
||||
##############################
|
||||
|
||||
--echo *** Alter Master Table Testing Start ***
|
||||
|
||||
####################################################
|
||||
# - Alter Master adding columns at middle of table #
|
||||
# Expect: columns added #
|
||||
####################################################
|
||||
|
||||
--echo *** Create t14 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
|
||||
c6 INT DEFAULT '1',
|
||||
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
||||
)ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t14 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
|
||||
ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
||||
(2,2.00,'This Test Should work',@b1,'JOE'),
|
||||
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
||||
SELECT * FROM t14 ORDER BY c1;
|
||||
|
||||
|
||||
--echo *** Select on Slave ****
|
||||
sync_slave_with_master;
|
||||
--replace_column 7 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t14 ORDER BY c1;
|
||||
|
||||
####################################################
|
||||
# - Alter Master drop column at end of table #
|
||||
# Expect: column dropped #
|
||||
####################################################
|
||||
|
||||
--echo *** Create t14a on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
|
||||
c6 INT DEFAULT '1',
|
||||
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
||||
)ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t14a on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t14a (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t14a () VALUES(1,@b1,'Kyle'),
|
||||
(2,@b1,'JOE'),
|
||||
(3,@b1,'QA');
|
||||
|
||||
SELECT * FROM t14a ORDER BY c1;
|
||||
--echo *** Select on Slave ****
|
||||
sync_slave_with_master;
|
||||
--replace_column 5 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t14a ORDER BY c1;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
--echo *** Master Drop c5 ***
|
||||
connection master;
|
||||
ALTER TABLE t14a DROP COLUMN c5;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
|
||||
INSERT INTO t14a () VALUES(4,@b1),
|
||||
(5,@b1),
|
||||
(6,@b1);
|
||||
SELECT * FROM t14a ORDER BY c1;
|
||||
|
||||
--echo *** Select on Slave ****
|
||||
sync_slave_with_master;
|
||||
--replace_column 5 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t14a ORDER BY c1;
|
||||
|
||||
--connection master
|
||||
DROP TABLE t14a;
|
||||
--sync_slave_with_master
|
||||
|
||||
####################################################
|
||||
# - Alter Master Dropping columns from the middle. #
|
||||
# Expect: columns dropped #
|
||||
####################################################
|
||||
|
||||
--echo *** connect to master and drop columns ***
|
||||
connection master;
|
||||
ALTER TABLE t14 DROP COLUMN c2;
|
||||
ALTER TABLE t14 DROP COLUMN c4;
|
||||
--echo *** Select from Master ***
|
||||
SELECT * FROM t14 ORDER BY c1;
|
||||
|
||||
--echo *** Select from Slave ***
|
||||
sync_slave_with_master;
|
||||
--replace_column 5 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t14 ORDER BY c1;
|
||||
|
||||
--echo *** Drop t14 ***
|
||||
connection master;
|
||||
DROP TABLE t14;
|
||||
sync_slave_with_master;
|
||||
|
||||
##############################################################
|
||||
# - Alter Master adding columns that already exist on slave. #
|
||||
# Expect: proper error message #
|
||||
##############################################################
|
||||
|
||||
--echo *** Create t15 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
|
||||
c4 BLOB, c5 CHAR(5),
|
||||
c6 INT DEFAULT '1',
|
||||
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
||||
)ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t15 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
|
||||
c4 BLOB, c5 CHAR(5)) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
call mtr.add_suppression("Slave SQL.*Error .Unknown table .t6.. on query.* Error_code: 1051");
|
||||
call mtr.add_suppression("Slave SQL.*Error .Duplicate column name .c6.. on query.* Error_code: 1060");
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column . ...e mismatch.* Error_code: 1535");
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
||||
(2,2.00,'This Test Should work',@b1,'JOE'),
|
||||
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
||||
SELECT * FROM t15 ORDER BY c1;
|
||||
|
||||
|
||||
--echo *** Select on Slave ****
|
||||
sync_slave_with_master;
|
||||
--replace_column 7 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t15 ORDER BY c1;
|
||||
|
||||
--echo *** Add column on master that is a Extra on Slave ***
|
||||
connection master;
|
||||
ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1060 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1060
|
||||
--let $slave_skip_counter= 1
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo *** Try to insert in master ****
|
||||
connection master;
|
||||
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
|
||||
SELECT * FROM t15 ORDER BY c1;
|
||||
|
||||
#SHOW BINLOG EVENTS;
|
||||
|
||||
--echo *** Try to select from slave ****
|
||||
sync_slave_with_master;
|
||||
--replace_column 7 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t15 ORDER BY c1;
|
||||
|
||||
--echo *** DROP TABLE t15 ***
|
||||
connection master;
|
||||
DROP TABLE t15;
|
||||
sync_slave_with_master;
|
||||
|
||||
####################################
|
||||
# - Alter Master and ADD PARTITION #
|
||||
# Expect:? #
|
||||
####################################
|
||||
|
||||
--echo *** Create t16 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
|
||||
c4 BLOB, c5 CHAR(5),
|
||||
c6 INT DEFAULT '1',
|
||||
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
||||
)ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t16 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
|
||||
c4 BLOB, c5 CHAR(5))ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
set @b1 = 'b1b1b1b1';
|
||||
set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
||||
(2,2.00,'This Test Should work',@b1,'JOE'),
|
||||
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
||||
SELECT * FROM t16 ORDER BY c1;
|
||||
|
||||
--echo *** Select on Slave ****
|
||||
sync_slave_with_master;
|
||||
--replace_column 7 CURRENT_TIMESTAMP
|
||||
SELECT * FROM t16 ORDER BY c1;
|
||||
|
||||
--echo *** Add Partition on master ***
|
||||
connection master;
|
||||
ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
|
||||
INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
|
||||
SHOW CREATE TABLE t16;
|
||||
|
||||
--echo *** Show table on Slave ****
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t16;
|
||||
|
||||
--echo *** DROP TABLE t16 ***
|
||||
connection master;
|
||||
DROP TABLE t16;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo *** Alter Master End ***
|
||||
|
||||
############################################
|
||||
### Try to replicate BIGINT to SMALLINT ###
|
||||
### Should Stop Slave ###
|
||||
############################################
|
||||
|
||||
--echo *** Create t17 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
|
||||
d FLOAT DEFAULT '2.00',
|
||||
e CHAR(5) DEFAULT 'TEST2')
|
||||
ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t17 on Master ***
|
||||
connection master;
|
||||
eval CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10)
|
||||
) ENGINE=$engine_type;
|
||||
RESET MASTER;
|
||||
|
||||
--echo *** Start Slave ***
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo *** Master Data Insert ***
|
||||
connection master;
|
||||
|
||||
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1535 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $slave_skip_counter= 2
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo ** DROP table t17 ***
|
||||
connection master;
|
||||
DROP TABLE t17;
|
||||
sync_slave_with_master;
|
||||
@@ -0,0 +1,26 @@
|
||||
-- source include/master-slave.inc
|
||||
|
||||
#
|
||||
# BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log"
|
||||
# Replication should work when OPTIMIZE TABLE timeouts, and
|
||||
# when OPTIMIZE TABLE is executed on a non-existing table
|
||||
#
|
||||
|
||||
eval CREATE TABLE t1 ( a int ) ENGINE=$engine_type;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
connection master1;
|
||||
OPTIMIZE TABLE t1;
|
||||
|
||||
OPTIMIZE TABLE non_existing;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
connection master;
|
||||
select * from t1;
|
||||
commit;
|
||||
drop table t1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,59 @@
|
||||
# depends on the binlog output
|
||||
# Test of replicating FLUSH TABLES to make
|
||||
# RENAME TABLE work with MERGE tables on the slave.
|
||||
# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
let $SERVER_VERSION=`select version()`;
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (10);
|
||||
create table t2 (a int);
|
||||
create table t3 (a int) engine=merge union(t1);
|
||||
create table t4 (a int);
|
||||
# We force the slave to open t3 (because we want to try confusing him) with this :
|
||||
insert into t4 select * from t3;
|
||||
rename table t1 to t5, t2 to t1;
|
||||
# RENAME may have confused the master (this is a known bug): so FLUSH tables,
|
||||
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
|
||||
flush no_write_to_binlog tables;
|
||||
# Check that it's not in the binlog.
|
||||
let $binlog_start= $rename_event_pos;
|
||||
source include/show_binlog_events.inc;
|
||||
# Check that the master is not confused.
|
||||
select * from t3;
|
||||
# This FLUSH should go into the binlog to not confuse the slave.
|
||||
flush tables;
|
||||
# Check that it's in the binlog.
|
||||
let $wait_binlog_event= flush tables;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
# Check that the slave is not confused.
|
||||
select * from t3;
|
||||
# Note that all this confusion may cause warnings 'table xx is open on rename'
|
||||
# in the .err files; these are not fatal and are not reported by mysql-test-run.
|
||||
stop slave;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
connection slave;
|
||||
flush tables with read lock;
|
||||
start slave;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
--error 1192
|
||||
stop slave;
|
||||
|
||||
# Cleanup
|
||||
unlock tables;
|
||||
|
||||
connection master;
|
||||
drop table t3, t4, t5;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,63 @@
|
||||
# Check the replication of the FOREIGN_KEY_CHECKS variable.
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
eval CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=$engine_type;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
INSERT INTO t1 VALUES (10);
|
||||
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
|
||||
INSERT INTO t2 VALUES (5,0);
|
||||
INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID());
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY b;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY b;
|
||||
|
||||
connection master;
|
||||
SET TIMESTAMP=1000000000;
|
||||
CREATE TABLE t3 ( a INT UNIQUE );
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
# Had to add 1022 for run with ndb as ndb uses different
|
||||
# error and error code for error ER_DUP_ENTRY. Bug 16677
|
||||
--error 1022, ER_DUP_ENTRY
|
||||
INSERT INTO t3 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug #32468 delete rows event on a table with foreign key constraint fails
|
||||
#
|
||||
|
||||
connection master;
|
||||
|
||||
eval create table t1 (b int primary key) engine = $engine_type;
|
||||
eval create table t2 (a int primary key, b int, foreign key (b) references t1(b))
|
||||
engine = $engine_type;
|
||||
|
||||
insert into t1 set b=1;
|
||||
insert into t2 set a=1, b=1;
|
||||
|
||||
set foreign_key_checks=0;
|
||||
set @@session.binlog_format=row;
|
||||
delete from t1;
|
||||
|
||||
--echo must sync w/o a problem (could not with the buggy code)
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1 /* must be zero */;
|
||||
|
||||
|
||||
# cleanup for bug#32468
|
||||
|
||||
connection master;
|
||||
drop table t2,t1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,84 @@
|
||||
#
|
||||
# BUG#45214
|
||||
# The common part of the "rpl_get_master_version_and_clock" test.
|
||||
# Restart slave under network disconnection between slave and master
|
||||
# following the steps:
|
||||
# 0 - Set DEBUG_SYNC_ACTION to wait
|
||||
# before call mysql_real_query(...) function in get_master_version_and_clock(...)
|
||||
# function and hang here
|
||||
# 1 - activate a sync-point through the $dbug_sync_point argument of the test
|
||||
# 2 - shutdown master server for simulating network disconnection
|
||||
# 3 - signal to the IO thread through $debug_sync_action to unhold from the sync-point
|
||||
# 4 - check if the slave I/O thread tries to reconnect to master.
|
||||
#
|
||||
# Note: make sure to initialize the $debug_sync_action and $dbug_sync_point
|
||||
# before calling the test script.
|
||||
#
|
||||
# Pattern of usage:
|
||||
#
|
||||
# The caller test supplies the DBUG_EXECUTE_IF name
|
||||
#
|
||||
# let $dbug_sync_point = 'dbug_execute_if_name';
|
||||
#
|
||||
# as well as the action list for DEBUG_SYNC
|
||||
#
|
||||
# let $debug_sync_action= 'now signal signal_name';
|
||||
#
|
||||
# The $dbug_sync_point becomes the value of @@global.debug generating
|
||||
# a newly started IO-slave thread's session value.
|
||||
# Notice incremental operations to add and remove dbug_execute_if_name
|
||||
# from the global variable allows propagation more dbug arguments
|
||||
# out of mtr.
|
||||
# The action list is to fire at proper time according to test logics
|
||||
# (see pp 0-4 above).
|
||||
#
|
||||
|
||||
connection slave;
|
||||
if (!$debug_sync_action)
|
||||
{
|
||||
--die Cannot continue. Please set value for debug_sync_action.
|
||||
}
|
||||
|
||||
# Restart slave
|
||||
--source include/stop_slave.inc
|
||||
|
||||
eval SET @@global.debug= "+d,$dbug_sync_point";
|
||||
|
||||
--source include/start_slave.inc
|
||||
--echo slave is going to hang in get_master_version_and_clock
|
||||
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_stop_server.inc
|
||||
|
||||
--echo slave is unblocked
|
||||
|
||||
eval SET DEBUG_SYNC=$debug_sync_action;
|
||||
|
||||
# Show slave last IO errno
|
||||
connection slave;
|
||||
--echo Check network error happened here
|
||||
# '2013' CR_SERVER_LOST
|
||||
# '2003' CR_CONN_HOST_ERROR
|
||||
# '2002' CR_CONNECTION_ERROR
|
||||
# '2006' CR_SERVER_GONE_ERROR
|
||||
# '1040' ER_CON_COUNT_ERROR
|
||||
# '1053' ER_SERVER_SHUTDOWN
|
||||
let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013;
|
||||
--let $slave_io_error_is_nonfatal= 1
|
||||
source include/wait_for_slave_io_error.inc;
|
||||
|
||||
# deactivate the sync point of get_master_version_and_clock()
|
||||
# now to avoid restarting IO-thread to re-enter it.
|
||||
# There will be a new IO thread forked out with its @@session.debug
|
||||
# unset.
|
||||
eval set @@global.debug = "-d,$dbug_sync_point";
|
||||
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_start_server.inc
|
||||
|
||||
# We don't source include/wait_for_slave_io_to_start.inc, because the
|
||||
# IO thread has an error and wait_for_slave_io_to_start.inc fails if
|
||||
# the IO thread has an error.
|
||||
--let $slave_param= Slave_IO_Running
|
||||
--let $slave_param_value= Yes
|
||||
--source include/wait_for_slave_param.inc
|
||||
@@ -0,0 +1,141 @@
|
||||
# The two bugs below (BUG#25507 and BUG#26116) existed only in
|
||||
# statement-based binlogging; we test that now they are fixed;
|
||||
# we also test that mixed and row-based binlogging work too,
|
||||
# for completeness.
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
CREATE SCHEMA IF NOT EXISTS mysqlslap;
|
||||
USE mysqlslap;
|
||||
--enable_warnings
|
||||
|
||||
select @@global.binlog_format;
|
||||
|
||||
#
|
||||
# BUG#25507 "multi-row insert delayed + auto increment causes
|
||||
# duplicate key entries on slave";
|
||||
# happened only in statement-based binlogging.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id INT primary key auto_increment, name VARCHAR(64));
|
||||
let $query = "INSERT DELAYED INTO t1 VALUES (null, 'Dr. No'), (null, 'From Russia With Love'), (null, 'Goldfinger'), (null, 'Thunderball'), (null, 'You Only Live Twice')";
|
||||
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
|
||||
|
||||
FLUSH TABLE t1; # another way to be sure INSERT DELAYED has inserted
|
||||
SELECT COUNT(*) FROM t1;
|
||||
# when bug existed slave failed below ("duplicate key" error at random INSERT)
|
||||
sync_slave_with_master;
|
||||
use mysqlslap;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
#
|
||||
# BUG#26116 "If multi-row INSERT DELAYED has errors,
|
||||
# statement-based binlogging breaks";
|
||||
# happened only in statement-based binlogging.
|
||||
#
|
||||
|
||||
connection master;
|
||||
truncate table t1;
|
||||
# first scenario: duplicate on first row
|
||||
insert delayed into t1 values(10, "my name");
|
||||
if ($binlog_format_statement)
|
||||
{
|
||||
# statement below will be converted to non-delayed INSERT and so
|
||||
# will stop at first error, guaranteeing replication.
|
||||
--error ER_DUP_ENTRY
|
||||
insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
|
||||
}
|
||||
if (!$binlog_format_statement)
|
||||
{
|
||||
insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
|
||||
}
|
||||
flush table t1; # to wait for INSERT DELAYED to be done
|
||||
select * from t1;
|
||||
sync_slave_with_master;
|
||||
# when bug existed in statement-based binlogging, t1 on slave had
|
||||
# different content from on master
|
||||
select * from t1;
|
||||
|
||||
# second scenario: duplicate on second row
|
||||
connection master;
|
||||
delete from t1 where id!=10;
|
||||
if ($binlog_format_statement)
|
||||
{
|
||||
# statement below will be converted to non-delayed INSERT and so
|
||||
# will be binlogged with its ER_DUP_ENTRY error code, guaranteeing
|
||||
# replication (slave will hit the same error code and so be fine).
|
||||
--error ER_DUP_ENTRY
|
||||
insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
|
||||
}
|
||||
if (!$binlog_format_statement)
|
||||
{
|
||||
insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
|
||||
}
|
||||
flush table t1; # to wait for INSERT DELAYED to be done
|
||||
select * from t1;
|
||||
sync_slave_with_master;
|
||||
# when bug existed in statement-based binlogging, query was binlogged
|
||||
# with error_code=0 so slave stopped
|
||||
select * from t1;
|
||||
|
||||
# clean up
|
||||
connection master;
|
||||
USE test;
|
||||
DROP SCHEMA mysqlslap;
|
||||
sync_slave_with_master;
|
||||
use test;
|
||||
connection master;
|
||||
|
||||
#
|
||||
# Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but
|
||||
# on the slave
|
||||
#
|
||||
if ($binlog_format_statement)
|
||||
{
|
||||
#flush the logs before the test
|
||||
connection slave;
|
||||
FLUSH LOGS;
|
||||
connection master;
|
||||
FLUSH LOGS;
|
||||
}
|
||||
|
||||
CREATE TABLE t1(a int, UNIQUE(a));
|
||||
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
||||
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
||||
flush table t1; # to wait for INSERT DELAYED to be done
|
||||
if ($binlog_format_statement)
|
||||
{
|
||||
#must show two INSERT DELAYED
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_limit= 1,2
|
||||
--source include/show_binlog_events.inc
|
||||
}
|
||||
select * from t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
echo On slave;
|
||||
if ($binlog_format_statement)
|
||||
{
|
||||
#must show two INSERT DELAYED
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_limit= 1,2
|
||||
--source include/show_binlog_events.inc
|
||||
}
|
||||
select * from t1;
|
||||
|
||||
|
||||
# clean up
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
if (`SELECT @@global.binlog_format != 'ROW'`)
|
||||
{
|
||||
#flush the logs after the test
|
||||
FLUSH LOGS;
|
||||
connection master;
|
||||
FLUSH LOGS;
|
||||
}
|
||||
connection master;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
@@ -0,0 +1,64 @@
|
||||
# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
|
||||
# In SBR, if a statement does not fail, it is always written to the binary log,
|
||||
# regardless if rows are changed or not. If there is a failure, a statement is
|
||||
# only written to the binary log if a non-transactional (.e.g. MyIsam) engine
|
||||
# is updated. INSERT ON DUPLICATE KEY UPDATE was not following the rule above
|
||||
# and was not written to the binary log, if then engine was Innodb.
|
||||
#
|
||||
# In this test case, we check if INSERT ON DUPLICATE KEY UPDATE that does not
|
||||
# change anything is still written to the binary log.
|
||||
|
||||
# Prepare environment
|
||||
--connection master
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a INT UNSIGNED NOT NULL PRIMARY KEY
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a INT UNSIGNED
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
|
||||
# An insert duplicate that does not update anything must be written to the binary
|
||||
# log in SBR and MIXED modes. We check this property by summing a before and after
|
||||
# the update and comparing the binlog positions. The sum should be the same at both
|
||||
# points and the statement should be in the binary log.
|
||||
--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
|
||||
--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1)
|
||||
--let $statement_file=INSERT INTO t1 SELECT t2.a FROM t2 ORDER BY t2.a ON DUPLICATE KEY UPDATE t1.a= t1.a
|
||||
--eval $statement_file
|
||||
|
||||
--let $assert_cond= SUM(a) = 1 FROM t1
|
||||
--let $assert_text= Sum of elements in t1 should be 1.
|
||||
--source include/assert.inc
|
||||
|
||||
if (`SELECT @@BINLOG_FORMAT = 'ROW'`)
|
||||
{
|
||||
--let $binlog_position_cmp= =
|
||||
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('Innodb')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('MyIsam')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 0, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
--source include/assert.inc
|
||||
|
||||
# Compare master and slave
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:test.t1 , slave:test.t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
# Clean up
|
||||
--connection master
|
||||
drop table t1, t2;
|
||||
--sync_slave_with_master
|
||||
537
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_insert_id.test
Normal file
537
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_insert_id.test
Normal file
@@ -0,0 +1,537 @@
|
||||
###########################################################
|
||||
# See if queries that use both auto_increment and LAST_INSERT_ID()
|
||||
# are replicated well
|
||||
############################################################
|
||||
# REQUIREMENT
|
||||
# Auto increment should work for a table with an auto_increment
|
||||
# column and index but without primary key.
|
||||
##############################################################
|
||||
|
||||
--echo #
|
||||
--echo # Setup
|
||||
--echo #
|
||||
|
||||
use test;
|
||||
|
||||
--echo #
|
||||
--echo # See if queries that use both auto_increment and LAST_INSERT_ID()
|
||||
--echo # are replicated well
|
||||
--echo #
|
||||
--echo # We also check how the foreign_key_check variable is replicated
|
||||
--echo #
|
||||
|
||||
-- source include/master-slave.inc
|
||||
#should work for both SBR and RBR
|
||||
|
||||
# If concurrent inserts are on, it is not guaranteed that the rows
|
||||
# inserted by INSERT are immediately accessible by SELECT in another
|
||||
# thread. This would cause problems near the line 'connection master1'
|
||||
# below. So we turn off concurrent inserts.
|
||||
connection master;
|
||||
SET @old_concurrent_insert= @@global.concurrent_insert;
|
||||
SET @@global.concurrent_insert= 0;
|
||||
|
||||
connection master;
|
||||
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
|
||||
eval create table t2(b int auto_increment, c int, key(b)) engine=$engine_type;
|
||||
insert into t1 values (1),(2),(3);
|
||||
insert into t1 values (null);
|
||||
insert into t2 values (null,last_insert_id());
|
||||
sync_slave_with_master;
|
||||
select * from t1 ORDER BY a;
|
||||
select * from t2 ORDER BY b;
|
||||
connection master;
|
||||
#check if multi-line inserts,
|
||||
#which set last_insert_id to the first id inserted,
|
||||
#are replicated the same way
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
--disable_warnings
|
||||
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
|
||||
eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
|
||||
--enable_warnings
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
insert into t1 values (10);
|
||||
insert into t1 values (null),(null),(null);
|
||||
insert into t2 values (5,0);
|
||||
insert into t2 values (null,last_insert_id());
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
connection master;
|
||||
|
||||
--echo #
|
||||
--echo # check if INSERT SELECT in auto_increment is well replicated (bug #490)
|
||||
--echo #
|
||||
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
|
||||
eval create table t2(b int auto_increment, c int, key(b)) engine=$engine_type;
|
||||
insert into t1 values (10);
|
||||
insert into t1 values (null),(null),(null);
|
||||
insert into t2 values (5,0);
|
||||
insert into t2 (c) select * from t1 ORDER BY a;
|
||||
select * from t2 ORDER BY b;
|
||||
sync_slave_with_master;
|
||||
select * from t1 ORDER BY a;
|
||||
select * from t2 ORDER BY b;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
|
||||
--echo # FOREIGN_KEY_CHECKS
|
||||
--echo #
|
||||
|
||||
connection master;
|
||||
SET TIMESTAMP=1000000000;
|
||||
eval CREATE TABLE t1 ( a INT UNIQUE ) engine=$engine_type;
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
# Duplicate Key Errors
|
||||
--error 1022, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#14553: NULL in WHERE resets LAST_INSERT_ID
|
||||
--echo #
|
||||
|
||||
connection master;
|
||||
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
|
||||
eval create table t2(a int) engine=$engine_type;
|
||||
insert into t1 (a) values (null);
|
||||
insert into t2 (a) select a from t1 where a is null;
|
||||
insert into t2 (a) select a from t1 where a is null;
|
||||
select * from t2;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t2;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
--echo #
|
||||
--echo # End of 4.1 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
|
||||
--echo #
|
||||
--echo # The solution is not to reset last_insert_id on enter to sub-statement.
|
||||
--echo #
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
drop function if exists bug15728;
|
||||
drop function if exists bug15728_insert;
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
eval create table t1 (
|
||||
id int not null auto_increment,
|
||||
last_id int,
|
||||
primary key (id)
|
||||
) engine=$engine_type;
|
||||
create function bug15728() returns int(11)
|
||||
return last_insert_id();
|
||||
|
||||
insert into t1 (last_id) values (0);
|
||||
insert into t1 (last_id) values (last_insert_id());
|
||||
insert into t1 (last_id) values (bug15728());
|
||||
|
||||
# Check that nested call replicates too.
|
||||
eval create table t2 (
|
||||
id int not null auto_increment,
|
||||
last_id int,
|
||||
primary key (id)
|
||||
) engine=$engine_type;
|
||||
delimiter |;
|
||||
create function bug15728_insert() returns int(11) modifies sql data
|
||||
begin
|
||||
insert into t2 (last_id) values (bug15728());
|
||||
return bug15728();
|
||||
end|
|
||||
create trigger t1_bi before insert on t1 for each row
|
||||
begin
|
||||
declare res int;
|
||||
select bug15728_insert() into res;
|
||||
set NEW.last_id = res;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
insert into t1 (last_id) values (0);
|
||||
|
||||
drop trigger t1_bi;
|
||||
|
||||
# Check that nested call doesn't affect outer context.
|
||||
select last_insert_id();
|
||||
select bug15728_insert();
|
||||
select last_insert_id();
|
||||
insert into t1 (last_id) values (bug15728());
|
||||
# This should be exactly one greater than in the previous call.
|
||||
select last_insert_id();
|
||||
|
||||
# BUG#20339 - stored procedure using LAST_INSERT_ID() does not
|
||||
# replicate statement-based
|
||||
--disable_warnings
|
||||
drop procedure if exists foo;
|
||||
--enable_warnings
|
||||
delimiter |;
|
||||
create procedure foo()
|
||||
begin
|
||||
declare res int;
|
||||
insert into t2 (last_id) values (bug15728());
|
||||
insert into t1 (last_id) values (bug15728());
|
||||
end|
|
||||
delimiter ;|
|
||||
call foo();
|
||||
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
connection master;
|
||||
|
||||
drop function bug15728;
|
||||
drop function bug15728_insert;
|
||||
drop table t1,t2;
|
||||
drop procedure foo;
|
||||
|
||||
# test of BUG#20188 REPLACE or ON DUPLICATE KEY UPDATE in
|
||||
# auto_increment breaks binlog
|
||||
|
||||
eval create table t1 (n int primary key auto_increment not null,
|
||||
b int, unique(b)) engine=$engine_type;
|
||||
|
||||
# First, test that we do not call restore_auto_increment() too early
|
||||
# in write_record():
|
||||
set sql_log_bin=0;
|
||||
insert into t1 values(null,100);
|
||||
replace into t1 values(null,50),(null,100),(null,150);
|
||||
select * from t1 order by n;
|
||||
truncate table t1;
|
||||
set sql_log_bin=1;
|
||||
|
||||
insert into t1 values(null,100);
|
||||
select * from t1 order by n;
|
||||
sync_slave_with_master;
|
||||
# make slave's table autoinc counter bigger
|
||||
insert into t1 values(null,200),(null,300);
|
||||
delete from t1 where b <> 100;
|
||||
# check that slave's table content is identical to master
|
||||
select * from t1 order by n;
|
||||
# only the auto_inc counter differs.
|
||||
|
||||
connection master;
|
||||
replace into t1 values(null,100),(null,350);
|
||||
select * from t1 order by n;
|
||||
sync_slave_with_master;
|
||||
select * from t1 order by n;
|
||||
|
||||
# Same test as for REPLACE, but for ON DUPLICATE KEY UPDATE
|
||||
|
||||
# We first check that if we update a row using a value larger than the
|
||||
# table's counter, the counter for next row is bigger than the
|
||||
# after-value of the updated row.
|
||||
connection master;
|
||||
insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000;
|
||||
select * from t1 order by n;
|
||||
sync_slave_with_master;
|
||||
select * from t1 order by n;
|
||||
|
||||
# and now test for the bug:
|
||||
connection master;
|
||||
drop table t1;
|
||||
eval create table t1 (n int primary key auto_increment not null,
|
||||
b int, unique(b)) engine=$engine_type;
|
||||
insert into t1 values(null,100);
|
||||
select * from t1 order by n;
|
||||
sync_slave_with_master;
|
||||
insert into t1 values(null,200),(null,300);
|
||||
delete from t1 where b <> 100;
|
||||
select * from t1 order by n;
|
||||
|
||||
connection master;
|
||||
insert into t1 values(null,100),(null,350) on duplicate key update n=2;
|
||||
select * from t1 order by n;
|
||||
sync_slave_with_master;
|
||||
select * from t1 order by n;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values"
|
||||
#
|
||||
|
||||
connection master;
|
||||
# testcase with INSERT VALUES
|
||||
eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
|
||||
UNIQUE(b)) ENGINE=$engine_type;
|
||||
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
# tescase with INSERT SELECT
|
||||
eval 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)
|
||||
) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (
|
||||
field_a int(10) unsigned NOT NULL,
|
||||
field_b varchar(255) NOT NULL,
|
||||
field_c varchar(255) NOT NULL
|
||||
) ENGINE=$engine_type;
|
||||
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');
|
||||
# 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 ORDER BY id;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# BUG#20339: stored procedure using LAST_INSERT_ID() does not
|
||||
# replicate statement-based.
|
||||
#
|
||||
# There is another version of the test for bug#20339 above that is
|
||||
# actually originates in 5.1, and this is the version that is merged
|
||||
# from 5.0.
|
||||
#
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
# Reset result of LAST_INSERT_ID().
|
||||
SELECT LAST_INSERT_ID(0);
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
id INT NOT NULL DEFAULT 0,
|
||||
last_id INT,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
last_id INT,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
INSERT INTO t2 (last_id) VALUES (LAST_INSERT_ID());
|
||||
INSERT INTO t1 (last_id) VALUES (LAST_INSERT_ID());
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
CALL p1();
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
SELECT * FROM t2 ORDER BY id;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
SELECT * FROM t2 ORDER BY id;
|
||||
|
||||
connection master;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
#
|
||||
# BUG#21726: Incorrect result with multiple invocations of
|
||||
# LAST_INSERT_ID
|
||||
#
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
j INT DEFAULT 0
|
||||
) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (i INT) ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
INSERT INTO t1 (i) VALUES (NULL);
|
||||
INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
|
||||
INSERT INTO t1 (i) VALUES (NULL), (NULL);
|
||||
INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
|
||||
END |
|
||||
|
||||
CREATE FUNCTION f1() RETURNS INT MODIFIES SQL DATA
|
||||
BEGIN
|
||||
INSERT INTO t1 (i) VALUES (NULL);
|
||||
INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
|
||||
INSERT INTO t1 (i) VALUES (NULL), (NULL);
|
||||
INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
|
||||
RETURN 0;
|
||||
END |
|
||||
|
||||
CREATE FUNCTION f2() RETURNS INT NOT DETERMINISTIC
|
||||
RETURN LAST_INSERT_ID() |
|
||||
|
||||
CREATE FUNCTION f3() RETURNS INT MODIFIES SQL DATA
|
||||
BEGIN
|
||||
INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
|
||||
RETURN 0;
|
||||
END |
|
||||
delimiter ;|
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, -1);
|
||||
CALL p1();
|
||||
SELECT f1();
|
||||
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, f2());
|
||||
# Test replication of substitution "IS NULL" -> "= LAST_INSERT_ID".
|
||||
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
|
||||
UPDATE t1 SET j= -1 WHERE i IS NULL;
|
||||
|
||||
# Test statement-based replication of function calls.
|
||||
INSERT INTO t1 (i) VALUES (NULL);
|
||||
|
||||
# Here, we rely on having set @@concurrent_insert= 0 (see comment at
|
||||
# the top of this file).
|
||||
connection master1;
|
||||
INSERT INTO t1 (i) VALUES (NULL);
|
||||
|
||||
connection master;
|
||||
SELECT f3();
|
||||
|
||||
SELECT * FROM t1 ORDER BY i;
|
||||
SELECT * FROM t2 ORDER BY i;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
DROP PROCEDURE p1;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.0 tests
|
||||
--echo #
|
||||
|
||||
# Tests in this file are tightly bound together. Recreate t2.
|
||||
connection master;
|
||||
eval create table t2 (
|
||||
id int not null auto_increment,
|
||||
last_id int,
|
||||
primary key (id)
|
||||
) engine=$engine_type;
|
||||
|
||||
|
||||
# Test for BUG#20341 "stored function inserting into one
|
||||
# auto_increment puts bad data in slave"
|
||||
|
||||
connection master;
|
||||
truncate table t2;
|
||||
# no auto_increment
|
||||
eval create table t1 (id tinyint primary key) engine=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
create function insid() returns int
|
||||
begin
|
||||
insert into t2 (last_id) values (0);
|
||||
return 0;
|
||||
end|
|
||||
delimiter ;|
|
||||
set sql_log_bin=0;
|
||||
insert into t2 (id) values(1),(2),(3);
|
||||
delete from t2;
|
||||
set sql_log_bin=1;
|
||||
#inside SELECT, then inside INSERT
|
||||
select insid();
|
||||
set sql_log_bin=0;
|
||||
insert into t2 (id) values(5),(6),(7);
|
||||
delete from t2 where id>=5;
|
||||
set sql_log_bin=1;
|
||||
insert into t1 select insid();
|
||||
select * from t1 order by id;
|
||||
select * from t2 order by id;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1 order by id;
|
||||
select * from t2 order by id;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop function insid;
|
||||
|
||||
truncate table t2;
|
||||
eval create table t1 (n int primary key auto_increment not null,
|
||||
b int, unique(b)) engine=$engine_type;
|
||||
delimiter |;
|
||||
create procedure foo()
|
||||
begin
|
||||
insert into t1 values(null,10);
|
||||
insert ignore into t1 values(null,10);
|
||||
insert ignore into t1 values(null,10);
|
||||
insert into t2 values(null,3);
|
||||
end|
|
||||
delimiter ;|
|
||||
call foo();
|
||||
select * from t1 order by n;
|
||||
select * from t2 order by id;
|
||||
|
||||
sync_slave_with_master;
|
||||
select * from t1 order by n;
|
||||
select * from t2 order by id;
|
||||
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
drop procedure foo;
|
||||
SET @@global.concurrent_insert= @old_concurrent_insert;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,80 @@
|
||||
###########################################################
|
||||
# See if queries that use both auto_increment and LAST_INSERT_ID()
|
||||
# are replicated well
|
||||
############################################################
|
||||
# REQUIREMENT
|
||||
# Auto increment should work for a table with auto_increment column
|
||||
# and primary key.
|
||||
##############################################################
|
||||
|
||||
# We also check how the foreign_key_check variable is replicated
|
||||
|
||||
-- source include/master-slave.inc
|
||||
#should work for both SBR and RBR
|
||||
|
||||
connection master;
|
||||
create table t1(a int auto_increment, primary key(a));
|
||||
create table t2(b int auto_increment, c int, primary key(b));
|
||||
insert into t1 values (1),(2),(3);
|
||||
insert into t1 values (null);
|
||||
insert into t2 values (null,last_insert_id());
|
||||
sync_slave_with_master;
|
||||
select * from t1 ORDER BY a;
|
||||
select * from t2 ORDER BY b;
|
||||
connection master;
|
||||
#check if multi-line inserts,
|
||||
#which set last_insert_id to the first id inserted,
|
||||
#are replicated the same way
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
--disable_warnings
|
||||
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
|
||||
eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
|
||||
--enable_warnings
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
insert into t1 values (10);
|
||||
insert into t1 values (null),(null),(null);
|
||||
insert into t2 values (5,0);
|
||||
insert into t2 values (null,last_insert_id());
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
sync_slave_with_master;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
connection master;
|
||||
|
||||
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
|
||||
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
create table t1(a int auto_increment, primary key(a));
|
||||
create table t2(b int auto_increment, c int, primary key(b));
|
||||
insert into t1 values (10);
|
||||
insert into t1 values (null),(null),(null);
|
||||
insert into t2 values (5,0);
|
||||
insert into t2 (c) select * from t1 ORDER BY a;
|
||||
select * from t2 ORDER BY b;
|
||||
sync_slave_with_master;
|
||||
select * from t1 ORDER BY a;
|
||||
select * from t2 ORDER BY b;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
|
||||
# FOREIGN_KEY_CHECKS
|
||||
#
|
||||
connection master;
|
||||
SET TIMESTAMP=1000000000;
|
||||
CREATE TABLE t1 ( a INT UNIQUE );
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
# Duplicate Key Errors codes
|
||||
--error 1022, ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,81 @@
|
||||
# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB"
|
||||
# The bug was that if on master, INSERT IGNORE ignored some
|
||||
# rows, and the table was InnoDB with auto_inc column, then on slave
|
||||
# some rows received an auto_inc bigger than on master.
|
||||
# Slave needs to be started with --innodb to store table in InnoDB.
|
||||
# Same test for MyISAM (which had no bug).
|
||||
|
||||
--connection master
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
unique (b)
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned, # to force INSERT SELECT to have a certain order
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 1);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
INSERT INTO t1 VALUES (NULL, 3);
|
||||
INSERT INTO t1 VALUES (NULL, 4);
|
||||
|
||||
# An alternation of values which will conflict in t1 and will not.
|
||||
|
||||
INSERT INTO t2 VALUES (1, 1);
|
||||
INSERT INTO t2 VALUES (2, 2);
|
||||
INSERT INTO t2 VALUES (3, 5);
|
||||
INSERT INTO t2 VALUES (4, 3);
|
||||
INSERT INTO t2 VALUES (5, 4);
|
||||
INSERT INTO t2 VALUES (6, 6);
|
||||
|
||||
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
|
||||
--let $assert_cond= COUNT(*) = 6 FROM t1
|
||||
--let $assert_text= Count of elements in t1 should be 6.
|
||||
--source include/assert.inc
|
||||
|
||||
# Compare master and slave
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables= master:test.t1 , slave:test.t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
|
||||
# An insert ignore that does not update anything must be written to the binary log in SBR
|
||||
# and MIXED modes. We check this property by counting occurrences in t1 before and after
|
||||
# the insert and comparing the binlog positions. The count should be the same in both points
|
||||
# and the statement should be in the binary log.
|
||||
--connection master
|
||||
--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
|
||||
--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1)
|
||||
--let $statement_file=INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
|
||||
--eval $statement_file
|
||||
|
||||
--let $assert_cond= COUNT(*) = 6 FROM t1
|
||||
--let $assert_text= Count of elements in t1 should be 6.
|
||||
--source include/assert.inc
|
||||
|
||||
if (`SELECT @@BINLOG_FORMAT = 'ROW'`)
|
||||
{
|
||||
--let $binlog_position_cmp= =
|
||||
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('Innodb')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 2, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('MyIsam')`)
|
||||
{
|
||||
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\'
|
||||
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
|
||||
}
|
||||
--source include/assert.inc
|
||||
|
||||
# Clean up
|
||||
--connection master
|
||||
drop table t1, t2;
|
||||
--sync_slave_with_master
|
||||
251
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_loaddata.test
Normal file
251
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_loaddata.test
Normal file
@@ -0,0 +1,251 @@
|
||||
# See if replication of a "LOAD DATA in an autoincrement column"
|
||||
# Honours autoincrement values
|
||||
# i.e. if the master and slave have the same sequence
|
||||
#
|
||||
# check replication of load data for temporary tables with additional
|
||||
# parameters
|
||||
#
|
||||
# check if duplicate entries trigger an error (they should unless IGNORE or
|
||||
# REPLACE was used on the master) (bug 571).
|
||||
#
|
||||
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
|
||||
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
|
||||
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- source include/master-slave.inc
|
||||
source include/have_innodb.inc;
|
||||
|
||||
# MTR is not case-sensitive.
|
||||
let $lower_stmt_head= load data;
|
||||
let $UPPER_STMT_HEAD= LOAD DATA;
|
||||
if ($lock_option)
|
||||
{
|
||||
#if $lock_option is null, an extra blank is added into the statement,
|
||||
#this will change the result of rpl_loaddata test case. so $lock_option
|
||||
#is set only when it is not null.
|
||||
let $lower_stmt_head= load data $lock_option;
|
||||
let $UPPER_STMT_HEAD= LOAD DATA $lock_option;
|
||||
}
|
||||
|
||||
select last_insert_id();
|
||||
create table t1(a int not null auto_increment, b int, primary key(a) );
|
||||
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
|
||||
select last_insert_id();
|
||||
|
||||
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
|
||||
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
|
||||
|
||||
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
|
||||
insert into t3 select * from t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
select * from t1;
|
||||
select * from t3;
|
||||
|
||||
connection master;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
create table t1(a int, b int, unique(b));
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
# See if slave stops when there's a duplicate entry for key error in LOAD DATA
|
||||
|
||||
insert into t1 values(1,10);
|
||||
|
||||
connection master;
|
||||
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# 1062 = ER_DUP_ENTRY
|
||||
call mtr.add_suppression("Slave SQL.*Error .Duplicate entry .10. for key .b.. on query.* Error_code: 1062");
|
||||
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.*error code=1062.*Error on slave:.*Error_code: 0");
|
||||
--let $slave_sql_errno= 1062
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
|
||||
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
|
||||
# takes us directly to the end of the relay log).
|
||||
|
||||
sync_with_master;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
# Trigger error again to test CHANGE MASTER
|
||||
|
||||
connection master;
|
||||
set sql_log_bin=0;
|
||||
delete from t1;
|
||||
set sql_log_bin=1;
|
||||
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# The SQL slave thread should be stopped now.
|
||||
# Exec_Master_Log_Pos should point to the start of Execute event
|
||||
# for last load data.
|
||||
# 1062 = ER_DUP_ENTRY
|
||||
--let $slave_sql_errno= 1062
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
|
||||
--source include/stop_slave_io.inc
|
||||
change master to master_user='test';
|
||||
change master to master_user='root';
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
# Trigger error again to test RESET SLAVE
|
||||
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
connection master;
|
||||
set sql_log_bin=0;
|
||||
delete from t1;
|
||||
set sql_log_bin=1;
|
||||
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
# The SQL slave thread should be stopped now.
|
||||
# 1062 = ER_DUP_ENTRY
|
||||
--let $slave_sql_errno= 1062
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
|
||||
stop slave;
|
||||
reset slave;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
|
||||
unique(day)) engine=$engine_type; # no transactions
|
||||
--error ER_DUP_ENTRY
|
||||
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
'\n##\n' starting by '>' ignore 1 lines;
|
||||
select * from t2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
select * from t2;
|
||||
|
||||
# verify that if no error on slave, this is an error
|
||||
|
||||
alter table t2 drop key day;
|
||||
connection master;
|
||||
delete from t2;
|
||||
--error ER_DUP_ENTRY
|
||||
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
|
||||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
'\n##\n' starting by '>' ignore 1 lines;
|
||||
connection slave;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
drop table t1, t2;
|
||||
--source include/stop_slave_io.inc
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
|
||||
# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed
|
||||
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
eval $UPPER_STMT_HEAD INFILE "../../std_data/words.dat" INTO TABLE t1;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
# BUG#48297: Schema name is ignored when LOAD DATA is written into binlog,
|
||||
# replication aborts
|
||||
-- let $rpl_only_running_threads= 1
|
||||
-- source include/rpl_reset.inc
|
||||
|
||||
-- let $db1= b48297_db1
|
||||
-- let $db2= b42897_db2
|
||||
|
||||
-- connection master
|
||||
|
||||
-- disable_warnings
|
||||
-- eval drop database if exists $db1
|
||||
-- eval drop database if exists $db2
|
||||
-- enable_warnings
|
||||
|
||||
-- eval create database $db1
|
||||
-- eval create database $db2
|
||||
|
||||
-- eval use $db1
|
||||
-- eval CREATE TABLE t1 (c1 VARCHAR(256)) engine=$engine_type;
|
||||
|
||||
-- eval use $db2
|
||||
|
||||
-- echo ### assertion: works with cross-referenced database
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
|
||||
|
||||
-- eval use $db1
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- echo ### assertion: works with fully qualified name on current database
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
|
||||
|
||||
-- echo ### assertion: works without fully qualified name on current database
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
|
||||
|
||||
-- echo ### create connection without default database
|
||||
-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
|
||||
connect (conn2,localhost,root,,*NO-ONE*);
|
||||
-- connection conn2
|
||||
-- echo ### assertion: works without stating the default database
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
|
||||
|
||||
# We cannot disconnect right away because when inserting
|
||||
# concurrently in a MyISAM table, the server is sending an OK
|
||||
# to the client before updating the table state (where the
|
||||
# number of records is kept). See: BUG#37521 and BUG#29334.
|
||||
# So we need to wait, otherwise we would be having sporadic
|
||||
# failures as reported here: BUG#50451.
|
||||
|
||||
# 12 = 3 rows per each LOAD DATA executed x 4
|
||||
-- let $count= 12
|
||||
-- let $table= $db1.t1
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
-- echo ### disconnect and switch back to master connection
|
||||
-- disconnect conn2
|
||||
-- connection master
|
||||
|
||||
-- sync_slave_with_master
|
||||
-- eval use $db1
|
||||
|
||||
let $diff_tables= master:$db1.t1, slave:$db1.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
-- connection master
|
||||
|
||||
-- eval DROP DATABASE $db1
|
||||
-- eval DROP DATABASE $db2
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
# BUG#49479: LOAD DATA INFILE is binlogged without escaping field names
|
||||
-- source include/rpl_reset.inc
|
||||
-- connection master
|
||||
use test;
|
||||
CREATE TABLE t1 (`key` TEXT, `text` TEXT);
|
||||
|
||||
LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ',';
|
||||
SELECT * FROM t1;
|
||||
|
||||
-- sync_slave_with_master
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
36
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_loadfile.test
Normal file
36
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_loadfile.test
Normal file
@@ -0,0 +1,36 @@
|
||||
# Begin clean up test section
|
||||
--disable_warnings
|
||||
connection master;
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
|
||||
# Section 1 test
|
||||
|
||||
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
|
||||
INSERT INTO test.t1 VALUES(1,'test');
|
||||
UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
|
||||
delimiter |;
|
||||
create procedure test.p1()
|
||||
begin
|
||||
INSERT INTO test.t1 VALUES(2,'test');
|
||||
UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
CALL test.p1();
|
||||
SELECT * FROM test.t1 ORDER BY blob_column;
|
||||
save_master_pos;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
# Need to allow some time when NDB engine is used for
|
||||
# the injector thread to have time to populate binlog
|
||||
let $wait_condition= SELECT INSTR(blob_column,'aberration') > 0 FROM test.t1 WHERE a = 2;
|
||||
--source include/wait_condition.inc
|
||||
SELECT * FROM test.t1 ORDER BY blob_column;
|
||||
|
||||
# Cleanup
|
||||
connection master;
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP TABLE test.t1;
|
||||
sync_slave_with_master;
|
||||
140
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_log.test
Normal file
140
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_log.test
Normal file
@@ -0,0 +1,140 @@
|
||||
# Requires statement logging
|
||||
|
||||
# Clean up old slave's binlogs.
|
||||
# The slave is started with --log-slave-updates
|
||||
# and this test does SHOW BINLOG EVENTS on the slave's
|
||||
# binlog. But previous tests can influence the current test's
|
||||
# binlog (e.g. a temporary table in the previous test has not
|
||||
# been explicitly deleted, and at the beginning of the current
|
||||
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
|
||||
# We wait for the slave to have written all he wants to the binlog
|
||||
# (otherwise RESET MASTER may come too early).
|
||||
sync_slave_with_master;
|
||||
source include/stop_slave.inc;
|
||||
reset master;
|
||||
reset slave;
|
||||
source include/start_slave.inc;
|
||||
|
||||
let $VERSION=`select version()`;
|
||||
|
||||
connection master;
|
||||
eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
let $LOAD_FILE= ../../std_data/words.dat;
|
||||
if (!`SELECT length(load_file('$LOAD_FILE'))`){
|
||||
let $LOAD_FILE= ../$LOAD_FILE;
|
||||
}
|
||||
eval create table t1 (word char(20) not null)ENGINE=$engine_type;
|
||||
--replace_result $LOAD_FILE LOAD_FILE
|
||||
eval load data infile '$LOAD_FILE' into table t1 ignore 1 lines;
|
||||
select count(*) from t1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
let $binlog_limit= 1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
let $binlog_limit= 2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
let $binlog_limit= 2,1;
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_limit=;
|
||||
flush logs;
|
||||
|
||||
# We need an extra update before doing save_master_pos.
|
||||
# Otherwise, an unlikely scenario may occur:
|
||||
# * When the master's binlog_dump thread reads the end of master-bin.001,
|
||||
# it send the rotate event which is at this end, plus a fake rotate event
|
||||
# because it's starting to read a new binlog.
|
||||
# save_master_pos will record the position of the first of the two rotate
|
||||
# (because the fake one is not in the master's binlog anyway).
|
||||
# * Later the slave waits for the position of the first rotate event,
|
||||
# and it may quickly stop (in 'slave stop') without having received the fake
|
||||
# one.
|
||||
# So, depending on a few milliseconds, we end up with 2 rotate events in the
|
||||
# relay log or one, which influences the output of SHOW SLAVE STATUS, making
|
||||
# it not predictable and causing random test failures.
|
||||
# To make it predictable, we do a useless update now, but which has the
|
||||
# interest of making the slave catch both rotate events.
|
||||
|
||||
eval create table t3 (a int)ENGINE=$engine_type;
|
||||
|
||||
# Sync slave and force it to start on another binary log
|
||||
|
||||
#show rows of t1 on master
|
||||
connection master;
|
||||
select * from t1 order by 1 asc;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
#check t1 on slave to ensure whether it's identical with on master
|
||||
select * from t1 order by 1 asc;
|
||||
flush logs;
|
||||
source include/stop_slave.inc;
|
||||
source include/start_slave.inc;
|
||||
connection master;
|
||||
|
||||
# Create some entries for second log
|
||||
|
||||
eval create table t2 (n int)ENGINE=$engine_type;
|
||||
insert into t2 values (1);
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--replace_column 2 #
|
||||
show binary logs;
|
||||
sync_slave_with_master;
|
||||
--replace_column 2 #
|
||||
show binary logs;
|
||||
|
||||
let $binlog_file=;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_file=;
|
||||
|
||||
source include/check_slave_is_running.inc;
|
||||
|
||||
# Need to recode the following
|
||||
|
||||
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
|
||||
|
||||
--error 1220
|
||||
show binlog events in 'slave-bin.000005' from 4;
|
||||
|
||||
connection master;
|
||||
|
||||
# The table drops caused Cluster Replication wrapper to fail as event ID would never be the same.# Moving drops here.
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
||||
#
|
||||
# Bug #6880: LAST_INSERT_ID() within a statement
|
||||
#
|
||||
|
||||
# Reset binlog so that show binlog events will not show the tests
|
||||
# above.
|
||||
source include/rpl_reset.inc;
|
||||
connection master;
|
||||
|
||||
create table t1(a int auto_increment primary key, b int);
|
||||
insert into t1 values (NULL, 1);
|
||||
set insert_id=5;
|
||||
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
|
||||
source include/show_binlog_events.inc;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
sync_slave_with_master;
|
||||
@@ -0,0 +1,117 @@
|
||||
# Test of options max_binlog_size and max_relay_log_size and
|
||||
# how they act (if max_relay_log_size == 0, use max_binlog_size
|
||||
# for relay logs too).
|
||||
# Test of manual relay log rotation with FLUSH LOGS.
|
||||
|
||||
# Requires statement logging
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection slave;
|
||||
stop slave;
|
||||
connection master;
|
||||
|
||||
--echo #
|
||||
--echo # Generate a big enough master's binlog to cause relay log rotations
|
||||
--echo #
|
||||
|
||||
create table t1 (a int);
|
||||
let $1=800;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
# eval means expand $ expressions
|
||||
eval insert into t1 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
reset slave;
|
||||
|
||||
--echo #
|
||||
--echo # Test 1
|
||||
--echo #
|
||||
|
||||
set @my_max_binlog_size= @@global.max_binlog_size;
|
||||
set global max_binlog_size=8192;
|
||||
set global max_relay_log_size=8192-1; # mapped to 4096
|
||||
select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
--echo #
|
||||
--echo # Test 2
|
||||
--echo #
|
||||
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=(5*4096);
|
||||
query_vertical select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
--echo #
|
||||
--echo # Test 3: max_relay_log_size = 0
|
||||
--echo #
|
||||
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=0;
|
||||
query_vertical select @@global.max_relay_log_size;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
--echo #
|
||||
--echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
|
||||
--echo #
|
||||
|
||||
stop slave;
|
||||
reset slave;
|
||||
# test of relay log rotation when the slave is stopped
|
||||
# (to make sure it does not crash).
|
||||
flush logs;
|
||||
|
||||
--echo #
|
||||
--echo # Test 5
|
||||
--echo #
|
||||
|
||||
reset slave;
|
||||
start slave;
|
||||
sync_with_master;
|
||||
# test of relay log rotation when the slave is started
|
||||
flush logs;
|
||||
# We have now easy way to be sure that the SQL thread has now deleted the
|
||||
# log we just closed. But a trick to achieve this is do an update on the master.
|
||||
connection master;
|
||||
create table t1 (a int);
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
--echo #
|
||||
--echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
|
||||
--echo #
|
||||
|
||||
flush logs;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
connection master;
|
||||
# test that the absence of relay logs does not make a master crash
|
||||
flush logs;
|
||||
source include/show_master_status.inc;
|
||||
|
||||
# Restore max_binlog_size
|
||||
connection slave;
|
||||
set global max_binlog_size= @my_max_binlog_size;
|
||||
|
||||
--echo #
|
||||
--echo # End of 4.1 tests
|
||||
--echo #
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,554 @@
|
||||
################################################################################
|
||||
# This is an auxiliary file used by rpl_mixing_engines.test, and that it
|
||||
# executes SQL statements according to a format string, as specified in
|
||||
# rpl_mixing_engines.test. In addition, it accepts the special format
|
||||
# strings 'configure' and 'clean', used before and after everything else.
|
||||
################################################################################
|
||||
|
||||
if (`SELECT HEX(@commands) = HEX('configure')`)
|
||||
{
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval SET SQL_LOG_BIN=1;
|
||||
|
||||
connection slave;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
|
||||
eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
|
||||
SET SQL_LOG_BIN=1;
|
||||
|
||||
connection master;
|
||||
|
||||
INSERT INTO nt_1(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO nt_2(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO nt_3(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO nt_4(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO nt_5(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO nt_6(trans_id, stmt_id) VALUES(1,1);
|
||||
|
||||
INSERT INTO tt_1(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO tt_2(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO tt_3(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO tt_4(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO tt_5(trans_id, stmt_id) VALUES(1,1);
|
||||
INSERT INTO tt_6(trans_id, stmt_id) VALUES(1,1);
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
CREATE PROCEDURE pc_i_tt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
|
||||
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
|
||||
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE pc_i_nt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
|
||||
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
|
||||
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
|
||||
END|
|
||||
|
||||
CREATE FUNCTION fc_i_tt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
|
||||
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
|
||||
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
|
||||
RETURN "fc_i_tt_5_suc";
|
||||
END|
|
||||
|
||||
CREATE FUNCTION fc_i_nt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
|
||||
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
|
||||
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
|
||||
RETURN "fc_i_nt_5_suc";
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= NEW.trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
|
||||
INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
|
||||
INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_nt_4_to_tt_4 AFTER INSERT ON nt_4 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM tt_4 WHERE trans_id= NEW.trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
|
||||
INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
|
||||
INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_tt_5_to_tt_6 AFTER INSERT ON tt_5 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM tt_6 WHERE trans_id= NEW.trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id, 1), 1) INTO in_stmt_id;
|
||||
INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
|
||||
INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_nt_5_to_nt_6 AFTER INSERT ON nt_5 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE in_stmt_id INTEGER;
|
||||
SELECT max(stmt_id) INTO in_stmt_id FROM nt_6 WHERE trans_id= NEW.trans_id;
|
||||
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
|
||||
INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
|
||||
INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
|
||||
END|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
|
||||
let $trans_id= 7;
|
||||
let $tb_id= 1;
|
||||
let $stmt_id= 1;
|
||||
let $commands= '';
|
||||
|
||||
SET @commands= '';
|
||||
}
|
||||
|
||||
if (`SELECT HEX(@commands) = HEX('clean')`)
|
||||
{
|
||||
connection master;
|
||||
|
||||
DROP TABLE tt_1;
|
||||
DROP TABLE tt_2;
|
||||
DROP TABLE tt_3;
|
||||
DROP TABLE tt_4;
|
||||
DROP TABLE tt_5;
|
||||
DROP TABLE tt_6;
|
||||
|
||||
DROP TABLE nt_1;
|
||||
DROP TABLE nt_2;
|
||||
DROP TABLE nt_3;
|
||||
DROP TABLE nt_4;
|
||||
DROP TABLE nt_5;
|
||||
DROP TABLE nt_6;
|
||||
|
||||
DROP PROCEDURE pc_i_tt_5_suc;
|
||||
DROP PROCEDURE pc_i_nt_5_suc;
|
||||
DROP FUNCTION fc_i_tt_5_suc;
|
||||
DROP FUNCTION fc_i_nt_5_suc;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
SET @commands= '';
|
||||
}
|
||||
|
||||
while (`SELECT HEX(@commands) != HEX('')`)
|
||||
{
|
||||
--disable_query_log
|
||||
SET @command= SUBSTRING_INDEX(@commands, ' ', 1);
|
||||
let $command= `SELECT @command`;
|
||||
--eval SET @check_commands= '$commands'
|
||||
if (`SELECT HEX(@check_commands) = HEX('''')`)
|
||||
{
|
||||
let $commands= `SELECT @commands`;
|
||||
}
|
||||
--echo -b-b-b-b-b-b-b-b-b-b-b- >> $command << -b-b-b-b-b-b-b-b-b-b-b-
|
||||
let $pos_command= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--enable_query_log
|
||||
if (`SELECT HEX(@command) = HEX('B')`)
|
||||
{
|
||||
eval BEGIN;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('T')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('T-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('T-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval SELECT fc_i_tt_5_suc ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('T-proc')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval CALL pc_i_tt_5_suc ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('eT')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('Te')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('Te-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from tt_5`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('Te-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO tt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('N')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('N-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('N-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval SELECT fc_i_nt_5_suc ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('N-proc')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval CALL pc_i_nt_5_suc ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('eN')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('Ne')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('Ne-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from nt_5`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('Ne-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO nt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('tN')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1;
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('tNe')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM tt_1;
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('nT')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1;
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('nTe')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM nt_1;
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('NT')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval UPDATE nt_3, tt_3 SET nt_3.info= "new text $trans_id --> $stmt_id", tt_3.info= "new text $trans_id --> $stmt_id" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('NT-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('NT-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_tt_5_suc($trans_id, $stmt_id));
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('NeT-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from nt_4`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from nt_4 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('NeT-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from nt_5`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('TN')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval UPDATE tt_4, nt_4 SET tt_4.info= "new text $trans_id --> $stmt_id", nt_4.info= "new text $trans_id --> $stmt_id" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('TN-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('TN-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_nt_5_suc($trans_id, $stmt_id));
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('TeN-trig')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from tt_3`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from tt_3 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('TeN-func')`)
|
||||
{
|
||||
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
|
||||
let $old_trans_id= `SELECT max(trans_id) from tt_5`;
|
||||
let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
|
||||
inc $stmt_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CS-T->T')`)
|
||||
{
|
||||
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CS-N->N')`)
|
||||
{
|
||||
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CS-T->N')`)
|
||||
{
|
||||
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CS-N->T')`)
|
||||
{
|
||||
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CSe-T->T')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CSe-N->N')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CSe-T->N')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CSe-N->T')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('CT')`)
|
||||
{
|
||||
--eval CREATE TEMPORARY TABLE tt_xx_$tb_id (a int) engine=$engine_type;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('IS-T<-N')`)
|
||||
{
|
||||
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('ISe-T<-N')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('IS-N<-T')`)
|
||||
{
|
||||
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('ISe-N<-T')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('IS-T<-T')`)
|
||||
{
|
||||
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('ISe-T<-T')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('IS-N<-N')`)
|
||||
{
|
||||
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('ISe-N<-N')`)
|
||||
{
|
||||
--error ER_DUP_ENTRY, ER_DUP_KEY
|
||||
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM nt_1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('trunc-CS-T')`)
|
||||
{
|
||||
eval TRUNCATE TABLE tt_xx_$tb_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('trunc-CS-N')`)
|
||||
{
|
||||
eval TRUNCATE TABLE nt_xx_$tb_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('trunc-CT')`)
|
||||
{
|
||||
eval TRUNCATE TABLE tt_xx_$tb_id;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('drop-CS')`)
|
||||
{
|
||||
--disable_warnings
|
||||
eval DROP TABLE IF EXISTS tt_xx_$tb_id, nt_xx_$tb_id;
|
||||
inc $tb_id;
|
||||
--enable_warnings
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('drop-CT')`)
|
||||
{
|
||||
--disable_warnings
|
||||
eval DROP TEMPORARY TABLE IF EXISTS tt_xx_$tb_id;
|
||||
inc $tb_id;
|
||||
--enable_warnings
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('C')`)
|
||||
{
|
||||
--error 0, ER_GET_ERRMSG
|
||||
eval COMMIT;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('R')`)
|
||||
{
|
||||
--error 0, ER_GET_ERRMSG
|
||||
eval ROLLBACK;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('S1')`)
|
||||
{
|
||||
eval SAVEPOINT s1;
|
||||
}
|
||||
if (`SELECT HEX(@command) = HEX('R1')`)
|
||||
{
|
||||
eval ROLLBACK TO s1;
|
||||
}
|
||||
--disable_query_log
|
||||
SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
|
||||
inc $stmt_id;
|
||||
|
||||
let $binlog_start= $pos_command;
|
||||
--source include/show_binlog_events.inc
|
||||
--echo -e-e-e-e-e-e-e-e-e-e-e- >> $command << -e-e-e-e-e-e-e-e-e-e-e-
|
||||
if (`SELECT HEX(@commands) = HEX('')`)
|
||||
{
|
||||
let $binlog_start= $pos_trans_command;
|
||||
--echo -b-b-b-b-b-b-b-b-b-b-b- >> $commands << -b-b-b-b-b-b-b-b-b-b-b-
|
||||
--source include/show_binlog_events.inc
|
||||
--echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e-
|
||||
--echo
|
||||
let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
let $stmt_id= 1;
|
||||
inc $trans_id;
|
||||
let $commands= '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,710 @@
|
||||
###################################################################################
|
||||
# This test checks if transactions that mixes transactional and non-transactional
|
||||
# tables are correctly handled in statement mode. In an nutshell, we have what
|
||||
# follows:
|
||||
#
|
||||
# 1) "B T T C" generates in binlog the "B T T C" entries.
|
||||
#
|
||||
# 2) "B T T R" generates in binlog an "empty" entry.
|
||||
#
|
||||
# 3) "B T N C" generates in binlog the "B T N C" entries.
|
||||
#
|
||||
# 4) "B T N R" generates in binlog the "B T N R" entries.
|
||||
#
|
||||
# 5) "T" generates in binlog the "B T C" entry.
|
||||
#
|
||||
# 6) "N" generates in binlog the "N" entry.
|
||||
#
|
||||
# 7) "M" generates in binglog the "B M C" entries.
|
||||
#
|
||||
# 8) "B N N T C" generates in binglog the "N N B T C" entries.
|
||||
#
|
||||
# 9) "B N N T R" generates in binlog the "N N B T R" entries.
|
||||
#
|
||||
# 10) "B N N C" generates in binglog the "N N" entries.
|
||||
#
|
||||
# 11) "B N N R" generates in binlog the "N N" entries.
|
||||
#
|
||||
# 12) "B M T C" generates in the binlog the "B M T C" entries.
|
||||
#
|
||||
# 13) "B M T R" generates in the binlog the "B M T R" entries.
|
||||
###################################################################################
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CONFIGURATION
|
||||
--echo ###################################################################################
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
SET SQL_LOG_BIN=1;
|
||||
|
||||
connection slave;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
|
||||
CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
|
||||
SET SQL_LOG_BIN=1;
|
||||
|
||||
connection master;
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
CREATE FUNCTION f1 () RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
RETURN "Testing...";
|
||||
END|
|
||||
|
||||
CREATE FUNCTION f2 () RETURNS VARCHAR(64)
|
||||
BEGIN
|
||||
RETURN f1();
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE pc_i_tt_3 (IN x INT, IN y VARCHAR(64))
|
||||
BEGIN
|
||||
INSERT INTO tt_3 VALUES (y,x,x);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_tt_3_to_nt_3 BEFORE INSERT ON tt_3 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO nt_3 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
|
||||
CREATE TRIGGER tr_i_nt_4_to_tt_4 BEFORE INSERT ON nt_4 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO tt_4 VALUES (NEW.a, NEW.b, NEW.c);
|
||||
END|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
|
||||
--echo ###################################################################################
|
||||
connection master;
|
||||
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #1) "B T T C" generates in binlog the "B T T C" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4");
|
||||
INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #1.e) "B T T C" with error in T generates in binlog the "B T T C" entries.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -2", -2, "new text -2");
|
||||
INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3");
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_2 VALUES ("new text -4", -4, "new text -4"), ("new text -5", -5, "new text -5");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #2) "B T T R" generates in binlog an "empty" entry.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 5", 5, "new text 5");
|
||||
INSERT INTO tt_2 VALUES ("new text 5", 5, "new text 5");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #2.e) "B T T R" with error in T generates in binlog an "empty" entry.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -6", -6, "new text -6"), ("new text -7", -7, "new text -7");
|
||||
INSERT INTO tt_2 VALUES ("new text -8", -8, "new text -8");
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_2 VALUES ("new text -10", -10, "new text -10");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_2 VALUES ("new text -9", -9, "new text -9"), ("new text -10", -10, "new text -10");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #3) "B T N C" generates in binlog the "B T N C" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6");
|
||||
INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #3.e) "B T N C" with error in either T or N generates in binlog the "B T N C" entries.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -11", -11, "new text -11"), ("new text -12", -12, "new text -12");
|
||||
INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13");
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14");
|
||||
INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #4) "B T N R" generates in binlog the "B T N R" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7");
|
||||
INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #4.e) "B T N R" with error in either T or N generates in binlog the "B T N R" entries.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17");
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -16", -16, "new text -16"), ("new text -17", -17, "new text -17");
|
||||
INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18");
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19");
|
||||
INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #5) "T" generates in binlog the "B T C" entry.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #5.e) "T" with error in T generates in binlog an "empty" entry.
|
||||
--echo #
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -22", -22, "new text -22");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_1 VALUES ("new text -23", -23, "new text -23"), ("new text -1", -1, "new text -1");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #6) "N" generates in binlog the "N" entry.
|
||||
--echo #
|
||||
INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #6.e) "N" with error in N generates in binlog an empty entry if the error
|
||||
--echo # happens in the first tuple. Otherwise, generates the "N" entry and
|
||||
--echo # the error is appended.
|
||||
--echo #
|
||||
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1");
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #7) "M" generates in binglog the "B M C" entries.
|
||||
--echo #
|
||||
|
||||
DELETE FROM nt_1;
|
||||
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
|
||||
DELETE FROM tt_1;
|
||||
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
|
||||
INSERT INTO tt_3 VALUES ("new text 000", 000, '');
|
||||
|
||||
INSERT INTO tt_3 VALUES("new text 100", 100, f1());
|
||||
|
||||
INSERT INTO nt_4 VALUES("new text 100", 100, f1());
|
||||
|
||||
INSERT INTO tt_3 VALUES("new text 200", 200, f2());
|
||||
|
||||
INSERT INTO nt_4 VALUES ("new text 300", 300, '');
|
||||
|
||||
INSERT INTO nt_4 VALUES ("new text 400", 400, f1());
|
||||
|
||||
INSERT INTO nt_4 VALUES ("new text 500", 500, f2());
|
||||
|
||||
CALL pc_i_tt_3(600, "Testing...");
|
||||
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #7.e) "M" with error in M generates in binglog the "B M R" entries.
|
||||
--echo #
|
||||
|
||||
INSERT INTO nt_3 VALUES ("new text -26", -26, '');
|
||||
SELECT * FROM tt_3;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
|
||||
SELECT * FROM tt_3;
|
||||
|
||||
INSERT INTO tt_4 VALUES ("new text -26", -26, '');
|
||||
SELECT * FROM nt_4;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
|
||||
SELECT * FROM nt_4;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #8) "B N N T C" generates in binglog the "N N B T C" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10");
|
||||
INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10");
|
||||
INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo #
|
||||
--echo #8.e) "B N N T R" See 6.e and 9.e.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #9) "B N N T R" generates in binlog the "N N B T R" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11");
|
||||
INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11");
|
||||
INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #9.e) "B N N T R" with error in N generates in binlog the "N N B T R" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25");
|
||||
INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25");
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25");
|
||||
INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #10) "B N N C" generates in binglog the "N N" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12");
|
||||
INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12");
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo #
|
||||
--echo #10.e) "B N N C" See 6.e and 9.e.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #11) "B N N R" generates in binlog the "N N" entries.
|
||||
--echo #
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13");
|
||||
INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13");
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo #
|
||||
--echo #11.e) "B N N R" See 6.e and 9.e.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #12) "B M T C" generates in the binlog the "B M T C" entries.
|
||||
--echo #
|
||||
DELETE FROM nt_1;
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14");
|
||||
COMMIT;
|
||||
|
||||
DELETE FROM tt_1;
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15");
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES ("new text 700", 700, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 800", 800, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES("new text 900", 900, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 1000", 1000, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES(1100, 1100, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 1200", 1200, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES ("new text 1300", 1300, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 1400", 1400, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 1500", 1500, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 1600", 1600, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 1700", 1700, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 1800", 1800, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
CALL pc_i_tt_3(1900, "Testing...");
|
||||
INSERT INTO tt_1 VALUES ("new text 2000", 2000, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2100", 2100, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2200", 2200, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2300", 2300, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 2400", 2400, '');
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #12.e) "B M T C" with error in M generates in the binlog the "B M T C" entries.
|
||||
--echo #
|
||||
|
||||
--echo # There is a bug in the slave that needs to be fixed before enabling
|
||||
--echo # this part of the test. A bug report will be filed referencing this
|
||||
--echo # test case.
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_3 VALUES ("new text -28", -28, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -27", -27, '');
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_4 VALUES ("new text -28", -28, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -28", -28, '');
|
||||
COMMIT;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #13) "B M T R" generates in the binlog the "B M T R" entries
|
||||
--echo #
|
||||
|
||||
DELETE FROM nt_1;
|
||||
BEGIN;
|
||||
INSERT INTO nt_1 SELECT * FROM tt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17");
|
||||
ROLLBACK;
|
||||
|
||||
DELETE FROM tt_1;
|
||||
BEGIN;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
INSERT INTO tt_2 VALUES ("new text 18", 18, "new text 18");
|
||||
ROLLBACK;
|
||||
INSERT INTO tt_1 SELECT * FROM nt_1;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES ("new text 2500", 2500, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 2600", 2600, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES("new text 2700", 2700, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 2800", 2800, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_3 VALUES(2900, 2900, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 3000", 3000, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES ("new text 3100", 3100, '');
|
||||
INSERT INTO tt_1 VALUES ("new text 3200", 3200, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 3300", 3300, f1());
|
||||
INSERT INTO tt_1 VALUES ("new text 3400", 3400, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_4 VALUES("new text 3500", 3500, f2());
|
||||
INSERT INTO tt_1 VALUES ("new text 3600", 3600, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
CALL pc_i_tt_3(3700, "Testing...");
|
||||
INSERT INTO tt_1 VALUES ("new text 3700", 3700, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 3800", 3800, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 3900", 3900, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 4000", 4000, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
|
||||
INSERT INTO tt_1 VALUES ("new text 4100", 4100, '');
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
--echo
|
||||
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--echo #
|
||||
--echo #13.e) "B M T R" with error in M generates in the binlog the "B M T R" entries.
|
||||
--echo #
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO nt_3 VALUES ("new text -30", -30, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -30", -30, '');
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tt_4 VALUES ("new text -30", -30, '');
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
|
||||
INSERT INTO tt_1 VALUES ("new text -31", -31, '');
|
||||
ROLLBACK;
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
|
||||
--diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CLEAN
|
||||
--echo ###################################################################################
|
||||
|
||||
connection master;
|
||||
DROP TABLE tt_1;
|
||||
DROP TABLE tt_2;
|
||||
DROP TABLE tt_3;
|
||||
DROP TABLE tt_4;
|
||||
DROP TABLE nt_1;
|
||||
DROP TABLE nt_2;
|
||||
DROP TABLE nt_3;
|
||||
DROP TABLE nt_4;
|
||||
DROP PROCEDURE pc_i_tt_3;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
|
||||
sync_slave_with_master;
|
||||
@@ -0,0 +1,26 @@
|
||||
# Test for BUG#8436: verify that a multi-query (i.e. one query
|
||||
# containing several queries (assuming client has
|
||||
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
|
||||
# one binlog event containing all queries)
|
||||
|
||||
|
||||
# PS doesn't support multi-statements
|
||||
--disable_ps_protocol
|
||||
-- source include/master-slave.inc
|
||||
create database mysqltest;
|
||||
|
||||
delimiter /;
|
||||
create table mysqltest.t1 ( n int);
|
||||
insert into mysqltest.t1 values(1)/
|
||||
insert into mysqltest.t1 values(2);
|
||||
insert into mysqltest.t1 values(3);
|
||||
insert into mysqltest.t1 values(4);
|
||||
insert into mysqltest.t1 values(5)/
|
||||
delimiter ;/
|
||||
sync_slave_with_master;
|
||||
select * from mysqltest.t1;
|
||||
connection master;
|
||||
source include/show_binlog_events.inc;
|
||||
drop database mysqltest;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,29 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,60 @@
|
||||
# Let's verify that multi-update is not always skipped by slave if
|
||||
# some replicate-* rules exist.
|
||||
# (BUG#7011)
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#13236 multi-update with subquery & --replicate-ignore-table
|
||||
#
|
||||
reset master;
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (0);
|
||||
UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
|
||||
select * from t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
select * from t1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,220 @@
|
||||
##############################################################################
|
||||
#
|
||||
# Let's verify that multi-update with a subselect does not cause the slave to crash
|
||||
# (BUG#10442)
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) ENGINE=$engine_type;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Test for BUG#9361:
|
||||
# Subselects should work inside multi-updates
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 1 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a1 char(30),
|
||||
a2 int,
|
||||
a3 int,
|
||||
a4 char(30),
|
||||
a5 char(30)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
b1 int,
|
||||
b2 char(30)
|
||||
);
|
||||
|
||||
# Insert one row per table
|
||||
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
|
||||
INSERT INTO t2 VALUES (1, 'baz');
|
||||
|
||||
# This should update the row in t1
|
||||
UPDATE t1 a, t2
|
||||
SET a.a1 = 'No'
|
||||
WHERE a.a2 =
|
||||
(SELECT b1
|
||||
FROM t2
|
||||
WHERE b2 = 'baz')
|
||||
AND a.a3 IS NULL
|
||||
AND a.a4 = 'foo'
|
||||
AND a.a5 = 'bar';
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Second test for BUG#9361
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 2 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
i INT,
|
||||
j INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
i INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t3 (
|
||||
j INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
|
||||
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
|
||||
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
|
||||
|
||||
UPDATE t1 AS a
|
||||
INNER JOIN t2 AS b
|
||||
ON a.i = b.i
|
||||
INNER JOIN t3 AS c
|
||||
ON a.j = c.j AND b.k = c.k
|
||||
SET a.x = b.x,
|
||||
a.y = b.y,
|
||||
a.z = (
|
||||
SELECT sum(z)
|
||||
FROM t3
|
||||
WHERE y = 34
|
||||
)
|
||||
WHERE b.x = 23;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# BUG#12618
|
||||
#
|
||||
# TEST: Replication of a statement containing a join in a multi-update.
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
idp int(11) NOT NULL default '0',
|
||||
idpro int(11) default NULL,
|
||||
price decimal(19,4) default NULL,
|
||||
PRIMARY KEY (idp)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
idpro int(11) NOT NULL default '0',
|
||||
price decimal(19,4) default NULL,
|
||||
nbprice int(11) default NULL,
|
||||
PRIMARY KEY (idpro)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1,'3.0000'),
|
||||
(2,2,'1.0000'),
|
||||
(3,1,'1.0000'),
|
||||
(4,1,'4.0000'),
|
||||
(5,3,'2.0000'),
|
||||
(6,2,'4.0000');
|
||||
|
||||
INSERT INTO t2 VALUES
|
||||
(1,'0.0000',0),
|
||||
(2,'0.0000',0),
|
||||
(3,'0.0000',0);
|
||||
|
||||
# This update sets t2 to the minimal prices for each product
|
||||
update
|
||||
t2
|
||||
join
|
||||
( select idpro, min(price) as min_price, count(*) as nbr_price
|
||||
from t1
|
||||
where idpro>0 and price>0
|
||||
group by idpro
|
||||
) as table_price
|
||||
on t2.idpro = table_price.idpro
|
||||
set t2.price = table_price.min_price,
|
||||
t2.nbprice = table_price.nbr_price;
|
||||
|
||||
select "-- MASTER AFTER JOIN --" as "";
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
select "-- SLAVE AFTER JOIN --" as "";
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,119 @@
|
||||
#######################################
|
||||
# Author: Rafal Somla #
|
||||
# Date: 2006-08-20 #
|
||||
# Purpose: Test replication of basic #
|
||||
# table operations in various setups #
|
||||
# #
|
||||
# Based on rpl_ndb_2multi_eng.test by #
|
||||
# JBM #
|
||||
#######################################
|
||||
|
||||
--echo --- Doing pre test cleanup ---
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_query_log
|
||||
|
||||
#################################################
|
||||
--echo --- Create Table Section ---
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL,
|
||||
b1 INT,
|
||||
vc VARCHAR(255),
|
||||
bc CHAR(255),
|
||||
d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0,
|
||||
total BIGINT UNSIGNED,
|
||||
y YEAR,
|
||||
t DATE,
|
||||
PRIMARY KEY(id));
|
||||
|
||||
--echo --- Show table on master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Show table on slave ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--source include/rpl_multi_engine2.inc
|
||||
|
||||
#################################################
|
||||
# Okay lets see how it holds up to table changes
|
||||
--echo --- Check that simple Alter statements are replicated correctly --
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY;
|
||||
# note: table with no PK can't contain blobs if it is to be replicated.
|
||||
ALTER TABLE t1 MODIFY vc char(32);
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--source include/rpl_multi_engine2.inc
|
||||
|
||||
#################################################
|
||||
--echo --- Check that replication works when slave has more columns than master
|
||||
connection master;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(id,total);
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ',
|
||||
'Must make it bug free for the customer',
|
||||
654321.4321,15.21,0,1965,"1905-11-14");
|
||||
INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ',
|
||||
'Must make it bug free for the customer',
|
||||
654321.4321,15.21,0,1965,"1965-11-14");
|
||||
INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ',
|
||||
'Must make it bug free for the customer',
|
||||
654321.4321,15.21,0,1965,"1985-11-14");
|
||||
|
||||
--echo --- Add columns on slave ---
|
||||
--sync_slave_with_master
|
||||
ALTER TABLE t1 ADD (u int, v char(16) default 'default');
|
||||
UPDATE t1 SET u=7 WHERE id < 50;
|
||||
UPDATE t1 SET v='explicit' WHERE id >10;
|
||||
|
||||
--echo --- Show changed table on slave ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT *
|
||||
FROM t1
|
||||
ORDER BY id;
|
||||
|
||||
--source include/rpl_multi_engine2.inc
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
#################################################
|
||||
--echo --- Check that replication works when master has more columns than slave
|
||||
connection master;
|
||||
|
||||
--echo --- Remove columns on slave ---
|
||||
--sync_slave_with_master
|
||||
ALTER TABLE t1 DROP COLUMN v;
|
||||
ALTER TABLE t1 DROP COLUMN u;
|
||||
ALTER TABLE t1 DROP COLUMN t;
|
||||
ALTER TABLE t1 DROP COLUMN y;
|
||||
|
||||
--echo --- Show changed table on slave ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--source include/rpl_multi_engine2.inc
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
#################################################
|
||||
--echo --- Do Cleanup --
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
@@ -0,0 +1,347 @@
|
||||
#######################################
|
||||
# Author: JBM #
|
||||
# Date: 2006-02-23 #
|
||||
# Purpose: See if replication between #
|
||||
# NDB -> MyISAM and InnoDB works. #
|
||||
# and if #
|
||||
# MyISAM and InnoDB -> NDB works. #
|
||||
#######################################
|
||||
# By JBM #
|
||||
# Date 2006-02-28 #
|
||||
# Change: Implemented review comments #
|
||||
#######################################
|
||||
|
||||
--echo --- Doing pre test cleanup ---
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_query_log
|
||||
|
||||
--echo --- Start test 1 Basic testing ---
|
||||
--echo --- Create Table Section ---
|
||||
|
||||
#################################################
|
||||
# Requirment: Create basic table, replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE,PRIMARY KEY(id));
|
||||
|
||||
--echo --- Show table on master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Show table on slave ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
# Okay lets see how it holds up to table changes
|
||||
--echo --- Check that simple Alter statements are replicated correctly --
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 1 Basic testing ---
|
||||
--echo --- Do Cleanup --
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
#################################################################
|
||||
|
||||
--echo --- Start test 2 partition RANGE testing --
|
||||
--echo --- Do setup --
|
||||
|
||||
|
||||
#################################################
|
||||
# Requirment: Create table that is partitioned #
|
||||
# by range on year i.e. year(t) and replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE)
|
||||
PARTITION BY RANGE (YEAR(t))
|
||||
(PARTITION p0 VALUES LESS THAN (1901),
|
||||
PARTITION p1 VALUES LESS THAN (1946),
|
||||
PARTITION p2 VALUES LESS THAN (1966),
|
||||
PARTITION p3 VALUES LESS THAN (1986),
|
||||
PARTITION p4 VALUES LESS THAN (2005),
|
||||
PARTITION p5 VALUES LESS THAN MAXVALUE);
|
||||
|
||||
--echo --- Show table on master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Show table on slave --
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(t,id);
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
--enable_query_log
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 2 partition RANGE testing ---
|
||||
--echo --- Do Cleanup ---
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
########################################################
|
||||
|
||||
--echo --- Start test 3 partition LIST testing ---
|
||||
--echo --- Do setup ---
|
||||
#################################################
|
||||
# Requirment: Create table that is partitioned #
|
||||
# by list on id i.e. (2,4). Pretend that we #
|
||||
# missed one and alter to add. Then replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE)
|
||||
PARTITION BY LIST(id)
|
||||
(PARTITION p0 VALUES IN (2, 4),
|
||||
PARTITION p1 VALUES IN (42, 142));
|
||||
|
||||
--echo --- Test 3 Alter to add partition ---
|
||||
|
||||
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
|
||||
|
||||
--echo --- Show table on master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Show table on slave ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(id);
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 3 partition LIST testing ---
|
||||
--echo --- Do Cleanup --
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
########################################################
|
||||
|
||||
--echo --- Start test 4 partition HASH testing ---
|
||||
--echo --- Do setup ---
|
||||
#################################################
|
||||
# Requirment: Create table that is partitioned #
|
||||
# by hash on year i.e. YEAR(t). Then replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE)
|
||||
PARTITION BY HASH( YEAR(t) )
|
||||
PARTITIONS 4;
|
||||
|
||||
--echo --- show that tables have been created correctly ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(t,id);
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 4 partition HASH testing ---
|
||||
--echo --- Do Cleanup --
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
########################################################
|
||||
|
||||
--echo --- Start test 5 partition by key testing ---
|
||||
--echo --- Create Table Section ---
|
||||
|
||||
#################################################
|
||||
# Requirment: Create table that is partitioned #
|
||||
# by key on id with 4 parts. Then replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE,PRIMARY KEY(id))
|
||||
PARTITION BY KEY()
|
||||
PARTITIONS 4;
|
||||
|
||||
--echo --- Show that tables on master are ndbcluster tables ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Show that tables on slave ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
# Okay lets see how it holds up to table changes
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still right type ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 5 key partition testing ---
|
||||
--echo --- Do Cleanup ---
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.1 test case
|
||||
@@ -0,0 +1,301 @@
|
||||
#############################################
|
||||
#Authors: TU and Jeb
|
||||
#Date: 2007/04
|
||||
#Purpose: Generic replication to cluster
|
||||
# and ensuring that the ndb_apply_status
|
||||
# table is updated.
|
||||
#############################################
|
||||
# Notes:
|
||||
# include/select_ndb_apply_status.inc
|
||||
# Selects out the log name, start & end pos
|
||||
# from the ndb_apply_status table
|
||||
#
|
||||
# include/show_binlog_using_logname.inc
|
||||
# To select out 1 row from offset 1
|
||||
# from the start position in the binlog whose
|
||||
# name is = log_name
|
||||
#
|
||||
# include/tpcb.inc
|
||||
# Creates DATABASE tpcb, the tables and
|
||||
# stored procedures for loading the DB
|
||||
# and for running transactions against DB.
|
||||
##############################################
|
||||
|
||||
|
||||
--echo
|
||||
--echo *** Test 1 ***
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
create table t1 (a int key, b int) engine innodb;
|
||||
create table t2 (a int key, b int) engine innodb;
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
alter table t1 engine ndb;
|
||||
alter table t2 engine ndb;
|
||||
|
||||
--echo
|
||||
|
||||
# check binlog position without begin
|
||||
connection master;
|
||||
insert into t1 values (1,2);
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
--echo # Now check that that is in the apply_status table is consistant
|
||||
--echo # with what is in the binlog
|
||||
--echo
|
||||
--echo # since insert is done with transactional engine, expect a BEGIN
|
||||
--echo # at <start_pos>
|
||||
--echo
|
||||
--let $binlog_start= $start_pos
|
||||
--let $binlog_limit= 1
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo # Now the insert, one step after
|
||||
--echo
|
||||
--let $binlog_start= $start_pos
|
||||
--let $binlog_limit= 1,1
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
--echo # and the COMMIT should be at <end_pos>
|
||||
--echo
|
||||
--let $binlog_start= $start_pos
|
||||
--let $binlog_limit= 2,1
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
|
||||
# check binlog position with begin
|
||||
begin;
|
||||
insert into t1 values (2,3);
|
||||
insert into t2 values (3,4);
|
||||
commit;
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
connection master;
|
||||
--let $binlog_start= $start_pos
|
||||
--let $binlog_limit= 1
|
||||
--source include/show_binlog_events.inc
|
||||
--echo
|
||||
--let $binlog_start= $start_pos
|
||||
--let $binlog_limit= 1,2
|
||||
--source include/show_binlog_events.inc
|
||||
--echo
|
||||
--let $binlog_start= $start_pos
|
||||
--let $binlog_limit= 3,1
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
DROP TABLE test.t1, test.t2;
|
||||
--sync_slave_with_master
|
||||
SHOW TABLES;
|
||||
|
||||
# Run in some transactions using stored procedures
|
||||
# and ensure that the ndb_apply_status table is
|
||||
# updated to show the transactions
|
||||
|
||||
|
||||
--echo
|
||||
--echo *** Test 2 ***
|
||||
--echo
|
||||
|
||||
# Create database/tables and stored procdures
|
||||
connection master;
|
||||
--source include/tpcb.inc
|
||||
|
||||
# Switch tables on slave to use NDB
|
||||
--sync_slave_with_master
|
||||
USE tpcb;
|
||||
ALTER TABLE account ENGINE NDB;
|
||||
ALTER TABLE branch ENGINE NDB;
|
||||
ALTER TABLE teller ENGINE NDB;
|
||||
ALTER TABLE history ENGINE NDB;
|
||||
|
||||
--echo
|
||||
|
||||
# Load DB tpcb and run some transactions
|
||||
connection master;
|
||||
--disable_query_log
|
||||
CALL tpcb.load();
|
||||
SET AUTOCOMMIT=0;
|
||||
let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
if ($run_good)
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
if ($run_bad)
|
||||
{
|
||||
ROLLBACK;
|
||||
}
|
||||
dec $run;
|
||||
}
|
||||
|
||||
SET AUTOCOMMIT=1;
|
||||
--enable_query_log
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
--source include/show_binlog_using_logname.inc
|
||||
|
||||
# Flush the logs on the master moving all
|
||||
# Transaction to a new binlog and ensure
|
||||
# that the ndb_apply_status table is updated
|
||||
# to show the use of the new binlog.
|
||||
|
||||
--echo
|
||||
--echo ** Test 3 **
|
||||
--echo
|
||||
|
||||
# Flush logs on master which should force it
|
||||
# to switch to binlog #2
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
# Run in some transaction to increase end pos in
|
||||
# binlog
|
||||
|
||||
--disable_query_log
|
||||
SET AUTOCOMMIT=0;
|
||||
let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
if ($run_good)
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
if ($run_bad)
|
||||
{
|
||||
ROLLBACK;
|
||||
}
|
||||
dec $run;
|
||||
}
|
||||
SET AUTOCOMMIT=1;
|
||||
--enable_query_log
|
||||
|
||||
--echo
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
--source include/show_binlog_using_logname.inc
|
||||
|
||||
# Now we reset both the master and the slave
|
||||
# Run some more transaction and ensure
|
||||
# that the ndb_apply_status is updated
|
||||
# correctly
|
||||
|
||||
--echo
|
||||
--echo ** Test 4 **
|
||||
--echo
|
||||
|
||||
# Reset both slave and master
|
||||
# This should reset binlog to #1
|
||||
--source include/rpl_reset.inc
|
||||
|
||||
--echo
|
||||
|
||||
# Run in some transactions and check
|
||||
connection master;
|
||||
--disable_query_log
|
||||
SET AUTOCOMMIT=0;
|
||||
let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
if ($run_good)
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
if ($run_bad)
|
||||
{
|
||||
ROLLBACK;
|
||||
}
|
||||
dec $run;
|
||||
}
|
||||
SET AUTOCOMMIT=1;
|
||||
--enable_query_log
|
||||
|
||||
--sync_slave_with_master
|
||||
--source include/select_ndb_apply_status.inc
|
||||
|
||||
--echo
|
||||
|
||||
connection master;
|
||||
--source include/show_binlog_using_logname.inc
|
||||
|
||||
# Since we are doing replication, it is a good
|
||||
# idea to check to make sure all data was
|
||||
# Replicated correctly
|
||||
|
||||
--echo
|
||||
--echo *** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
|
||||
--exec $MYSQL_DUMP -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/master_apply_status.sql
|
||||
|
||||
--exec $MYSQL_DUMP_SLAVE -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql
|
||||
|
||||
connection master;
|
||||
DROP DATABASE tpcb;
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
####### Commenting out until decision on Bug#27960 ###########
|
||||
|
||||
#--source include/select_ndb_apply_status.inc
|
||||
|
||||
#connection master;
|
||||
#--eval SHOW BINLOG EVENTS in '$log_name' from $start_pos
|
||||
#--source include/show_binlog_using_logname.inc
|
||||
|
||||
--echo ****** Do dumps compare ************
|
||||
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/master_apply_status.sql $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql;
|
||||
|
||||
## Note: Ths files should only get removed, if the above diff succeeds.
|
||||
|
||||
--exec rm $MYSQLTEST_VARDIR/tmp/master_apply_status.sql
|
||||
--exec rm $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql
|
||||
|
||||
|
||||
# End of 5.1 Test
|
||||
360
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_not_null.test
Normal file
360
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_not_null.test
Normal file
@@ -0,0 +1,360 @@
|
||||
#################################################################################
|
||||
# This test checks if the replication between "null" fields to either "null"
|
||||
# fields or "not null" fields works properly. In the first case, the execution
|
||||
# should work fine. In the second case, it may fail according to the sql_mode
|
||||
# being used.
|
||||
#
|
||||
# The test is devided in three main parts:
|
||||
#
|
||||
# 1 - NULL --> NULL (no failures)
|
||||
# 2 - NULL --> NOT NULL ( sql-mode = STRICT and failures)
|
||||
# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
|
||||
#
|
||||
#################################################################################
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN= 0;
|
||||
eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
|
||||
`c` INT DEFAULT NULL,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL,
|
||||
`c` INT DEFAULT NULL,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
SET SQL_LOG_BIN= 1;
|
||||
|
||||
connection slave;
|
||||
|
||||
eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
|
||||
`c` INT DEFAULT NULL,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00',
|
||||
`c` INT DEFAULT 500,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00',
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
--echo ************* EXECUTION WITH INSERTS *************
|
||||
connection master;
|
||||
INSERT INTO t1(a,b,c) VALUES (1, null, 1);
|
||||
INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
|
||||
INSERT INTO t1(a,b) VALUES (3, null);
|
||||
INSERT INTO t1(a,c) VALUES (4, 4);
|
||||
INSERT INTO t1(a) VALUES (5);
|
||||
|
||||
INSERT INTO t2(a,b) VALUES (1, null);
|
||||
INSERT INTO t2(a,b) VALUES (2,'1111-11-11');
|
||||
INSERT INTO t2(a) VALUES (3);
|
||||
|
||||
INSERT INTO t3(a,b) VALUES (1, null);
|
||||
INSERT INTO t3(a,b) VALUES (2,'1111-11-11');
|
||||
INSERT INTO t3(a) VALUES (3);
|
||||
|
||||
INSERT INTO t4(a,b,c) VALUES (1, null, 1);
|
||||
INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2);
|
||||
INSERT INTO t4(a,b) VALUES (3, null);
|
||||
INSERT INTO t4(a,c) VALUES (4, 4);
|
||||
INSERT INTO t4(a) VALUES (5);
|
||||
|
||||
--echo ************* SHOWING THE RESULT SETS WITH INSERTS *************
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
|
||||
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 TABLES t2 and t3 must be different.
|
||||
connection master;
|
||||
SELECT * FROM t3 ORDER BY a;
|
||||
connection slave;
|
||||
SELECT * FROM t3 ORDER BY a;
|
||||
connection master;
|
||||
SELECT * FROM t4 ORDER BY a;
|
||||
connection slave;
|
||||
SELECT * FROM t4 ORDER BY a;
|
||||
|
||||
--echo ************* EXECUTION WITH UPDATES and REPLACES *************
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
|
||||
REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
|
||||
UPDATE t1 set b= NULL, c= 300 where a= 1;
|
||||
REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
|
||||
|
||||
--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo ************* CLEANING *************
|
||||
connection master;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t4;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN= 0;
|
||||
eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)) ENGINE= $engine;
|
||||
SET SQL_LOG_BIN= 1;
|
||||
|
||||
connection slave;
|
||||
|
||||
eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)) ENGINE= $engine;
|
||||
|
||||
--echo ************* EXECUTION WITH INSERTS *************
|
||||
connection master;
|
||||
INSERT INTO t1(a,b,c) VALUES (1, null, b'01');
|
||||
INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01');
|
||||
INSERT INTO t1(a,b) VALUES (3, null);
|
||||
INSERT INTO t1(a,c) VALUES (4, b'01');
|
||||
INSERT INTO t1(a) VALUES (5);
|
||||
|
||||
--echo ************* SHOWING THE RESULT SETS WITH INSERTS *************
|
||||
--echo TABLES t1 and t2 must be different.
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
|
||||
connection slave;
|
||||
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
|
||||
|
||||
--echo ************* EXECUTION WITH UPDATES and REPLACES *************
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01');
|
||||
REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01');
|
||||
UPDATE t1 set b= NULL, c= b'00' where a= 1;
|
||||
REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
|
||||
|
||||
--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
|
||||
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
|
||||
sync_slave_with_master;
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo ################################################################################
|
||||
--echo # NULL ---> NOT NULL (STRICT MODE)
|
||||
--echo # UNCOMMENT THIS AFTER FIXING BUG#43992
|
||||
--echo ################################################################################
|
||||
#connection slave;
|
||||
#SET GLOBAL sql_mode="TRADITIONAL";
|
||||
#
|
||||
#STOP SLAVE;
|
||||
#--source include/wait_for_slave_to_stop.inc
|
||||
#START SLAVE;
|
||||
#--source include/wait_for_slave_to_start.inc
|
||||
#
|
||||
#let $y=0;
|
||||
#while (`select $y < 6`)
|
||||
#{
|
||||
# connection master;
|
||||
#
|
||||
# SET SQL_LOG_BIN= 0;
|
||||
# eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
|
||||
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
# eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
|
||||
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
# eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
|
||||
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
# SET SQL_LOG_BIN= 1;
|
||||
#
|
||||
# connection slave;
|
||||
#
|
||||
# eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL,
|
||||
# `c` INT NOT NULL,
|
||||
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
# eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
|
||||
# `c` INT,
|
||||
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
# eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
|
||||
# `c` INT DEFAULT 500,
|
||||
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
#
|
||||
# if (`select $y=0`)
|
||||
# {
|
||||
# --echo ************* EXECUTION WITH INSERTS *************
|
||||
# connection master;
|
||||
# INSERT INTO t1(a) VALUES (1);
|
||||
# }
|
||||
#
|
||||
# if (`select $y=1`)
|
||||
# {
|
||||
# --echo ************* EXECUTION WITH INSERTS *************
|
||||
# connection master;
|
||||
# INSERT INTO t1(a, b) VALUES (1, NULL);
|
||||
# }
|
||||
#
|
||||
# if (`select $y=2`)
|
||||
# {
|
||||
# --echo ************* EXECUTION WITH UPDATES *************
|
||||
# connection master;
|
||||
# INSERT INTO t3(a, b) VALUES (1, 1);
|
||||
# INSERT INTO t3(a, b) VALUES (2, 1);
|
||||
# UPDATE t3 SET b = NULL where a= 1;
|
||||
# }
|
||||
#
|
||||
# if (`select $y=3`)
|
||||
# {
|
||||
# --echo ************* EXECUTION WITH INSERTS/REPLACES *************
|
||||
# connection master;
|
||||
# REPLACE INTO t3(a, b) VALUES (1, null);
|
||||
# }
|
||||
#
|
||||
# if (`select $y=4`)
|
||||
# {
|
||||
# --echo ************* EXECUTION WITH UPDATES/REPLACES *************
|
||||
# connection master;
|
||||
# INSERT INTO t3(a, b) VALUES (1, 1);
|
||||
# REPLACE INTO t3(a, b) VALUES (1, null);
|
||||
# }
|
||||
#
|
||||
# if (`select $y=5`)
|
||||
# {
|
||||
# --echo ************* EXECUTION WITH MULTI-ROW INSERTS *************
|
||||
# connection master;
|
||||
#
|
||||
# SET SQL_LOG_BIN= 0;
|
||||
# INSERT INTO t2(a, b) VALUES (1, 1);
|
||||
# INSERT INTO t2(a, b) VALUES (2, 1);
|
||||
# INSERT INTO t2(a, b) VALUES (3, null);
|
||||
# INSERT INTO t2(a, b) VALUES (4, 1);
|
||||
# INSERT INTO t2(a, b) VALUES (5, 1);
|
||||
# SET SQL_LOG_BIN= 1;
|
||||
#
|
||||
# INSERT INTO t2 SELECT a + 10, b from t2;
|
||||
# --echo The statement below is just executed to stop processing
|
||||
# INSERT INTO t1(a) VALUES (1);
|
||||
# }
|
||||
#
|
||||
# --echo ************* SHOWING THE RESULT SETS *************
|
||||
# connection slave;
|
||||
# --source include/wait_for_slave_sql_to_stop.inc
|
||||
# connection master;
|
||||
# SELECT * FROM t1 ORDER BY a;
|
||||
# connection slave;
|
||||
# SELECT * FROM t1 ORDER BY a;
|
||||
# connection master;
|
||||
# SELECT * FROM t2 ORDER BY a;
|
||||
# connection slave;
|
||||
# SELECT * FROM t2 ORDER BY a;
|
||||
# connection master;
|
||||
# SELECT * FROM t3 ORDER BY a;
|
||||
# connection slave;
|
||||
# SELECT * FROM t3 ORDER BY a;
|
||||
# --source include/rpl_reset.inc
|
||||
#
|
||||
# connection master;
|
||||
#
|
||||
# DROP TABLE t1;
|
||||
# DROP TABLE t2;
|
||||
# DROP TABLE t3;
|
||||
#
|
||||
# sync_slave_with_master;
|
||||
#
|
||||
# inc $y;
|
||||
#}
|
||||
#connection slave;
|
||||
#SET GLOBAL sql_mode="";
|
||||
#
|
||||
#STOP SLAVE;
|
||||
#source include/wait_for_slave_to_stop.inc;
|
||||
#START SLAVE;
|
||||
#--source include/wait_for_slave_to_start.inc
|
||||
|
||||
--echo ################################################################################
|
||||
--echo # NULL ---> NOT NULL (NON-STRICT MODE)
|
||||
--echo ################################################################################
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN= 0;
|
||||
eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
SET SQL_LOG_BIN= 1;
|
||||
|
||||
connection slave;
|
||||
|
||||
eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL,
|
||||
`c` INT NOT NULL,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
|
||||
`c` INT,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
|
||||
`c` INT DEFAULT 500,
|
||||
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
|
||||
|
||||
--echo ************* EXECUTION WITH INSERTS *************
|
||||
connection master;
|
||||
INSERT INTO t1(a) VALUES (1);
|
||||
INSERT INTO t1(a, b) VALUES (2, NULL);
|
||||
INSERT INTO t1(a, b) VALUES (3, 1);
|
||||
|
||||
INSERT INTO t2(a) VALUES (1);
|
||||
INSERT INTO t2(a, b) VALUES (2, NULL);
|
||||
INSERT INTO t2(a, b) VALUES (3, 1);
|
||||
|
||||
INSERT INTO t3(a) VALUES (1);
|
||||
INSERT INTO t3(a, b) VALUES (2, NULL);
|
||||
INSERT INTO t3(a, b) VALUES (3, 1);
|
||||
INSERT INTO t3(a, b) VALUES (4, 1);
|
||||
REPLACE INTO t3(a, b) VALUES (5, null);
|
||||
|
||||
REPLACE INTO t3(a, b) VALUES (3, null);
|
||||
UPDATE t3 SET b = NULL where a = 4;
|
||||
|
||||
--echo ************* SHOWING THE RESULT SETS *************
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
connection slave;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
connection master;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
connection slave;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
connection master;
|
||||
SELECT * FROM t3 ORDER BY a;
|
||||
connection slave;
|
||||
SELECT * FROM t3 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
||||
sync_slave_with_master;
|
||||
262
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_partition.test
Normal file
262
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_partition.test
Normal file
@@ -0,0 +1,262 @@
|
||||
############################################################
|
||||
# Author: MATZ #
|
||||
# Date: 2006-03-22 #
|
||||
# Purpose: See if replication of partition tables work #
|
||||
############################################################
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_query_log
|
||||
|
||||
--echo --- Start test 2 partition RANGE testing --
|
||||
|
||||
# Create table that is partitioned by range on year i.e. year(t) and
|
||||
# replicate basice operations such at insert, update delete between 2
|
||||
# different storage engines Alter table and ensure table is handled
|
||||
# Correctly on the slave
|
||||
# Note that the storage engine should not be explicit: the default
|
||||
# storage engine is used on master and slave.
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE)
|
||||
PARTITION BY RANGE (YEAR(t))
|
||||
(PARTITION p0 VALUES LESS THAN (1901),
|
||||
PARTITION p1 VALUES LESS THAN (1946),
|
||||
PARTITION p2 VALUES LESS THAN (1966),
|
||||
PARTITION p3 VALUES LESS THAN (1986),
|
||||
PARTITION p4 VALUES LESS THAN (2005),
|
||||
PARTITION p5 VALUES LESS THAN MAXVALUE);
|
||||
|
||||
--echo --- On master ---
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- On slave --
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- On master ---
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- On slave ---
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
--enable_query_log
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 2 partition RANGE testing ---
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
########################################################
|
||||
|
||||
--echo --- Start test 3 partition LIST testing ---
|
||||
--echo --- Do setup ---
|
||||
#################################################
|
||||
# Requirment: Create table that is partitioned #
|
||||
# by list on id i.e. (2,4). Pretend that we #
|
||||
# missed one and alter to add. Then replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE)
|
||||
PARTITION BY LIST(id)
|
||||
(PARTITION p0 VALUES IN (2, 4),
|
||||
PARTITION p1 VALUES IN (42, 142));
|
||||
|
||||
--echo --- Test 3 Alter to add partition ---
|
||||
|
||||
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
|
||||
|
||||
--echo --- Show table on master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Show table on slave ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 3 partition LIST testing ---
|
||||
--echo --- Do Cleanup --
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
########################################################
|
||||
|
||||
--echo --- Start test 4 partition HASH testing ---
|
||||
--echo --- Do setup ---
|
||||
#################################################
|
||||
# Requirment: Create table that is partitioned #
|
||||
# by hash on year i.e. YEAR(t). Then replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE)
|
||||
PARTITION BY HASH( YEAR(t) )
|
||||
PARTITIONS 4;
|
||||
|
||||
--echo --- show that tables have been created correctly ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 4 partition HASH testing ---
|
||||
--echo --- Do Cleanup --
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
########################################################
|
||||
|
||||
--echo --- Start test 5 partition by key testing ---
|
||||
--echo --- Create Table Section ---
|
||||
|
||||
#################################################
|
||||
# Requirment: Create table that is partitioned #
|
||||
# by key on id with 4 parts. Then replicate #
|
||||
# basice operations such at insert, update #
|
||||
# delete between 2 different storage engines #
|
||||
# Alter table and ensure table is handled #
|
||||
# Correctly on the slave #
|
||||
#################################################
|
||||
|
||||
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
|
||||
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
|
||||
f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
|
||||
y YEAR, t DATE,PRIMARY KEY(id))
|
||||
PARTITION BY KEY()
|
||||
PARTITIONS 4;
|
||||
|
||||
--echo --- Show that tables on master are ndbcluster tables ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Show that tables on slave ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
# Okay lets see how it holds up to table changes
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still right type ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- Check that simple Alter statements are replicated correctly ---
|
||||
|
||||
ALTER TABLE t1 MODIFY vc TEXT;
|
||||
|
||||
--echo --- Show the new improved table on the master ---
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Make sure that our tables on slave are still same engine ---
|
||||
--echo --- and that the alter statements replicated correctly ---
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo --- Perform basic operation on master ---
|
||||
--echo --- and ensure replicated correctly ---
|
||||
|
||||
--source include/rpl_multi_engine3.inc
|
||||
|
||||
--echo --- End test 5 key partition testing ---
|
||||
--echo --- Do Cleanup ---
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
# End of 5.1 test case
|
||||
@@ -0,0 +1,85 @@
|
||||
|
||||
#
|
||||
# BUG#52868: Wrong handling of NULL value during update, replication out of sync
|
||||
#
|
||||
-- echo ## case #1 - last_null_bit_pos==0 in record_compare without X bit
|
||||
|
||||
-- source include/rpl_reset.inc
|
||||
-- connection master
|
||||
|
||||
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
|
||||
-- disable_warnings
|
||||
UPDATE t1 SET c5 = 'a';
|
||||
-- enable_warnings
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_tables= master:t1, slave:t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit
|
||||
-- echo ## (1 column less and no varchar)
|
||||
-- source include/rpl_reset.inc
|
||||
-- connection master
|
||||
|
||||
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( 1 , 35 );
|
||||
INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 );
|
||||
-- disable_warnings
|
||||
UPDATE t1 SET c5 = 'a';
|
||||
-- enable_warnings
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_tables= master:t1, slave:t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo ## case #2 - X bit is wrongly set.
|
||||
|
||||
-- source include/rpl_reset.inc
|
||||
-- connection master
|
||||
|
||||
-- eval CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=$engine DEFAULT CHARSET= latin1
|
||||
INSERT INTO t1(c1) VALUES (10);
|
||||
INSERT INTO t1(c1) VALUES (NULL);
|
||||
UPDATE t1 SET c1= 0;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_tables= master:t1, slave:t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
#
|
||||
# BUG#11766865: 60091: RBR + NO PK + UPDATE NULL VALUE --> SLAVE BREAK WITH ERROR HA_ERR_END_OF_
|
||||
#
|
||||
|
||||
--connection master
|
||||
--source include/rpl_reset.inc
|
||||
--connection master
|
||||
|
||||
--eval CREATE TABLE t1 (c1 int(11) NOT NULL, c2 int(11) NOT NULL, c3 int(11) DEFAULT '-1') ENGINE=$engine DEFAULT CHARSET=latin1
|
||||
|
||||
INSERT INTO t1 VALUES (1,2,NULL);
|
||||
UPDATE t1 SET c1=1, c2=2, c3=-1 WHERE c1=1 AND c2=2 AND ISNULL(c3);
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
--let $diff_tables=master:test.t1, slave:test.t1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
--sync_slave_with_master
|
||||
@@ -0,0 +1,77 @@
|
||||
# When the relay log gets rotated while the I/O thread
|
||||
# is reading a transaction, the transaction spans on two or more
|
||||
# relay logs. If STOP SLAVE occurs while the SQL thread is
|
||||
# executing a part of the transaction in the non-first relay logs,
|
||||
# we test if START SLAVE will resume in the beginning of the
|
||||
# transaction (i.e., step back to the first relay log)
|
||||
|
||||
# The slave is started with max_binlog_size=16384 bytes,
|
||||
# to force many rotations (approximately 30 rotations)
|
||||
|
||||
# We have to sync with master, to ensure slave had time to start properly
|
||||
# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
stop slave;
|
||||
connection master;
|
||||
--disable_warnings
|
||||
eval create table t1 (a int) engine=$engine_type;
|
||||
--enable_warnings
|
||||
let $1=8000;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
# eval means expand $ expressions
|
||||
eval insert into t1 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
# This will generate a 500kB master's binlog,
|
||||
# which corresponds to 30 slave's relay logs.
|
||||
enable_query_log;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
reset slave;
|
||||
start slave;
|
||||
# We wait 1 sec for the SQL thread to be somewhere in
|
||||
# the middle of the transaction, hopefully not in
|
||||
# the first relay log, and hopefully before the COMMIT.
|
||||
# Usually it stops when the SQL thread is around the 15th relay log.
|
||||
# We cannot use MASTER_POS_WAIT() as master's position
|
||||
# increases only when the slave executes the COMMIT.
|
||||
# Note that except when using Valgrind, 1 second is enough for the I/O slave
|
||||
# thread to fetch the whole master's binlog.
|
||||
sleep 1;
|
||||
stop slave;
|
||||
# We suppose the SQL thread stopped before COMMIT.
|
||||
# If so the transaction was rolled back
|
||||
# and the table is now empty.
|
||||
# Now restart
|
||||
start slave;
|
||||
# And see if the table contains '8000'
|
||||
# which proves that the transaction restarted at
|
||||
# the right place.
|
||||
# We must wait for the transaction to commit before
|
||||
# reading, with a sync_with_master.
|
||||
sync_with_master;
|
||||
select max(a) from t1;
|
||||
connection master;
|
||||
|
||||
# The following DROP is a very important cleaning task:
|
||||
# imagine the next test is run with --skip-innodb: it will do
|
||||
# DROP TABLE IF EXISTS t1; but this will delete the frm and leave
|
||||
# some data in the InnoDB datafile (because at that time mysqld
|
||||
# does not know about InnoDB : --skip-innodb). So if later in the
|
||||
# test suite a test wants to create an InnoDB table called t1, it
|
||||
# will fail with
|
||||
# InnoDB: Error: table t1 already exists in InnoDB internal
|
||||
# InnoDB: data dictionary. Have you deleted the .frm file etc
|
||||
drop table t1;
|
||||
# wait until this drop is executed on slave
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,79 @@
|
||||
# TBF - difference in row level logging
|
||||
# Temp tables are not replicated in rbr, but it is still good to hit rbr with everthing
|
||||
|
||||
# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the
|
||||
# --master-* options from mysqld, as this is what is going to be used next time
|
||||
# slave threads will be started). In bug 985, it displayed old values (of before
|
||||
# RESET SLAVE).
|
||||
# See if slave crashes when doing a CREATE TEMPORARY TABLE twice, separated by
|
||||
# RESET SLAVE.
|
||||
|
||||
-- source include/master-slave.inc
|
||||
sync_slave_with_master;
|
||||
let $status_items= Master_User, Master_Host;
|
||||
source include/show_slave_status.inc;
|
||||
|
||||
source include/stop_slave.inc;
|
||||
change master to master_user='test';
|
||||
source include/show_slave_status.inc;
|
||||
|
||||
reset slave;
|
||||
source include/show_slave_status.inc;
|
||||
|
||||
source include/start_slave.inc;
|
||||
sync_with_master;
|
||||
source include/show_slave_status.inc;
|
||||
|
||||
# test of crash with temp tables & RESET SLAVE
|
||||
# (test to see if RESET SLAVE clears temp tables in memory and disk)
|
||||
source include/stop_slave.inc;
|
||||
reset slave;
|
||||
source include/start_slave.inc;
|
||||
connection master;
|
||||
create temporary table t1 (a int);
|
||||
sync_slave_with_master;
|
||||
source include/stop_slave.inc;
|
||||
reset slave;
|
||||
source include/start_slave.inc;
|
||||
sync_with_master;
|
||||
show status like 'slave_open_temp_tables';
|
||||
|
||||
#
|
||||
#Bug#34654 RESET SLAVE does not clear LAST_IO_Err*
|
||||
#
|
||||
|
||||
# clearing the status
|
||||
source include/stop_slave.inc;
|
||||
reset slave;
|
||||
source include/check_slave_no_error.inc;
|
||||
|
||||
#
|
||||
# verifying start slave resets Last_IO_Error and Last_IO_Errno.
|
||||
#
|
||||
|
||||
change master to master_user='impossible_user_name';
|
||||
start slave;
|
||||
let $slave_io_errno= 1045;
|
||||
--source include/wait_for_slave_io_error.inc
|
||||
--source include/stop_slave_sql.inc
|
||||
|
||||
change master to master_user='root';
|
||||
source include/start_slave.inc;
|
||||
source include/check_slave_no_error.inc;
|
||||
|
||||
#
|
||||
# verifying reset slave resets Last_{IO,SQL}_Err{or,no}
|
||||
#
|
||||
|
||||
source include/stop_slave.inc;
|
||||
change master to master_user='impossible_user_name';
|
||||
start slave;
|
||||
let $slave_io_errno= 1045;
|
||||
--source include/wait_for_slave_io_error.inc
|
||||
--source include/stop_slave_sql.inc
|
||||
|
||||
reset slave;
|
||||
source include/check_slave_no_error.inc;
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
83
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_001.test
Normal file
83
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_001.test
Normal file
@@ -0,0 +1,83 @@
|
||||
let $LOAD_FILE= $MYSQLTEST_VARDIR/std_data/words.dat;
|
||||
CREATE TABLE t1 (word CHAR(20) NOT NULL);
|
||||
--replace_result $LOAD_FILE LOAD_FILE
|
||||
eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1;
|
||||
--replace_result $LOAD_FILE LOAD_FILE
|
||||
eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY word LIMIT 10;
|
||||
|
||||
#
|
||||
# Test slave with wrong password
|
||||
#
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
STOP SLAVE;
|
||||
connection master;
|
||||
SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
connection master;
|
||||
#
|
||||
# Give slave time to do at last one failed connect retry
|
||||
# This one must be short so that the slave will not stop retrying
|
||||
real_sleep 2;
|
||||
SET PASSWORD FOR root@"localhost" = PASSWORD('');
|
||||
# Give slave time to connect (will retry every second)
|
||||
sleep 2;
|
||||
|
||||
CREATE TABLE t3(n INT);
|
||||
INSERT INTO t3 VALUES(1),(2);
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t3 ORDER BY n;
|
||||
SELECT SUM(LENGTH(word)) FROM t1;
|
||||
connection master;
|
||||
DROP TABLE t1,t3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# Test if the slave SQL thread can be more than 16K behind the slave
|
||||
# I/O thread (> IO_SIZE)
|
||||
|
||||
connection master;
|
||||
# we'll use table-level locking to delay slave SQL thread
|
||||
eval CREATE TABLE t1 (n INT) ENGINE=$engine_type;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
connection master;
|
||||
let $1=5000;
|
||||
# Generate 16K of relay log
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 VALUES($1);
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
save_master_pos;
|
||||
|
||||
# Try to cause a large relay log lag on the slave by locking t1
|
||||
connection slave;
|
||||
LOCK TABLES t1 READ;
|
||||
START SLAVE;
|
||||
UNLOCK TABLES;
|
||||
sync_with_master;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (n INT);
|
||||
INSERT INTO t1 VALUES(3456);
|
||||
sync_slave_with_master;
|
||||
SELECT n FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
77
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_UUID.test
Normal file
77
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_UUID.test
Normal file
@@ -0,0 +1,77 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/18/2005 #
|
||||
#############################################################################
|
||||
# TEST: To test the UUID() in rbr #
|
||||
#############################################################################
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
|
||||
# Section 1 test
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=$engine_type;
|
||||
INSERT INTO test.t1 VALUES(1,UUID(),UUID());
|
||||
delimiter |;
|
||||
create procedure test.p1()
|
||||
begin
|
||||
INSERT INTO test.t1 VALUES(2,UUID(),UUID());
|
||||
INSERT INTO test.t1 VALUES(3,UUID(),UUID());
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
CALL test.p1();
|
||||
|
||||
# Now the same thing with a function
|
||||
|
||||
delimiter |;
|
||||
create function test.fn1(x int)
|
||||
returns int
|
||||
begin
|
||||
insert into t1 values (4+x,UUID(),UUID());
|
||||
insert into t1 values (5+x,UUID(),UUID());
|
||||
return 0;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
# test both in SELECT and in INSERT
|
||||
select fn1(0);
|
||||
eval create table t2 (a int) engine=$engine_type;
|
||||
insert into t2 values(fn1(2));
|
||||
|
||||
sync_slave_with_master;
|
||||
SHOW CREATE TABLE test.t1;
|
||||
|
||||
# Dump the databases and so we can see if they match
|
||||
# Another method would be to use SELECT INTO OUTFILE on master,
|
||||
# then LOAD DATA INFILE in slave, and use a query to compare.
|
||||
# This would have the advantage that it would not assume
|
||||
# the system has a 'diff'
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql
|
||||
|
||||
connection master;
|
||||
# Let's cleanup
|
||||
|
||||
DROP PROCEDURE test.p1;
|
||||
DROP FUNCTION test.fn1;
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
|
||||
# Let's compare. Note: If they match test will pass, if they do not match
|
||||
# the test will show that the diff statement failed and not reject file
|
||||
# will be created. You will need to go to the mysql-test dir and diff
|
||||
# the files your self to see what is not matching :-)
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql;
|
||||
|
||||
# Cleanup dump files.
|
||||
# Long-term "system rm" is not portable; we could live without
|
||||
# this cleanup as no other test will use these files and they'll
|
||||
# be removed at next testsuite run.
|
||||
|
||||
628
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_basic.test
Normal file
628
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_basic.test
Normal file
@@ -0,0 +1,628 @@
|
||||
#
|
||||
# Basic tests of row-level logging
|
||||
#
|
||||
|
||||
#
|
||||
# First we test tables with only an index.
|
||||
#
|
||||
|
||||
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Testing insert
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
|
||||
INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
|
||||
SELECT * FROM t1 ORDER BY C1,C2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY C1,C2;
|
||||
|
||||
# Testing delete
|
||||
# Observe that are several rows having the value for the index but only one
|
||||
# should be deleted.
|
||||
connection master;
|
||||
DELETE FROM t1 WHERE C1 = C2;
|
||||
SELECT * FROM t1 ORDER BY C1,C2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY C1,C2;
|
||||
|
||||
#
|
||||
# Testing update.
|
||||
# Note that we have a condition on a column that is not part of the index for
|
||||
# the table. The right row should be updated nevertheless.
|
||||
#
|
||||
connection master;
|
||||
UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
|
||||
SELECT * FROM t1 ORDER BY C1,C2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY C1,C2;
|
||||
|
||||
# Testing update with a condition that does not match any rows, but
|
||||
# which has a match for the index.
|
||||
connection master;
|
||||
UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY c1,c2;
|
||||
|
||||
#
|
||||
# Testing table with primary key
|
||||
#
|
||||
connection master;
|
||||
eval CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = $type ;
|
||||
INSERT INTO t2
|
||||
VALUES (1,'A',2), (2,'A',4), (3,'A',9), (4,'A',15), (5,'A',25),
|
||||
(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
|
||||
SELECT * FROM t2 ORDER BY c1,c2;
|
||||
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t2 ORDER BY c1,c2;
|
||||
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
|
||||
|
||||
connection master;
|
||||
UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
|
||||
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
|
||||
|
||||
# Testing update with a condition that does not match any rows, but
|
||||
# which has a match for the primary key.
|
||||
connection master;
|
||||
UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
|
||||
SELECT * FROM t2 ORDER BY c1,c2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t2 ORDER BY c1,c2;
|
||||
|
||||
connection master;
|
||||
DELETE FROM t2 WHERE c1 % 4 = 0;
|
||||
SELECT * FROM t2 ORDER BY c1,c2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t2 ORDER BY c1,c2;
|
||||
|
||||
connection master;
|
||||
UPDATE t2 SET c12='X';
|
||||
|
||||
#
|
||||
# Testing table with a multi-column primary key.
|
||||
#
|
||||
connection master;
|
||||
eval CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = $type ;
|
||||
|
||||
INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
|
||||
INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
|
||||
SELECT * FROM t3 ORDER BY C1,C2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t3 ORDER BY C1,C2;
|
||||
|
||||
connection master;
|
||||
DELETE FROM t3 WHERE C1 = C2;
|
||||
SELECT * FROM t3 ORDER BY C1,C2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t3 ORDER BY C1,C2;
|
||||
|
||||
connection master;
|
||||
UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
|
||||
SELECT * FROM t3 ORDER BY C1,C2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t3 ORDER BY C1,C2;
|
||||
|
||||
#
|
||||
# Testing table without index or primary key
|
||||
#
|
||||
connection master;
|
||||
eval CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT$extra_index_t6) ENGINE = $type;
|
||||
|
||||
# Testing insert
|
||||
INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
|
||||
INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
|
||||
SELECT * FROM t6 ORDER BY C3;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t6 ORDER BY C3;
|
||||
|
||||
# Testing delete
|
||||
# Observe that are several rows having the value for the index but only one
|
||||
# should be deleted.
|
||||
connection master;
|
||||
DELETE FROM t6 WHERE C1 = C2;
|
||||
SELECT * FROM t6 ORDER BY C3;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t6 ORDER BY C3;
|
||||
|
||||
#
|
||||
# Testing update.
|
||||
# Note that we have a condition on a column that is not part of the index for
|
||||
# the table. The right row should be updated nevertheless.
|
||||
#
|
||||
connection master;
|
||||
UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
|
||||
SELECT * FROM t6 ORDER BY C3;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t6 ORDER BY C3;
|
||||
|
||||
# now mixing the 3 tables without begin/commit
|
||||
connection master;
|
||||
eval CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = $type ;
|
||||
INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
|
||||
INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
|
||||
|
||||
UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
|
||||
SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
|
||||
|
||||
#
|
||||
# Testing special column types
|
||||
#
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
|
||||
|
||||
INSERT INTO t4 SET C1 = 1;
|
||||
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||
sync_slave_with_master;
|
||||
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||
|
||||
#
|
||||
# Testing conflicting operations
|
||||
#
|
||||
connection master;
|
||||
eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
|
||||
sync_slave_with_master;
|
||||
--echo --- on slave: original values ---
|
||||
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
|
||||
SELECT * FROM t7 ORDER BY C1;
|
||||
|
||||
# since bug#31552/31609 idempotency is not default any longer. In order
|
||||
# the preceeding test INSERT INTO t7 to pass the mode is switched
|
||||
# temprorarily
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
|
||||
connection master;
|
||||
--echo --- on master: new values inserted ---
|
||||
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
||||
SELECT * FROM t7 ORDER BY C1;
|
||||
sync_slave_with_master;
|
||||
|
||||
set @@global.slave_exec_mode= default;
|
||||
--echo --- on slave: old values should be overwritten by replicated values ---
|
||||
SELECT * FROM t7 ORDER BY C1;
|
||||
|
||||
#
|
||||
# A more complicated test where the table has several keys and we are
|
||||
# causing a conflict for a key that is not "last".
|
||||
#
|
||||
connection master;
|
||||
--echo --- on master ---
|
||||
eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
|
||||
|
||||
# First we make sure that the constraints are correctly set.
|
||||
INSERT INTO t8 VALUES (99,99,99);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t8 VALUES (99,22,33);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t8 VALUES (11,99,33);
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t8 VALUES (11,22,99);
|
||||
SELECT * FROM t8 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo --- on slave ---
|
||||
SELECT * FROM t8 ORDER BY a;
|
||||
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
|
||||
SELECT * FROM t8 ORDER BY a;
|
||||
|
||||
# since bug#31552/31609 idempotency is not default any longer. In order
|
||||
# the preceeding test INSERT INTO t8 to pass the mode is switched
|
||||
# temprorarily
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
|
||||
connection master;
|
||||
--echo --- on master ---
|
||||
# We insert a row that will cause conflict on the primary key but not
|
||||
# on the other keys.
|
||||
INSERT INTO t8 VALUES (2,4,8);
|
||||
sync_slave_with_master;
|
||||
set @@global.slave_exec_mode= default;
|
||||
|
||||
--echo --- on slave ---
|
||||
SELECT * FROM t8 ORDER BY a;
|
||||
|
||||
# BUG#31552: Replication breaks when deleting rows from out-of-sync
|
||||
# table without PK
|
||||
|
||||
--echo **** Test for BUG#31552 ****
|
||||
|
||||
--echo **** On Master ****
|
||||
# Clean up t1 so that we can use it.
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Just to get a clean binary log
|
||||
--source include/rpl_reset.inc
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
|
||||
--echo **** On Master ****
|
||||
sync_slave_with_master;
|
||||
# since bug#31552/31609 idempotency is not default any longer. In order
|
||||
# the following test DELETE FROM t1 to pass the mode is switched
|
||||
# temprorarily
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
DELETE FROM t1 WHERE C1 = 'L';
|
||||
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
sync_slave_with_master;
|
||||
set @@global.slave_exec_mode= default;
|
||||
source include/check_slave_is_running.inc;
|
||||
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
|
||||
# BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
|
||||
# between machines with mixed endiannes
|
||||
# (regression test)
|
||||
|
||||
--echo **** Test for BUG#37076 ****
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
|
||||
INSERT INTO t1 VALUES(
|
||||
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
|
||||
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master slave;
|
||||
SELECT * FROM t1;
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#37426: RBR breaks for CHAR() UTF8 fields > 85 chars
|
||||
#
|
||||
|
||||
# We have 4 combinations to test with respect to the field length
|
||||
# (i.e., the number of bytes) of the CHAR fields:
|
||||
#
|
||||
# 1. Replicating from CHAR<256 to CHAR<256
|
||||
# 2. Replicating from CHAR<256 to CHAR>255
|
||||
# 3. Replicating from CHAR>255 to CHAR<256
|
||||
# 4. Replicating from CHAR>255 to CHAR>255
|
||||
|
||||
# We also make a special case of using the max size of a field on the
|
||||
# master, i.e. CHAR(255) in UTF-8, giving another three cases.
|
||||
#
|
||||
# 5. Replicating UTF-8 CHAR(255) to CHAR(<256)
|
||||
# 6. Replicating UTF-8 CHAR(255) to CHAR(>255)
|
||||
# 7. Replicating UTF-8 CHAR(255) to CHAR(255) UTF-8
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (i INT NOT NULL,
|
||||
c CHAR(16) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
eval CREATE TABLE t2 (i INT NOT NULL,
|
||||
c CHAR(16) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t3 (i INT NOT NULL,
|
||||
c CHAR(128) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t4 (i INT NOT NULL,
|
||||
c CHAR(128) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
eval CREATE TABLE t5 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t6 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t7 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, "", 1);
|
||||
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t2 VALUES (1, "", 1);
|
||||
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t2, slave:t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t3 VALUES (1, "", 1);
|
||||
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
|
||||
|
||||
connection slave;
|
||||
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
|
||||
call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032");
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_reset.inc
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t4 VALUES (1, "", 1);
|
||||
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t4, slave:t4;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t5 VALUES (1, "", 1);
|
||||
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
|
||||
|
||||
connection slave;
|
||||
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
--source include/rpl_reset.inc
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t6 VALUES (1, "", 1);
|
||||
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
|
||||
|
||||
connection slave;
|
||||
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
--source include/rpl_reset.inc
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t7 VALUES (1, "", 1);
|
||||
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t7, slave:t7;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1, t2, t3, t4, t5, t6, t7;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#32709: Assertion failed: trx_data->empty(), file .\log.cc, line 1293
|
||||
#
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=$type;
|
||||
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t1 SET a = 10;
|
||||
INSERT INTO t1 VALUES (4);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug #38230 Differences between master and slave after
|
||||
# UPDATE or DELETE with LIMIT with pk
|
||||
#
|
||||
# the regression test verifies consistency via selecting
|
||||
|
||||
--disable_abort_on_error
|
||||
|
||||
--connection master
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
eval CREATE TABLE t1 (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_nokey` int(11) NOT NULL,
|
||||
`int_key` int(11) NOT NULL,
|
||||
`date_key` date NOT NULL,
|
||||
`date_nokey` date NOT NULL,
|
||||
`time_key` time NOT NULL,
|
||||
`time_nokey` time NOT NULL,
|
||||
`datetime_key` datetime NOT NULL,
|
||||
`datetime_nokey` datetime NOT NULL,
|
||||
`varchar_key` varchar(1) NOT NULL,
|
||||
`varchar_nokey` varchar(1) NOT NULL,
|
||||
PRIMARY KEY (`pk`),
|
||||
KEY `int_key` (`int_key`),
|
||||
KEY `date_key` (`date_key`),
|
||||
KEY `time_key` (`time_key`),
|
||||
KEY `datetime_key` (`datetime_key`),
|
||||
KEY `varchar_key` (`varchar_key`)
|
||||
) ENGINE=$type;
|
||||
|
||||
INSERT INTO t1 VALUES (1,8,5,'0000-00-00','0000-00-00','10:37:38','10:37:38','0000-00-00 00:00:00','0000-00-00 00:00:00','p','p'),(2,0,9,'0000-00-00','0000-00-00','00:00:00','00:00:00','2007-10-14 00:00:00','2007-10-14 00:00:00','d','d');
|
||||
|
||||
eval CREATE TABLE t2 (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_nokey` int(11) NOT NULL,
|
||||
`int_key` int(11) NOT NULL,
|
||||
`date_key` date NOT NULL,
|
||||
`date_nokey` date NOT NULL,
|
||||
`time_key` time NOT NULL,
|
||||
`time_nokey` time NOT NULL,
|
||||
`datetime_key` datetime NOT NULL,
|
||||
`datetime_nokey` datetime NOT NULL,
|
||||
`varchar_key` varchar(1) NOT NULL,
|
||||
`varchar_nokey` varchar(1) NOT NULL,
|
||||
PRIMARY KEY (`pk`),
|
||||
KEY `int_key` (`int_key`),
|
||||
KEY `date_key` (`date_key`),
|
||||
KEY `time_key` (`time_key`),
|
||||
KEY `datetime_key` (`datetime_key`),
|
||||
KEY `varchar_key` (`varchar_key`)
|
||||
) ENGINE=$type;
|
||||
|
||||
INSERT INTO t2 VALUES (1,1,6,'2005-12-23','2005-12-23','02:24:28','02:24:28','0000-00-00 00:00:00','0000-00-00 00:00:00','g','g'),(2,0,3,'2009-09-14','2009-09-14','00:00:00','00:00:00','2000-01-30 16:39:40','2000-01-30 16:39:40','q','q'),(3,0,3,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','c','c'),(4,1,6,'2007-03-29','2007-03-29','15:49:00','15:49:00','0000-00-00 00:00:00','0000-00-00 00:00:00','m','m'),(5,4,0,'2002-12-04','2002-12-04','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','o','o'),(6,9,0,'2005-01-28','2005-01-28','00:00:00','00:00:00','2001-05-18 00:00:00','2001-05-18 00:00:00','w','w'),(7,6,0,'0000-00-00','0000-00-00','06:57:25','06:57:25','0000-00-00 00:00:00','0000-00-00 00:00:00','m','m'),(8,0,0,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','z','z'),(9,4,6,'2006-08-15','2006-08-15','00:00:00','00:00:00','2002-04-12 14:44:25','2002-04-12 14:44:25','j','j'),(10,0,5,'2006-12-20','2006-12-20','10:13:53','10:13:53','2008-07-22 00:00:00','2008-07-22 00:00:00','y','y'),(11,9,7,'0000-00-00','0000-00-00','00:00:00','00:00:00','2004-07-05 00:00:00','2004-07-05 00:00:00','{','{'),(12,4,3,'2007-01-26','2007-01-26','23:00:51','23:00:51','2001-05-16 00:00:00','2001-05-16 00:00:00','f','f'),(13,7,0,'2004-03-27','2004-03-27','00:00:00','00:00:00','2005-01-24 03:30:37','2005-01-24 03:30:37','',''),(14,6,0,'2006-07-26','2006-07-26','18:43:57','18:43:57','0000-00-00 00:00:00','0000-00-00 00:00:00','{','{'),(15,0,6,'2000-01-14','2000-01-14','00:00:00','00:00:00','2000-09-21 00:00:00','2000-09-21 00:00:00','o','o'),(16,9,8,'0000-00-00','0000-00-00','21:15:08','21:15:08','0000-00-00 00:00:00','0000-00-00 00:00:00','a','a'),(17,2,0,'2004-10-27','2004-10-27','00:00:00','00:00:00','2004-03-24 22:13:43','2004-03-24 22:13:43','',''),(18,7,4,'0000-00-00','0000-00-00','08:38:27','08:38:27','2002-03-18 19:51:44','2002-03-18 19:51:44','t','t'),(19,5,3,'2008-03-07','2008-03-07','03:29:07','03:29:07','2007-12-01 18:44:44','2007-12-01 18:44:44','t','t'),(20,0,0,'2002-04-09','2002-04-09','16:06:03','16:06:03','2009-04-22 00:00:00','2009-04-22 00:00:00','n','n');
|
||||
|
||||
DELETE FROM t2 WHERE `int_key` < 3 LIMIT 1;
|
||||
UPDATE t1 SET `int_key` = 3 ORDER BY `pk` LIMIT 4;
|
||||
DELETE FROM t2 WHERE `int_key` < 3 LIMIT 1;
|
||||
DELETE FROM t2 WHERE `pk` < 6 LIMIT 1;
|
||||
UPDATE t1 SET `int_key` = 6 ORDER BY `pk` LIMIT 3;
|
||||
DELETE FROM t2 WHERE `pk` < 6 LIMIT 1;
|
||||
UPDATE t1 SET `pk` = 6 ORDER BY `int_key` LIMIT 6;
|
||||
DELETE FROM t2 WHERE `pk` < 7 LIMIT 1;
|
||||
UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6;
|
||||
|
||||
--sync_slave_with_master
|
||||
--echo *** results: t2 must be consistent ****
|
||||
|
||||
let $diff_tables= master:t2, slave:t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--connection master
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--enable_abort_on_error
|
||||
|
||||
--echo EOF OF TESTS
|
||||
|
||||
#
|
||||
# BUG#40004: Replication failure with no PK + no indexes
|
||||
#
|
||||
|
||||
# The test cases are taken from the bug report. It is difficult to
|
||||
# produce a test case that generates a HA_ERR_RECORD_DELETED, so we go
|
||||
# with the test cases we have.
|
||||
|
||||
connection master;
|
||||
|
||||
eval CREATE TABLE t1 (a int) ENGINE=$type;
|
||||
|
||||
INSERT IGNORE INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 ( a ) VALUES ( 0 );
|
||||
INSERT INTO t1 ( a ) VALUES ( 9 );
|
||||
INSERT INTO t1 ( a ) VALUES ( 2 );
|
||||
INSERT INTO t1 ( a ) VALUES ( 9 );
|
||||
INSERT INTO t1 ( a ) VALUES ( 5 );
|
||||
|
||||
UPDATE t1 SET a = 5 WHERE a = 9;
|
||||
DELETE FROM t1 WHERE a < 6;
|
||||
UPDATE t1 SET a = 9 WHERE a < 3;
|
||||
INSERT INTO t1 ( a ) VALUES ( 3 );
|
||||
UPDATE t1 SET a = 0 WHERE a < 4;
|
||||
UPDATE t1 SET a = 8 WHERE a < 5;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# Bug #39752: Replication failure on RBR + MyISAM + no PK
|
||||
#
|
||||
|
||||
# The test cases are taken from the bug report. It is difficult to
|
||||
# produce a test case that generates a HA_ERR_RECORD_DELETED, so we go
|
||||
# with the test cases we have.
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
eval CREATE TABLE t1 (a bit) ENGINE=$type;
|
||||
INSERT IGNORE INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 ( a ) VALUES ( 0 );
|
||||
UPDATE t1 SET a = 0 WHERE a = 1 LIMIT 3;
|
||||
INSERT INTO t1 ( a ) VALUES ( 5 );
|
||||
DELETE FROM t1 WHERE a < 2 LIMIT 4;
|
||||
DELETE FROM t1 WHERE a < 9 LIMIT 4;
|
||||
INSERT INTO t1 ( a ) VALUES ( 9 );
|
||||
UPDATE t1 SET a = 8 WHERE a = 0 LIMIT 6;
|
||||
INSERT INTO t1 ( a ) VALUES ( 8 );
|
||||
UPDATE t1 SET a = 0 WHERE a < 6 LIMIT 0;
|
||||
INSERT INTO t1 ( a ) VALUES ( 4 );
|
||||
INSERT INTO t1 ( a ) VALUES ( 3 );
|
||||
UPDATE t1 SET a = 0 WHERE a = 7 LIMIT 6;
|
||||
DELETE FROM t1 WHERE a = 4 LIMIT 7;
|
||||
UPDATE t1 SET a = 9 WHERE a < 2 LIMIT 9;
|
||||
UPDATE t1 SET a = 0 WHERE a < 9 LIMIT 2;
|
||||
DELETE FROM t1 WHERE a < 0 LIMIT 5;
|
||||
INSERT INTO t1 ( a ) VALUES ( 5 );
|
||||
UPDATE t1 SET a = 4 WHERE a < 6 LIMIT 4;
|
||||
INSERT INTO t1 ( a ) VALUES ( 5 );
|
||||
UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 8;
|
||||
DELETE FROM t1 WHERE a < 8 LIMIT 8;
|
||||
INSERT INTO t1 ( a ) VALUES ( 6 );
|
||||
DELETE FROM t1 WHERE a < 6 LIMIT 7;
|
||||
UPDATE t1 SET a = 7 WHERE a = 3 LIMIT 7;
|
||||
UPDATE t1 SET a = 8 WHERE a = 0 LIMIT 6;
|
||||
INSERT INTO t1 ( a ) VALUES ( 7 );
|
||||
DELETE FROM t1 WHERE a < 9 LIMIT 4;
|
||||
INSERT INTO t1 ( a ) VALUES ( 7 );
|
||||
INSERT INTO t1 ( a ) VALUES ( 6 );
|
||||
UPDATE t1 SET a = 8 WHERE a = 3 LIMIT 4;
|
||||
DELETE FROM t1 WHERE a = 2 LIMIT 9;
|
||||
DELETE FROM t1 WHERE a = 1 LIMIT 4;
|
||||
UPDATE t1 SET a = 4 WHERE a = 2 LIMIT 7;
|
||||
INSERT INTO t1 ( a ) VALUES ( 0 );
|
||||
DELETE FROM t1 WHERE a < 3 LIMIT 0;
|
||||
UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2;
|
||||
INSERT INTO t1 ( a ) VALUES ( 1 );
|
||||
UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
|
||||
--enable_warnings
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
187
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_blob.test
Normal file
187
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_blob.test
Normal file
@@ -0,0 +1,187 @@
|
||||
#################################################
|
||||
# Author: JBM
|
||||
# Date: 2006-01-06
|
||||
# Purpose: Test test that BLOBs are replicated
|
||||
# correctly.
|
||||
################################################
|
||||
|
||||
# Pre test clean up section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
--enable_warnings
|
||||
|
||||
# Start test section
|
||||
--echo ***** Table Create Section ****
|
||||
--echo
|
||||
--disable_warnings
|
||||
--replace_result $engine_type #
|
||||
eval CREATE TABLE test.t1 (c1 int not null auto_increment,
|
||||
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
|
||||
--enable_warnings
|
||||
--echo
|
||||
--echo **** Data Insert Section test.t1 *****
|
||||
--echo
|
||||
INSERT INTO test.t1 VALUES (NULL, NULL);
|
||||
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
|
||||
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
|
||||
--echo
|
||||
|
||||
--echo **** Data Insert Validation Master Section test.t1 ****
|
||||
--echo
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--echo
|
||||
--echo **** Data Insert Validation Slave Section test.t1 ****
|
||||
--echo
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
|
||||
connection master;
|
||||
--echo
|
||||
|
||||
--echo **** Data Update Section test.t1 ****
|
||||
--echo
|
||||
UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
|
||||
UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
|
||||
--echo
|
||||
|
||||
--echo **** Data Update Validation Master Section test.t1 ****
|
||||
--echo
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
|
||||
# Sleep is needed for NDB to allow time for
|
||||
# Injector thread to populate the bin log.
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--echo
|
||||
--echo **** Data Update Validation Slave Section test.t1 ****
|
||||
--echo
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
|
||||
connection master;
|
||||
--echo
|
||||
--echo **** End Test Section test.t1 ****
|
||||
--echo
|
||||
|
||||
--echo **** Create Table test.t2 ****
|
||||
--echo
|
||||
--disable_warnings
|
||||
--replace_result $engine_type #
|
||||
eval CREATE TABLE test.t2 (
|
||||
c1 INT NOT NULL PRIMARY KEY,
|
||||
c2 TEXT,
|
||||
c3 INT,
|
||||
c4 LONGBLOB,
|
||||
KEY(c3))ENGINE=$engine_type;
|
||||
--enable_warnings
|
||||
--echo
|
||||
|
||||
--echo *** Setup Values For test.t2 ***
|
||||
# x0 size 256 (current inline size)
|
||||
set @x0 = '01234567012345670123456701234567';
|
||||
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
|
||||
|
||||
# b1 length 2000+256 (blob part aligned)
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
set @b1 = concat(@b1,@x0);
|
||||
# d1 length 3000
|
||||
set @d1 = 'dd1';
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||
|
||||
# b2 length 20000
|
||||
set @b2 = 'b2';
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
|
||||
|
||||
# d2 length 30000
|
||||
set @d2 = 'dd2';
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
|
||||
--echo
|
||||
|
||||
--echo **** Data Insert Section test.t2 *****
|
||||
--echo
|
||||
INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
|
||||
INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
|
||||
--echo
|
||||
|
||||
--echo **** Data Insert Validation Master Section test.t2 ****
|
||||
--echo
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=1;
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--echo
|
||||
--echo **** Data Insert Validation Slave Section test.t2 ****
|
||||
--echo
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=1;
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=2;
|
||||
connection master;
|
||||
--echo
|
||||
|
||||
--echo **** Data Update Section test.t2 ****
|
||||
--echo
|
||||
UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
|
||||
UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
|
||||
--echo
|
||||
|
||||
--echo **** Data Update Validation Master Section test.t2 ****
|
||||
--echo
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=1;
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=2;
|
||||
# Sleep is needed for NDB to allow time for
|
||||
# Injector thread to populate the bin log.
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--echo
|
||||
--echo **** Data Update Validation Slave Section test.t2 ****
|
||||
--echo
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=1;
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=2;
|
||||
connection master;
|
||||
--echo
|
||||
|
||||
# Post test clean up section
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql;
|
||||
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
# ensure cleanup on slave as well:
|
||||
# ndb blob tables consist of several tables
|
||||
# if cluster is shutdown while not all tables are
|
||||
# properly dropped, the table becomes inconsistent
|
||||
# and wrecks later test cases
|
||||
--sync_slave_with_master
|
||||
@@ -0,0 +1,21 @@
|
||||
# See if INSERT DELAYED gets replicated
|
||||
# Only in row-based, as we do SHOW BINLOG EVENTS
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection master;
|
||||
let $VERSION=`select version()`;
|
||||
eval create table t1(a int not null primary key) engine=$engine_type;
|
||||
insert delayed into t1 values (1);
|
||||
insert delayed into t1 values (2);
|
||||
insert delayed into t1 values (3);
|
||||
flush tables;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,97 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/15/2005 #
|
||||
# Update: 08/29/2005 Comment out sleep. Only needed for debugging #
|
||||
#############################################################################
|
||||
# Note: Many lines are commented out in this test case. These were used for #
|
||||
# creating the test case and debugging and are being left for #
|
||||
# debugging, but they can not be used for the regular testing as the #
|
||||
# Time changes and is not deteministic, so instead we dump both the #
|
||||
# master and slave and diff the dumps. If the dumps differ then the #
|
||||
# test case will fail. To run during diff failuers, comment out the #
|
||||
# diff. #
|
||||
# Test: Tests MySQL stored function using RAND() and a flow control. The #
|
||||
# test inserts rows into a givin table with the function used in #
|
||||
# the insert statement. Depending on the RAND() value returned #
|
||||
# inside the function one set of text is returned. In addition, #
|
||||
# it uses a transaction to see the effect a rollback has on master #
|
||||
# Vs slave. #
|
||||
#############################################################################
|
||||
|
||||
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP FUNCTION IF EXISTS test.f1;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
|
||||
--enable_warnings
|
||||
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
create function test.f1() RETURNS CHAR(16)
|
||||
BEGIN
|
||||
DECLARE tmp CHAR(16);
|
||||
DECLARE var_name FLOAT;
|
||||
SET var_name = RAND();
|
||||
IF var_name > .6
|
||||
THEN SET tmp = 'Texas';
|
||||
ELSE SET tmp = 'MySQL';
|
||||
END IF;
|
||||
RETURN tmp;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
--disable_warnings
|
||||
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
|
||||
sleep 6;
|
||||
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
|
||||
sleep 6;
|
||||
--enable_warnings
|
||||
|
||||
#Select in this test are used for debugging
|
||||
#select * from test.t1;
|
||||
#connection slave;
|
||||
#select * from test.t1;
|
||||
|
||||
connection master;
|
||||
SET AUTOCOMMIT=0;
|
||||
START TRANSACTION;
|
||||
--disable_warnings
|
||||
INSERT INTO test.t1 VALUES (null,test.f1());
|
||||
--enable_warnings
|
||||
ROLLBACK;
|
||||
SET AUTOCOMMIT=1;
|
||||
#select * from test.t1;
|
||||
#sleep 6;
|
||||
|
||||
#connection slave;
|
||||
#select * from test.t1;
|
||||
|
||||
#connection master;
|
||||
|
||||
#used for debugging
|
||||
#show binlog events;
|
||||
|
||||
# time to dump the databases and so we can see if they match
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_slave.sql
|
||||
|
||||
# First lets cleanup
|
||||
DROP FUNCTION test.f1;
|
||||
DROP TABLE test.t1;
|
||||
|
||||
|
||||
# the test will show that the diff statement failed and no reject file
|
||||
# will be created. You will need to go to the mysql-test dir and diff
|
||||
# the files yourself to see what is not matching :-) File are located
|
||||
# in $MYSQLTEST_VARDIR/tmp
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/func003_master.sql $MYSQLTEST_VARDIR/tmp/func003_slave.sql;
|
||||
|
||||
|
||||
# End of 5.0 test case
|
||||
209
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_sp002.test
Normal file
209
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_row_sp002.test
Normal file
@@ -0,0 +1,209 @@
|
||||
#############################################################################
|
||||
# This test is being created to test out the non deterministic items with #
|
||||
# row based replication. #
|
||||
#############################################################################
|
||||
# Test: Contains two stored procedures test one that insert data into tables#
|
||||
# and use the LAST_INSERTED_ID() on tables with FOREIGN KEY(a) #
|
||||
# REFERENCES ON DELETE CASCADE. This test also has a delete sp that #
|
||||
# should cause a delete cascade. #
|
||||
# The second test has a sp that will either insert rows or delete from#
|
||||
# the table depending on the CASE outcome. The test uses this SP in a#
|
||||
# transaction first rolling back and then commiting, #
|
||||
#############################################################################
|
||||
|
||||
|
||||
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
|
||||
# Begin test section 1
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type;
|
||||
eval CREATE TABLE test.t2 (a INT AUTO_INCREMENT KEY, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON DELETE CASCADE) ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
create procedure test.p1(IN i CHAR(6))
|
||||
begin
|
||||
INSERT INTO test.t1 (t) VALUES (i);
|
||||
INSERT INTO test.t2 VALUES (NULL,LAST_INSERT_ID());
|
||||
end|
|
||||
create procedure test.p2(IN i INT)
|
||||
begin
|
||||
DELETE FROM test.t1 where a < i;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
let $message=< -- test 1 call p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
call test.p1('texas');
|
||||
call test.p1('Live');
|
||||
call test.p1('next');
|
||||
call test.p1('to');
|
||||
call test.p1('OK');
|
||||
call test.p1('MySQL');
|
||||
|
||||
let $message=< -- test 1 select master after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 select slave after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 call p2 & select master -- >;
|
||||
--source include/show_msg.inc
|
||||
connection master;
|
||||
call test.p2(4);
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 select slave after p2 -- >;
|
||||
--source include/show_msg.inc
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
connection master;
|
||||
#show binlog events;
|
||||
let $message=< -- End test 1 Begin test 2 -- >;
|
||||
--source include/show_msg.inc
|
||||
# End test 1 Begin test 2
|
||||
|
||||
--disable_warnings
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT, t CHAR(6), PRIMARY KEY(a)) ENGINE=$engine_type;
|
||||
eval CREATE TABLE test.t2 (a INT, f INT, FOREIGN KEY(a) REFERENCES test.t1(a) ON UPDATE CASCADE, PRIMARY KEY(a)) ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.p1(IN nm INT, IN ch CHAR(6))
|
||||
BEGIN
|
||||
INSERT INTO test.t1 (a,t) VALUES (nm, ch);
|
||||
INSERT INTO test.t2 VALUES (nm, LAST_INSERT_ID());
|
||||
END|
|
||||
CREATE PROCEDURE test.p2(IN i INT)
|
||||
BEGIN
|
||||
UPDATE test.t1 SET a = i*10 WHERE a = i;
|
||||
END|
|
||||
delimiter ;|
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
CALL test.p1(1,'texas');
|
||||
CALL test.p1(2,'Live');
|
||||
CALL test.p1(3,'next');
|
||||
CALL test.p1(4,'to');
|
||||
CALL test.p1(5,'OK');
|
||||
CALL test.p1(6,'MySQL');
|
||||
|
||||
let $message=< -- test 2 select Master after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 2 select Slave after p1 -- >;
|
||||
--source include/show_msg.inc
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 2 call p2 & select Master -- >;
|
||||
--source include/show_msg.inc
|
||||
connection master;
|
||||
CALL test.p2(2);
|
||||
CALL test.p2(4);
|
||||
CALL test.p2(6);
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
let $message=< -- test 1 select Slave after p2 -- >;
|
||||
--source include/show_msg.inc
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
SELECT * FROM test.t2;
|
||||
|
||||
connection master;
|
||||
#show binlog events;
|
||||
let $message=< -- End test 2 Begin test 3 -- >;
|
||||
--source include/show_msg.inc
|
||||
# End test 2 begin test 3
|
||||
|
||||
eval CREATE TABLE test.t3 (a INT AUTO_INCREMENT KEY, t CHAR(6))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.p3(IN n INT)
|
||||
begin
|
||||
CASE n
|
||||
WHEN 2 THEN
|
||||
DELETE from test.t3;
|
||||
ELSE
|
||||
INSERT INTO test.t3 VALUES (NULL,'NONE');
|
||||
END CASE;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
SET AUTOCOMMIT=0;
|
||||
START TRANSACTION;
|
||||
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
let $n=50;
|
||||
while ($n)
|
||||
{
|
||||
eval call test.p3($n);
|
||||
dec $n;
|
||||
}
|
||||
-- enable_result_log
|
||||
-- enable_query_log
|
||||
|
||||
ROLLBACK;
|
||||
select * from test.t3;
|
||||
sync_slave_with_master;
|
||||
select * from test.t3;
|
||||
|
||||
connection master;
|
||||
START TRANSACTION;
|
||||
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
let $n=50;
|
||||
while ($n)
|
||||
{
|
||||
eval call test.p3($n);
|
||||
dec $n;
|
||||
}
|
||||
-- enable_result_log
|
||||
-- enable_query_log
|
||||
|
||||
COMMIT;
|
||||
select * from test.t3;
|
||||
sync_slave_with_master;
|
||||
select * from test.t3;
|
||||
|
||||
connection master;
|
||||
#show binlog events from 1627;
|
||||
|
||||
|
||||
# First lets cleanup
|
||||
SET AUTOCOMMIT=1;
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
DROP PROCEDURE test.p3;
|
||||
DROP PROCEDURE test.p1;
|
||||
DROP PROCEDURE test.p2;
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
DROP TABLE test.t3;
|
||||
|
||||
# End of 5.0 test case
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,70 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/13/2005 Created from Bug 12335 #
|
||||
#############################################################################
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
|
||||
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE test.p1()
|
||||
BEGIN
|
||||
INSERT INTO test.t1 VALUES (4);
|
||||
SELECT get_lock("test", 100);
|
||||
UPDATE test.t1 set a=a+4 WHERE a=4;
|
||||
END|
|
||||
CREATE PROCEDURE test.p2()
|
||||
BEGIN
|
||||
UPDATE test.t1 SET a=a+1;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
SELECT get_lock("test", 200);
|
||||
|
||||
connection master1;
|
||||
send CALL test.p1();
|
||||
|
||||
connection master;
|
||||
# To make sure tha the call on master1 arrived at the get_lock
|
||||
sleep 1;
|
||||
CALL test.p2();
|
||||
SELECT release_lock("test");
|
||||
SELECT * FROM test.t1;
|
||||
#show binlog events;
|
||||
# Added sleep for use with NDB to ensure that
|
||||
# the injector thread will populate log before
|
||||
# we switch to the slave.
|
||||
sleep 5;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
CALL test.p2();
|
||||
CALL test.p1();
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM test.t1;
|
||||
connection master;
|
||||
#show binlog events from 720;
|
||||
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP PROCEDURE IF EXISTS test.p2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.0 test case
|
||||
@@ -0,0 +1,84 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/15/2005 #
|
||||
# Updated: 08/29/2005 to remove sleeps #
|
||||
#############################################################################
|
||||
# Test: This test uses two SPs, one to populate a table, and another to use #
|
||||
# Cursors, CURRENT_DATE(), loop control, date math and logic control #
|
||||
# to populate a table with data from the first table. #
|
||||
#############################################################################
|
||||
|
||||
# Begin clean up test section
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
--enable_warnings
|
||||
# End of cleanup
|
||||
|
||||
# Begin test section 1
|
||||
eval CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
|
||||
eval CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT 0;
|
||||
DECLARE spa CHAR(16);
|
||||
DECLARE spb INT;
|
||||
DECLARE cur1 CURSOR FOR SELECT name,
|
||||
(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
|
||||
FROM t1;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
||||
|
||||
OPEN cur1;
|
||||
|
||||
SET AUTOCOMMIT=0;
|
||||
REPEAT
|
||||
FETCH cur1 INTO spa, spb;
|
||||
IF NOT done THEN
|
||||
START TRANSACTION;
|
||||
INSERT INTO t2 VALUES (spa,spb);
|
||||
COMMIT;
|
||||
END IF;
|
||||
UNTIL done END REPEAT;
|
||||
|
||||
SET AUTOCOMMIT=1;
|
||||
CLOSE cur1;
|
||||
END|
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
CALL p2();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
CALL p1();
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
|
||||
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
# Lets compare. Note: If they match test will pass, if they do not match
|
||||
# the test will show that the diff statement failed and not reject file
|
||||
# will be created. You will need to go to the mysql-test dir and diff
|
||||
# the files your self to see what is not matching :-) Failed test
|
||||
# Dump files will be located in $MYSQLTEST_VARDIR/tmp.
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/sp006_master.sql $MYSQLTEST_VARDIR/tmp/sp006_slave.sql;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of 5.1 test case
|
||||
@@ -0,0 +1,55 @@
|
||||
#############################################################################
|
||||
# TEST: SP that creates table, starts tranaction inserts. Save point, insert#
|
||||
# rollback to save point and then commits. #
|
||||
#############################################################################
|
||||
# Includes
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
# Begin test section 1
|
||||
delimiter |;
|
||||
eval CREATE PROCEDURE test.p1(IN i INT)
|
||||
BEGIN
|
||||
DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=$engine_type;
|
||||
START TRANSACTION;
|
||||
INSERT INTO test.t1 VALUES(i);
|
||||
savepoint t1_save;
|
||||
INSERT INTO test.t1 VALUES (14);
|
||||
ROLLBACK to savepoint t1_save;
|
||||
COMMIT;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
let $message=< ---- Master selects-- >;
|
||||
--source include/show_msg.inc
|
||||
CALL test.p1(12);
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
|
||||
let $message=< ---- Slave selects-- >;
|
||||
--source include/show_msg.inc
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
let $message=< ---- Master selects-- >;
|
||||
--source include/show_msg.inc
|
||||
connection master;
|
||||
CALL test.p1(13);
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
let $message=< ---- Slave selects-- >;
|
||||
--source include/show_msg.inc
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
connection master;
|
||||
#show binlog events;
|
||||
|
||||
|
||||
DROP PROCEDURE test.p1;
|
||||
DROP TABLE test.t1;
|
||||
|
||||
# End of 5.0 test case
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,243 @@
|
||||
# Test how replication of tables work when the definition on the
|
||||
# master and slave differs.
|
||||
|
||||
# Consider making these part of the basic RBR tests.
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
|
||||
DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t9;
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
sync_slave_with_master;
|
||||
STOP SLAVE;
|
||||
SET @my_sql_mode= @@global.sql_mode;
|
||||
SET GLOBAL SQL_MODE='STRICT_ALL_TABLES';
|
||||
START SLAVE;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1_int (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t1_bit (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t1_char (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t1_nodef (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t5 (a INT, b INT, c INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t6 (a INT, b INT, c INT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t7 (a INT NOT NULL) ENGINE=$engine_type;
|
||||
eval CREATE TABLE t8 (a INT NOT NULL) ENGINE=$engine_type;
|
||||
|
||||
# Table used to detect that slave is running
|
||||
eval CREATE TABLE t9 (a INT) ENGINE=$engine_type;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
# On the slave, we add one INT column last in table 't1_int',
|
||||
ALTER TABLE t1_int ADD x INT DEFAULT 42;
|
||||
# ... and add BIT columns last in table 't1_bit' to ensure that we
|
||||
# have at least one extra null byte on the slave,
|
||||
ALTER TABLE t1_bit
|
||||
ADD x BIT(3) DEFAULT b'011',
|
||||
ADD y BIT(5) DEFAULT b'10101',
|
||||
ADD z BIT(2) DEFAULT b'10';
|
||||
# ... and add one CHAR column last in table 't1_char',
|
||||
ALTER TABLE t1_char ADD x CHAR(20) DEFAULT 'Just a test';
|
||||
# ... and add one non-nullable INT column last in table 't1_text'
|
||||
# with no default,
|
||||
ALTER TABLE t1_nodef ADD x INT NOT NULL, ADD y INT NOT NULL, ADD z INT NOT NULL;
|
||||
# ... and remove the last column in t2
|
||||
ALTER TABLE t2 DROP b;
|
||||
# ... change the type of the single column in table 't4'
|
||||
ALTER TABLE t4 MODIFY a FLOAT;
|
||||
# ... change the type of the middle column of table 't5'
|
||||
ALTER TABLE t5 MODIFY b FLOAT;
|
||||
# ... change the type of the last column of table 't6'
|
||||
ALTER TABLE t6 MODIFY c FLOAT;
|
||||
|
||||
# ... add one byte worth of null bytes to the table on the slave
|
||||
ALTER TABLE t7 ADD e1 INT, ADD e2 INT, ADD e3 INT, ADD e4 INT,
|
||||
ADD e5 INT, ADD e6 INT, ADD e7 INT, ADD e8 INT;
|
||||
|
||||
# ... add 8 columns that are nullable: t8 will not be entirely
|
||||
# nullable and have no null bits (just an X bit)
|
||||
ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
|
||||
ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
|
||||
ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
|
||||
ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
|
||||
|
||||
# Insert some values for tables on slave side. These should not be
|
||||
# modified when the row from the master is applied.
|
||||
# since bug#31552/31609 idempotency is not default any longer. In order
|
||||
# the following INSERTs to pass the mode is switched temprorarily
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
|
||||
# so the inserts are going to be overriden
|
||||
INSERT INTO t1_int VALUES (2, 4, 4711);
|
||||
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
|
||||
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
INSERT INTO t1_int VALUES (1,2);
|
||||
INSERT INTO t1_int VALUES (2,5);
|
||||
INSERT INTO t1_bit VALUES (1,2);
|
||||
INSERT INTO t1_bit VALUES (2,5);
|
||||
INSERT INTO t1_char VALUES (1,2);
|
||||
INSERT INTO t1_char VALUES (2,5);
|
||||
SELECT * FROM t1_int ORDER BY a;
|
||||
SELECT * FROM t1_bit ORDER BY a;
|
||||
SELECT * FROM t1_char ORDER BY a;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
set @@global.slave_exec_mode= default;
|
||||
|
||||
SELECT a,b,x FROM t1_int ORDER BY a;
|
||||
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
|
||||
SELECT a,b,x FROM t1_char ORDER BY a;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
UPDATE t1_int SET b=2*b WHERE a=2;
|
||||
UPDATE t1_char SET b=2*b WHERE a=2;
|
||||
UPDATE t1_bit SET b=2*b WHERE a=2;
|
||||
SELECT * FROM t1_int ORDER BY a;
|
||||
SELECT * FROM t1_bit ORDER BY a;
|
||||
SELECT * FROM t1_char ORDER BY a;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT a,b,x FROM t1_int ORDER BY a;
|
||||
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
|
||||
SELECT a,b,x FROM t1_char ORDER BY a;
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (2);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t1_nodef VALUES (1,2);
|
||||
|
||||
# Last insert on wider slave table succeeds while slave sql sql_mode permits.
|
||||
# The previous version of the above test expected slave sql to stop.
|
||||
# bug#38173 relaxed conditions to stop only with the strict mode.
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1_nodef;
|
||||
|
||||
#
|
||||
# Replicating to tables with fewer columns at the end works as of WL#3228
|
||||
#
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (2);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
--echo **** On Master ****
|
||||
INSERT INTO t2 VALUES (2,4);
|
||||
SELECT * FROM t2;
|
||||
sync_slave_with_master;
|
||||
--echo **** On Slave ****
|
||||
SELECT * FROM t2;
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (4);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t4 VALUES (4);
|
||||
connection slave;
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column [012] type mismatch.* Error_code: 1535");
|
||||
--let $slave_skip_counter= 2
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (5);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t5 VALUES (5,10,25);
|
||||
connection slave;
|
||||
--let $slave_skip_counter= 2
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (6);
|
||||
sync_slave_with_master;
|
||||
# Now slave is guaranteed to be running
|
||||
connection master;
|
||||
INSERT INTO t6 VALUES (6,12,36);
|
||||
connection slave;
|
||||
--let $slave_skip_counter= 2
|
||||
--let $slave_sql_errno= 1535
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
connection master;
|
||||
INSERT INTO t9 VALUES (6);
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
# Testing some tables extra field that can be null and cannot be null
|
||||
# (but have default values)
|
||||
|
||||
connection master;
|
||||
INSERT INTO t7 VALUES (1),(2),(3);
|
||||
INSERT INTO t8 VALUES (1),(2),(3);
|
||||
SELECT * FROM t7 ORDER BY a;
|
||||
SELECT * FROM t8 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t7 ORDER BY a;
|
||||
SELECT * FROM t8 ORDER BY a;
|
||||
|
||||
# We will now try to update and then delete a row on the master where
|
||||
# the extra field on the slave does not have a default value. This
|
||||
# update should not generate an error even though there is no default
|
||||
# for the extra column.
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
TRUNCATE t1_nodef;
|
||||
SET SQL_LOG_BIN=0;
|
||||
INSERT INTO t1_nodef VALUES (1,2);
|
||||
INSERT INTO t1_nodef VALUES (2,4);
|
||||
SET SQL_LOG_BIN=1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo **** On Slave ****
|
||||
connection slave;
|
||||
INSERT INTO t1_nodef VALUES (1,2,3,4,5);
|
||||
INSERT INTO t1_nodef VALUES (2,4,6,8,10);
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
UPDATE t1_nodef SET b=2*b WHERE a=1;
|
||||
SELECT * FROM t1_nodef ORDER BY a;
|
||||
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1_nodef ORDER BY a;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DELETE FROM t1_nodef WHERE a=2;
|
||||
SELECT * FROM t1_nodef ORDER BY a;
|
||||
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1_nodef ORDER BY a;
|
||||
|
||||
--echo **** Cleanup ****
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1_int,t1_bit,t1_char,t1_nodef;
|
||||
DROP TABLE IF EXISTS t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
sync_slave_with_master;
|
||||
|
||||
# Restore sql_mode
|
||||
SET @@global.sql_mode= @my_sql_mode;
|
||||
82
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_set_null.test
Normal file
82
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_set_null.test
Normal file
@@ -0,0 +1,82 @@
|
||||
# Both of the following tests check that comparison of binlog BI
|
||||
# against SE record will not fail due to remains from previous values
|
||||
# in the SE record (before a given field was set to null).
|
||||
#
|
||||
# In MIXED mode:
|
||||
# - Insert and update are executed as statements
|
||||
# - Delete is executed as a row event
|
||||
# - Assertion: checks that comparison will not fail because the update
|
||||
# statement will clear the record contents for the nulled
|
||||
# field. If data was not cleared, some engines may keep
|
||||
# the value and return it later as garbage - despite the
|
||||
# fact that field is null. This may cause slave to
|
||||
# falsely fail in the comparison (memcmp would fail
|
||||
# because of "garbage" in record data).
|
||||
#
|
||||
# In ROW mode:
|
||||
# - Insert, update and delete are executed as row events.
|
||||
# - Assertion: checks that comparison will not fail because the update
|
||||
# rows event will clear the record contents before
|
||||
# feeding the new value to the SE. This protects against
|
||||
# SEs that do not clear record contents when storing
|
||||
# nulled fields. If the engine did not clear the data it
|
||||
# would cause slave to falsely fail in the comparison
|
||||
# (memcmp would fail because of "garbage" in record
|
||||
# data). This scenario is pretty much the same described
|
||||
# above in MIXED mode, but checks different execution
|
||||
# path in the slave.
|
||||
|
||||
# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on
|
||||
# delete cant find record
|
||||
|
||||
-- source include/rpl_reset.inc
|
||||
|
||||
-- connection master
|
||||
-- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine
|
||||
INSERT INTO `t1` VALUES ( 1, 1 );
|
||||
UPDATE t1 SET c1=NULL where c2=1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_tables= master:t1, slave:t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
# triggers switch to row mode when on mixed
|
||||
DELETE FROM t1 WHERE c2=1 LIMIT 1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_tables= master:t1, slave:t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- source include/rpl_reset.inc
|
||||
|
||||
-- connection master
|
||||
|
||||
# BUG#49482: RBR: Replication may break on deletes when MyISAM tables
|
||||
# + char field are used
|
||||
|
||||
-- eval CREATE TABLE t1 (c1 CHAR) Engine=$engine
|
||||
|
||||
INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ;
|
||||
SELECT * FROM t1;
|
||||
UPDATE t1 SET c1=NULL WHERE c1='w';
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_tables= master:t1, slave:t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
# triggers switch to row mode when on mixed
|
||||
DELETE FROM t1 LIMIT 2;
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- let $diff_tables= master:t1, slave:t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
@@ -0,0 +1,41 @@
|
||||
###################################
|
||||
# Author: JBM
|
||||
# Date: 2006-01-11
|
||||
# Purpose: Second test case from
|
||||
# rpl_EE_err.test split out
|
||||
# from orginal to make the
|
||||
# first work with both RBR and SBR
|
||||
###################################
|
||||
#REQUIREMENT: An INSERT with a faked duplicate entry error on
|
||||
#master should be replicated to slave and force the slave to stop
|
||||
#(since the slave can't cause a faked error to re-occur).
|
||||
###################################
|
||||
|
||||
-- source include/master-slave.inc
|
||||
|
||||
connection master;
|
||||
eval create table t1 (a int, unique(a)) engine=$engine_type;
|
||||
set sql_log_bin=0;
|
||||
insert into t1 values(2);
|
||||
set sql_log_bin=1;
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 values(1),(2);
|
||||
drop table t1;
|
||||
|
||||
connection slave;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.* error code=1062.*Error on slave:.* Error_code: 0");
|
||||
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
|
||||
let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
|
||||
--echo Error: "$error" (expected different error codes on master and slave)
|
||||
--echo Errno: "$errno" (expected 0)
|
||||
drop table t1;
|
||||
--source include/stop_slave.inc
|
||||
# Clear error messages.
|
||||
RESET SLAVE;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,268 @@
|
||||
--echo
|
||||
--echo
|
||||
connection master;
|
||||
|
||||
if ($is_temporary)
|
||||
{
|
||||
--let $_temporary=TEMPORARY
|
||||
}
|
||||
|
||||
CREATE TABLE t2(c1 INT, c2 char(10));
|
||||
INSERT INTO t2 VALUES(1, 'abc'), (2, 'abc');
|
||||
|
||||
--echo
|
||||
--echo # The original query should be binlogged if the table does not exist.
|
||||
--echo # ------------------------------------------------------------------
|
||||
--echo
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1 (c1 INT , c2 INT, c3 char(10), c4 INT KEY)
|
||||
SELECT 'abc' AS c3, 1 AS c4;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # The statement should be binlogged as two events. one is
|
||||
--echo # 'CREATE $_temporary TABLE IF NOT EXISTS ..', another one is
|
||||
--echo # 'INSERT ... SELECT'.
|
||||
--echo # ------------------------------------------------------------------
|
||||
--echo
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
SELECT 'abc', 2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # Verify if it can be binlogged with right database name when the table
|
||||
--echo # is not in the default database
|
||||
--echo
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db1;
|
||||
--enable_warnings
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS test.t1
|
||||
SELECT 'abc', 20;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:test.t1,slave:test.t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
USE test;
|
||||
DROP DATABASE db1;
|
||||
|
||||
--echo
|
||||
--echo # It should be binlogged as 'REPLACE ... SELECT'
|
||||
--echo # if the original statement has option REPLACE
|
||||
--echo
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
REPLACE SELECT '123', 2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # It should be binlogged as 'INSERT IGNORE... SELECT'
|
||||
--echo # if the original statement has option IGNORE
|
||||
--echo
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
IGNORE SELECT '123', 2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # Nothing should be binlogged if error happens and no any row is inserted
|
||||
--echo
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
--error ER_DUP_ENTRY
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
SELECT '123', 2;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # Verify it can binlog well when there are some braces('(')
|
||||
--echo
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
(SELECT '123', 3) UNION (SELECT '123', 4);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
REPLACE (SELECT 'abc', 3) UNION (SELECT 'abc', 4);
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
IGNORE (SELECT '123', 3) UNION (SELECT '123', 4);
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--echo
|
||||
--echo # Throw a warning that table already exists and don't insert anything
|
||||
--echo
|
||||
CREATE VIEW t3 AS SELECT * FROM t2;
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS t3
|
||||
SELECT '123', 2;
|
||||
source include/show_binlog_events.inc;
|
||||
DROP VIEW t3;
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # The statement can be binlogged correctly when it is in a SP/EVENT/TRIGGER
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
--enable_warnings
|
||||
eval CREATE PROCEDURE p1(IN a INT)
|
||||
CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT '123', a;
|
||||
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
call p1(500);
|
||||
call p1(600);
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
--echo
|
||||
--echo # The statement can be binlogged correctly when it is in a prepared statement
|
||||
--echo
|
||||
eval PREPARE stm FROM "CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT '123', ?";
|
||||
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
SET @a= 700;
|
||||
EXECUTE stm USING @a;
|
||||
SET @a= 800;
|
||||
EXECUTE stm USING @a;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # The statement can be binlogged correctly when it is in a conditional comment
|
||||
--echo
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo # The whole statement in a conditional comment
|
||||
eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
SELECT 'abc', 900*/;
|
||||
source include/show_binlog_events.inc;
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
--echo # There is an long comment before SELECT
|
||||
eval /*!CREATE $_temporary /*blabla*/ TABLE IF NOT EXISTS t1
|
||||
SELECT 'abc', 901*/;
|
||||
source include/show_binlog_events.inc;
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
--echo # Conditional comment starts just from SELECT
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
/*!SELECT 'abc',*/ 902;
|
||||
source include/show_binlog_events.inc;
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
--echo # Only SELECT keyword is in the conditional comment
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
/*!SELECT*/ /*!'abc',*/ 904;
|
||||
source include/show_binlog_events.inc;
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
--echo # Conditional comment is after SELECT keyword
|
||||
eval CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
SELECT /*!'abc',*/ 903;
|
||||
source include/show_binlog_events.inc;
|
||||
let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
--echo # Conditional comment ends just before SELECT keyword
|
||||
eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1
|
||||
*/SELECT 'abc', 905;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
if (!$is_temporary)
|
||||
{
|
||||
--let $diff_tables= master:t1,slave:t1
|
||||
--source include/diff_tables.inc
|
||||
}
|
||||
|
||||
DROP TABLE t2;
|
||||
eval DROP $_temporary TABLE t1;
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# Auxiliary file which is used to test BUG#56118
|
||||
#
|
||||
# Slave should apply all statements in the transaction before stop if any
|
||||
# temporary table is created or dropped.
|
||||
#
|
||||
# USEAGE:
|
||||
# --let $tmp_table_stm= a SQL statement
|
||||
# --source extra/rpl_tests/rpl_stop_slave.test
|
||||
#
|
||||
|
||||
if (`SELECT "$tmp_table_stm" = ''`)
|
||||
{
|
||||
--echo \$tmp_table_stm is NULL
|
||||
--die $tmp_table_stm is NULL
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo [ On Master ]
|
||||
connection master;
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
eval $tmp_table_stm;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP TEMPORARY TABLE tt1;
|
||||
COMMIT;
|
||||
|
||||
--echo
|
||||
--echo [ On Slave ]
|
||||
connection slave;
|
||||
|
||||
# To check if slave SQL thread is applying INSERT statement
|
||||
let $show_statement= SHOW PROCESSLIST;
|
||||
let $field= Info;
|
||||
let $condition= LIKE 'INSERT%';
|
||||
source include/wait_show_condition.inc;
|
||||
|
||||
send STOP SLAVE SQL_THREAD;
|
||||
|
||||
--echo
|
||||
--echo [ On Slave1 ]
|
||||
connection slave1;
|
||||
--echo # To resume slave SQL thread
|
||||
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
||||
--echo
|
||||
--echo [ On Slave ]
|
||||
connection slave;
|
||||
reap;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
--echo # Slave should stop after the transaction has committed.
|
||||
--echo # So t1 on master is same to t1 on slave.
|
||||
let diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection slave;
|
||||
START SLAVE SQL_THREAD;
|
||||
source include/wait_for_slave_sql_to_start.inc;
|
||||
@@ -0,0 +1,26 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# Bug#7100 relay_log_space_max missing from SHOW VARIABLES
|
||||
#
|
||||
SHOW VARIABLES LIKE 'relay_log_space_limit';
|
||||
|
||||
# Matz says: I have no idea what this is supposed to test, but it has
|
||||
# potential for generating different results with some storage engines
|
||||
# that process rows in an order not dependent on the insertion order.
|
||||
# For instance, I would assume that distributed storage engines (like
|
||||
# NDB) could process rows based on locality.
|
||||
|
||||
eval CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=$engine_type;
|
||||
INSERT INTO t1 SET name='Andy', age=31;
|
||||
INSERT INTO t1 SET name='Jacob', age=2;
|
||||
INSERT INTO t1 SET name='Caleb', age=1;
|
||||
ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,86 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Auxiliary file used by suite/rpl/t/rpl_test_framework.test
|
||||
#
|
||||
# The purpose is to check that the sync chain generated in
|
||||
# rpl_change_topology.inc (invoked from rpl_init.inc) is correct. This
|
||||
# is done in two ways:
|
||||
# (1) Print the sync chain.
|
||||
# (2) Execute a statement and verify that it replicates to all slaves.
|
||||
#
|
||||
#
|
||||
# ==== Implementation ====
|
||||
#
|
||||
# Does this:
|
||||
# (1) Set up a given replication topology (rpl_init.inc)
|
||||
# (2) Print $rpl_sync_chain
|
||||
# (3) Execute "DELETE FROM t1" and then "INSERT INTO t1" on the master
|
||||
# (4) Sync and compare all servers.
|
||||
# (5) Clean up the replication topology (rpl_end.inc)
|
||||
#
|
||||
# (Technical detail: Since DELETE FROM t1 is not executed at the end,
|
||||
# some servers may have rows left in t1 from a previous invocation of
|
||||
# rpl_test_framework.inc. Therefore, this file will only work in
|
||||
# statement mode where "DELETE FROM t1" removes rows that exist on
|
||||
# slave but not on master.)
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --let $rpl_server_count= <number>
|
||||
# --let $rpl_topology= <topology specification>
|
||||
# --let $masters= <list of masters>
|
||||
# [--let $rpl_diff_servers= <list of servers>]
|
||||
# --source extra/rpl_tests/rpl_test_framework.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $next_number
|
||||
# The INSERT statement will insert $next_number into t1, and
|
||||
# $next_number will increase by 1.
|
||||
#
|
||||
# $rpl_server_count, $rpl_topology:
|
||||
# See include/rpl_init.inc
|
||||
#
|
||||
# $masters
|
||||
# This should be a list of numbers, each identifying a server.
|
||||
# The DELETE and INSERT statements will be executed on all servers
|
||||
# in the list.
|
||||
#
|
||||
# $rpl_diff_servers
|
||||
# See include/rpl_diff.inc
|
||||
|
||||
--source include/rpl_init.inc
|
||||
--source include/rpl_generate_sync_chain.inc
|
||||
--echo rpl_sync_chain= '$rpl_sync_chain'
|
||||
|
||||
--inc $next_number
|
||||
|
||||
# Iterate over masters
|
||||
while ($masters)
|
||||
{
|
||||
--let $master_i= `SELECT SUBSTRING_INDEX('$masters', ',', 1)`
|
||||
--let $masters= `SELECT SUBSTRING('$masters', LENGTH('$master_i') + 2)`
|
||||
|
||||
# Connect to master and execute statement
|
||||
--let $rpl_connection_name= server_$master_i
|
||||
--source include/rpl_connection.inc
|
||||
DELETE FROM t1;
|
||||
--eval INSERT INTO t1 VALUES ($next_number)
|
||||
}
|
||||
|
||||
--source include/rpl_sync.inc
|
||||
|
||||
# Compare all servers.
|
||||
--let $diff_tables= server_$rpl_server_count:t1
|
||||
--let $server_i= $rpl_server_count
|
||||
--dec $server_i
|
||||
while ($server_i)
|
||||
{
|
||||
--let $diff_tables= server_$server_i:t1,$diff_tables
|
||||
--dec $server_i
|
||||
}
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--let $diff_servers=
|
||||
--let $masters=
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,159 @@
|
||||
#
|
||||
# This test verify if executing DDL statement before trying to manipulate
|
||||
# a temporary table causes row-based replication to break with error 'table
|
||||
# does not exist'.
|
||||
#
|
||||
|
||||
# CREATE TABLE when a temporary table is open.
|
||||
CREATE TEMPORARY TABLE t1 (a INT);
|
||||
EVAL CREATE TABLE t2 (a INT, b INT) ENGINE= $ENGINE_TYPE;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# CREATE EVENT when a temporary table is open.
|
||||
CREATE EVENT e1 ON SCHEDULE EVERY 10 HOUR DO SELECT 1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# ALTER EVENT when a temporary table is open.
|
||||
ALTER EVENT e1 ON SCHEDULE EVERY 20 HOUR DO SELECT 1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# DROP EVENT when a temporary table is open.
|
||||
DROP EVENT IF EXISTS e1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# CREATE PROCEDURE when a temporary table is open.
|
||||
CREATE PROCEDURE p1() SELECT 1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# Alter PROCEDURE when a temporary table is open.
|
||||
ALTER PROCEDURE p1 SQL SECURITY INVOKER;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# CREATE FUNCTION when a temporary table is open.
|
||||
CREATE FUNCTION f1() RETURNS INT RETURN 123;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# ALTER FUNCTION when a temporary table is open.
|
||||
ALTER FUNCTION f1 SQL SECURITY INVOKER;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# CREATE DATABASE when a temporary table is open.
|
||||
CREATE DATABASE mysqltest1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# DROP DATABASE when a temporary table is open.
|
||||
DROP DATABASE mysqltest1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# CREATE USER when a temporary table is open.
|
||||
CREATE USER test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT select on table to user when a temporary table is open.
|
||||
GRANT SELECT ON t2 TO test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT all on function to user when a temporary table is open.
|
||||
GRANT ALL ON f1 TO test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT all on procedure to user when a temporary table is open.
|
||||
GRANT ALL ON p1 TO test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT usage on *.* to user when a temporary table is open.
|
||||
GRANT USAGE ON *.* TO test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE ALL PRIVILEGES on function to user when a temporary table is open.
|
||||
REVOKE ALL PRIVILEGES ON f1 FROM test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE ALL PRIVILEGES on procedure to user when a temporary table is open.
|
||||
REVOKE ALL PRIVILEGES ON p1 FROM test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE ALL PRIVILEGES on table to user when a temporary table is open.
|
||||
REVOKE ALL PRIVILEGES ON t2 FROM test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE usage on *.* from user when a temporary table is open.
|
||||
REVOKE USAGE ON *.* FROM test_1@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# RENAME USER when a temporary table is open.
|
||||
RENAME USER test_1@localhost TO test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# DROP USER when a temporary table is open.
|
||||
DROP USER test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# Test ACL statement in sub statement
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
# CREATE USER when a temporary table is open.
|
||||
CREATE TEMPORARY TABLE t3 (a INT);
|
||||
CREATE USER test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT select on table to user when a temporary table is open.
|
||||
GRANT SELECT ON t2 TO test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT all on function to user when a temporary table is open.
|
||||
GRANT ALL ON f1 TO test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT all on procedure to user when a temporary table is open.
|
||||
GRANT ALL ON p1 TO test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# GRANT usage on *.* to user when a temporary table is open.
|
||||
GRANT USAGE ON *.* TO test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE ALL PRIVILEGES on function to user when a temporary table is open.
|
||||
REVOKE ALL PRIVILEGES ON f1 FROM test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE ALL PRIVILEGES on procedure to user when a temporary table is open.
|
||||
REVOKE ALL PRIVILEGES ON p1 FROM test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE ALL PRIVILEGES on table to user when a temporary table is open.
|
||||
REVOKE ALL PRIVILEGES ON t2 FROM test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# REVOKE usage on *.* from user when a temporary table is open.
|
||||
REVOKE USAGE ON *.* FROM test_2@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# RENAME USER when a temporary table is open.
|
||||
RENAME USER test_2@localhost TO test_3@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# DROP USER when a temporary table is open.
|
||||
DROP USER test_3@localhost;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP TEMPORARY TABLE t3;
|
||||
END |
|
||||
DELIMITER ;|
|
||||
|
||||
# DROP PROCEDURE when a temporary table is open.
|
||||
DROP PROCEDURE p1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP PROCEDURE p2;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# DROP FUNCTION when a temporary table is open.
|
||||
DROP FUNCTION f1;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
# DROP TABLE when a temporary table is open.
|
||||
DROP TABLE t2;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
DROP TEMPORARY TABLE t1;
|
||||
|
||||
53
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_trig004.test
Normal file
53
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_trig004.test
Normal file
@@ -0,0 +1,53 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: Aug/09/2005 #
|
||||
#############################################################################
|
||||
# TEST: Use after insert and before inset triggers and stored procdures to #
|
||||
# Update and insert data #
|
||||
#############################################################################
|
||||
# Change Auth: JBM #
|
||||
# Date: 2006-02-14 #
|
||||
# Change: Added error, sleep and comments (ndb) #
|
||||
####################################################
|
||||
|
||||
# Begin clean up test section
|
||||
connection master;
|
||||
--disable_warnings
|
||||
--error 0,1360
|
||||
DROP TRIGGER test.t1_bi_t2;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
DROP TABLE IF EXISTS test.t2;
|
||||
|
||||
|
||||
eval CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
|
||||
eval CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=$engine_type;
|
||||
|
||||
|
||||
delimiter //;
|
||||
CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
|
||||
delimiter ;//
|
||||
|
||||
INSERT INTO test.t2 VALUES (1, 0.0);
|
||||
# Expect duplicate error 1022 == ndb
|
||||
--error 1022, ER_DUP_ENTRY
|
||||
INSERT INTO test.t2 VALUES (1, 0.0);
|
||||
|
||||
#show binlog events;
|
||||
select * from test.t1;
|
||||
select * from test.t2;
|
||||
# Have to sleep for a few seconds to allow
|
||||
# NDB injector thread to populate binlog
|
||||
sleep 10;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from test.t1;
|
||||
select * from test.t2;
|
||||
|
||||
connection master;
|
||||
|
||||
DROP TRIGGER test.t1_bi_t2;
|
||||
DROP TABLE test.t1;
|
||||
DROP TABLE test.t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
# End of 5.0 test case
|
||||
13
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_truncate.test
Normal file
13
build/lib/mysql/mysql-test/extra/rpl_tests/rpl_truncate.test
Normal file
@@ -0,0 +1,13 @@
|
||||
# Test to check for the different version of truncating a table.
|
||||
# The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check
|
||||
# the behaviour of each possible value for BINLOG_FORMAT.
|
||||
|
||||
--source include/master-slave.inc
|
||||
|
||||
let $trunc_stmt = TRUNCATE TABLE;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
let $trunc_stmt = DELETE FROM;
|
||||
--source extra/rpl_tests/rpl_truncate_helper.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,33 @@
|
||||
--source include/rpl_reset.inc
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
sync_slave_with_master;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
eval $trunc_stmt t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo ==== Test using a table with delete triggers ====
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
SET @count := 1;
|
||||
eval CREATE TABLE t2 (a INT, b LONG) ENGINE=$engine;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
|
||||
sync_slave_with_master;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
eval $trunc_stmt t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_tables= master:t2, slave:t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1,t2;
|
||||
sync_slave_with_master;
|
||||
Reference in New Issue
Block a user