mariadb/mysql-test/suite/rpl/include/rpl_row_img.test
Michael Widenius 39018f2a5a Move mysql-test-run/extra/rpl_tests to suite/rpl/include
Renamed suite/rpl/include/rpl_sync.inc to rpl_sync_test.inc to
remove clash with include/rpl_sync.inc
2018-03-29 13:59:44 +03:00

241 lines
8.2 KiB
Text

# WL#5096
#
# Description
# ===========
#
# This test case checks replication between hosts with same index
# structure but may differ on engines.
#
# Usage
# =====
#
# Before including this file the following variables should be set:
# * $server_1_engine
# * $server_2_engine
# * $server_3_engine
#
# Example:
#
# -- let $server_1_engine= Falcon
# -- let $server_2_engine= MyISAM
# -- let $server_3_engine= InnoDB
#
# -- source suite/rpl/include/rpl_row_img.test
#
-- connection server_1
-- let $diff_table=test.t
let $i= 12;
while($i)
{
let $step= "";
-- connection server_1
SET SQL_LOG_BIN=0;
-- connection server_2
SET SQL_LOG_BIN=0;
-- connection server_3
SET SQL_LOG_BIN=0;
if ($i == 1) {
let $step= No keys;
--echo ******* TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_3_engine;
}
if ($i == 2)
{
let $step= One key;
--echo ******* TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_3_engine;
}
if ($i == 3)
{
let $step= One Composite key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_3_engine;
}
if ($i == 4)
{
let $step= One Unique key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_3_engine;
}
if ($i == 5)
{
let $step= One Composite Unique key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_3_engine;
}
if ($i == 6)
{
let $step= One Primary key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_3_engine;
}
if ($i == 7)
{
let $step= One Composite Primary Key;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_3_engine;
}
if ($i == 8)
{
let $step= One Composite key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_3_engine;
}
if ($i == 9)
{
let $step= One Composite Unique key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
}
if ($i == 10)
{
let $step= One Composite Primary Key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_3_engine;
}
if ($i == 11)
{
let $step= One Composite NOT NULL Unique key with holes;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
}
if ($i == 12)
{
let $step= One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave;
--echo ****** TEST: $step
-- connection server_1
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
}
-- connection server_1
SET SQL_LOG_BIN=1;
-- connection server_2
SET SQL_LOG_BIN=1;
-- connection server_3
SET SQL_LOG_BIN=1;
-- connection server_1
INSERT INTO t VALUES (1, '1', '1', '1' );
INSERT INTO t VALUES (4, '4', '4', '4' );
INSERT INTO t VALUES (7, '7', '7', '7' );
INSERT INTO t VALUES (9, '9', '9', NULL );
INSERT INTO t VALUES (2, '1', '2', '2' );
INSERT INTO t VALUES (3, '1', '3', '2' );
-- source include/rpl_sync.inc
-- connection server_1
UPDATE t SET c4 = '7';
UPDATE t SET c4 = '5' WHERE c1 = 1;
UPDATE t SET c2 = '5' WHERE c1 = 1;
UPDATE t SET c1 = '5' WHERE c1 = 1;
UPDATE t SET c4 = '8' WHERE c2 = '4';
UPDATE t SET c1 = '8' WHERE c2 = '4';
UPDATE t SET c2 = '8' WHERE c2 = '4';
UPDATE t SET c3 = '0' WHERE c4 = NULL;
UPDATE t SET c2 = '0' WHERE c4 = '0';
UPDATE t SET c2 = '2' WHERE c4 = '2';
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
DELETE FROM t WHERE c1 = 7;
DELETE FROM t WHERE c1 = 8;
DELETE FROM t;
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
DROP TABLE t;
-- source include/rpl_sync.inc
dec $i;
}