mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rpl
into pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-maint2 mysql-test/lib/mtr_cases.pm: Auto merged
This commit is contained in:
commit
dfdc6ae897
12 changed files with 1205 additions and 1 deletions
130
mysql-test/include/circular_rpl_for_4_hosts_init.inc
Normal file
130
mysql-test/include/circular_rpl_for_4_hosts_init.inc
Normal file
|
@ -0,0 +1,130 @@
|
|||
#############################################################
|
||||
#
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/11/2008
|
||||
# Purpose: Set up circular replication based on schema
|
||||
# A->B->C->D->A
|
||||
#
|
||||
# Notes:
|
||||
# 1. --slave-num=3 must be added to *-master.opt file
|
||||
# 2. Even the test uses new names for servers but file names
|
||||
# of log files are still old:
|
||||
# master_a -> master.[log|err]
|
||||
# master_b -> slave.[log|err]
|
||||
# master_c -> slave1.[log|err]
|
||||
# master_d -> slave2.[log|err]
|
||||
#
|
||||
#############################################################
|
||||
--source include/master-slave.inc
|
||||
|
||||
#
|
||||
# Set up circular ring by schema A->B->C-D->A
|
||||
#
|
||||
|
||||
--connection slave
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
# master a
|
||||
--connection master
|
||||
--disconnect master
|
||||
connect (master_a,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
RESET MASTER;
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--enable_warnings
|
||||
RESET SLAVE;
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 1;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master b
|
||||
--connection slave
|
||||
--disconnect slave
|
||||
connect (master_b,127.0.0.1,root,,test,$SLAVE_MYPORT,);
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
--replace_result $MASTER_MYPORT MASTER_A_PORT $_binlog_file MASTER_A_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 2;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master c
|
||||
--connection slave1
|
||||
--disconnect slave1
|
||||
connect (master_c,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
|
||||
RESET MASTER;
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--enable_warnings
|
||||
RESET SLAVE;
|
||||
--replace_result $SLAVE_MYPORT MASTER_B_PORT $_binlog_file MASTER_B_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 3;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master d
|
||||
connect (master_d,127.0.0.1,root,,test,$SLAVE_MYPORT2,);
|
||||
RESET MASTER;
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--enable_warnings
|
||||
RESET SLAVE;
|
||||
--replace_result $SLAVE_MYPORT1 MASTER_C_PORT $_binlog_file MASTER_C_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 4;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master a
|
||||
--connection master_a
|
||||
--replace_result $SLAVE_MYPORT2 MASTER_D_PORT $_binlog_file MASTER_D_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT2,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
|
||||
|
||||
|
||||
# Check server_ids: they should be different
|
||||
--connection master_a
|
||||
let $_id_a= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_b
|
||||
let $_id_b= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_c
|
||||
let $_id_c= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_d
|
||||
let $_id_d= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_a
|
||||
let $_compared_ids= (($_id_a <> $_id_b) AND ($_id_a <> $_id_c) AND ($_id_a <> $_id_d) AND ($_id_b <> $_id_c) AND ($_id_b <> $_id_d) AND ($_id_c <> $_id_d)) AS a;
|
||||
let $_compared_ids_result= query_get_value(SELECT $_compared_ids, a, 1);
|
||||
--echo $_compared_ids_result
|
||||
|
||||
# Start ring
|
||||
--connection master_a
|
||||
connect(slave,127.0.0.1,root,,test,$MASTER_MYPORT);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
||||
--connection master_b
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT1);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
||||
--connection master_c
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
||||
--connection master_d
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
23
mysql-test/include/circular_rpl_for_4_hosts_sync.inc
Normal file
23
mysql-test/include/circular_rpl_for_4_hosts_sync.inc
Normal file
|
@ -0,0 +1,23 @@
|
|||
#############################################################
|
||||
#
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/11/2008
|
||||
# Purpose: Sync all hosts for circular replication based on
|
||||
# schema A->B->C->D->A
|
||||
#
|
||||
# Notes: see include/circular_rpl_for_4_hosts_init.inc
|
||||
#
|
||||
#############################################################
|
||||
|
||||
# Make the full loop of sync
|
||||
--connection master_a
|
||||
--disable_query_log
|
||||
--sync_slave_with_master master_b
|
||||
--sync_slave_with_master master_c
|
||||
--sync_slave_with_master master_d
|
||||
--sync_slave_with_master master_a
|
||||
--sync_slave_with_master master_b
|
||||
--sync_slave_with_master master_c
|
||||
--save_master_pos
|
||||
--connection master_a
|
||||
--enable_query_log
|
136
mysql-test/include/ndb_master-slave_2ch.inc
Normal file
136
mysql-test/include/ndb_master-slave_2ch.inc
Normal file
|
@ -0,0 +1,136 @@
|
|||
#############################################################
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/17/2008
|
||||
# Purpose: Set up circular cluster replication where each
|
||||
# cluster has two mysqlds and replication directions are
|
||||
# following:
|
||||
# master ---> slave
|
||||
# / \
|
||||
# cluster A cluster B
|
||||
# \ /
|
||||
# master1 <--- slave1
|
||||
#############################################################
|
||||
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
# Make connections to mysqlds
|
||||
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT1,);
|
||||
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
|
||||
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
|
||||
|
||||
# Check that all mysqld compiled with ndb support
|
||||
|
||||
--connection master
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection master1
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection slave
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection slave1
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
# Stop slaves
|
||||
|
||||
--connection master
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
--connection master1
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
--connection slave
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
--connection slave1
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
# Reset masters
|
||||
|
||||
--connection master
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
--connection master1
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
--connection slave
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
--connection slave1
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
# Start slaves
|
||||
|
||||
--connection slave
|
||||
RESET SLAVE;
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root'
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
--connection master1
|
||||
RESET SLAVE;
|
||||
--replace_result $SLAVE_MYPORT1 SLAVE_MYPORT1
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root'
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
|
||||
# Set the default connection to 'master' (cluster A)
|
||||
connection master;
|
||||
|
|
@ -52,6 +52,7 @@ sub collect_option {
|
|||
}
|
||||
|
||||
use File::Basename;
|
||||
use File::Spec::Functions qw / splitdir /;
|
||||
use IO::File();
|
||||
use My::Config;
|
||||
use My::Platform;
|
||||
|
@ -214,8 +215,12 @@ sub collect_one_suite($)
|
|||
my $suitedir= "$::glob_mysql_test_dir"; # Default
|
||||
if ( $suite ne "main" )
|
||||
{
|
||||
if ( -d $suite ){
|
||||
# Allow suite to be path to "some dir" if $suite has at least
|
||||
# one directory part
|
||||
if ( -d $suite and splitdir($suite) > 1 ){
|
||||
$suitedir= $suite;
|
||||
mtr_report(" - from '$suitedir'");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
298
mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
Normal file
298
mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
Normal file
|
@ -0,0 +1,298 @@
|
|||
*** Set up circular ring by schema A->B->C-D->A ***
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
RESET MASTER;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 1;
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_A_PORT,master_user='root',MASTER_LOG_FILE='MASTER_A_LOG_FILE';
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 2;
|
||||
RESET MASTER;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',MASTER_LOG_FILE='MASTER_B_LOG_FILE';
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 3;
|
||||
RESET MASTER;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',MASTER_LOG_FILE='MASTER_C_LOG_FILE';
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 4;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_D_PORT,master_user='root',MASTER_LOG_FILE='MASTER_D_LOG_FILE';
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
Variable_name Value
|
||||
auto_increment_increment 4
|
||||
auto_increment_offset 1
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
Variable_name Value
|
||||
auto_increment_increment 4
|
||||
auto_increment_offset 2
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
Variable_name Value
|
||||
auto_increment_increment 4
|
||||
auto_increment_offset 3
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
Variable_name Value
|
||||
auto_increment_increment 4
|
||||
auto_increment_offset 4
|
||||
1
|
||||
START SLAVE;
|
||||
START SLAVE;
|
||||
START SLAVE;
|
||||
START SLAVE;
|
||||
|
||||
*** Preparing data ***
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
|
||||
|
||||
*** Testing schema A->B->C->D->A ***
|
||||
|
||||
INSERT INTO t1(b,c) VALUES('A',1);
|
||||
INSERT INTO t1(b,c) VALUES('B',1);
|
||||
INSERT INTO t1(b,c) VALUES('C',1);
|
||||
INSERT INTO t1(b,c) VALUES('D',1);
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
Master A a b
|
||||
Master A 1 A
|
||||
Master A 2 B
|
||||
Master A 3 C
|
||||
Master A 4 D
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
Master B a b
|
||||
Master B 1 A
|
||||
Master B 2 B
|
||||
Master B 3 C
|
||||
Master B 4 D
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
Master C a b
|
||||
Master C 1 A
|
||||
Master C 2 B
|
||||
Master C 3 C
|
||||
Master C 4 D
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
Master D a b
|
||||
Master D 1 A
|
||||
Master D 2 B
|
||||
Master D 3 C
|
||||
Master D 4 D
|
||||
|
||||
*** Testing schema A->B->D->A if C has failure ***
|
||||
|
||||
* Do failure for C and then make new connection B->D *
|
||||
STOP SLAVE;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
START SLAVE;
|
||||
INSERT INTO t1 VALUES(6,'C',2);
|
||||
INSERT INTO t1(b,c) VALUES('B',2);
|
||||
INSERT INTO t1(b,c) VALUES('A',2);
|
||||
INSERT INTO t1(b,c) VALUES('D',2);
|
||||
|
||||
* Data on servers (C failed) *
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master A a b
|
||||
Master A 5 A
|
||||
Master A 8 D
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master B a b
|
||||
Master B 5 A
|
||||
Master B 6 B
|
||||
Master B 8 D
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master C a b
|
||||
Master C 6 C
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master D a b
|
||||
Master D 8 D
|
||||
|
||||
* Reconfigure replication to schema A->B->C->A *
|
||||
STOP SLAVE;
|
||||
STOP SLAVE;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS;
|
||||
START SLAVE;
|
||||
|
||||
* Check data inserted before failure *
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master A a b
|
||||
Master A 5 A
|
||||
Master A 6 B
|
||||
Master A 8 D
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master B a b
|
||||
Master B 5 A
|
||||
Master B 6 B
|
||||
Master B 8 D
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master C a b
|
||||
Master C 6 C
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
Master D a b
|
||||
Master D 5 A
|
||||
Master D 6 B
|
||||
Master D 8 D
|
||||
|
||||
* Check data inserted after failure *
|
||||
INSERT INTO t1(b,c) VALUES('A',3);
|
||||
INSERT INTO t1(b,c) VALUES('B',3);
|
||||
INSERT INTO t1(b,c) VALUES('D',3);
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
Master A a b
|
||||
Master A 9 A
|
||||
Master A 10 B
|
||||
Master A 12 D
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
Master B a b
|
||||
Master B 9 A
|
||||
Master B 10 B
|
||||
Master B 12 D
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
Master C a b
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
Master D a b
|
||||
Master D 9 A
|
||||
Master D 10 B
|
||||
Master D 12 D
|
||||
|
||||
*** Testing restoring scheme A->B->C->D->A after failure ***
|
||||
|
||||
* Remove wrong event from C and restore B->C->D *
|
||||
STOP SLAVE;
|
||||
DELETE FROM t1 WHERE a = 6;
|
||||
START SLAVE;
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS;
|
||||
START SLAVE;
|
||||
|
||||
* Check data inserted before restoring schema A->B->C->D->A *
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
Master A a b
|
||||
Master A 5 A
|
||||
Master A 6 B
|
||||
Master A 8 D
|
||||
Master A 9 A
|
||||
Master A 10 B
|
||||
Master A 12 D
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
Master B a b
|
||||
Master B 5 A
|
||||
Master B 6 B
|
||||
Master B 8 D
|
||||
Master B 9 A
|
||||
Master B 10 B
|
||||
Master B 12 D
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
Master C a b
|
||||
Master C 5 A
|
||||
Master C 6 B
|
||||
Master C 8 D
|
||||
Master C 9 A
|
||||
Master C 10 B
|
||||
Master C 12 D
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
Master D a b
|
||||
Master D 5 A
|
||||
Master D 6 B
|
||||
Master D 8 D
|
||||
Master D 9 A
|
||||
Master D 10 B
|
||||
Master D 12 D
|
||||
|
||||
* Check data inserted after restoring schema A->B->C->D->A *
|
||||
INSERT INTO t1(b,c) VALUES('A',4);
|
||||
INSERT INTO t1(b,c) VALUES('B',4);
|
||||
INSERT INTO t1(b,c) VALUES('C',4);
|
||||
INSERT INTO t1(b,c) VALUES('D',4);
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
Master A a b
|
||||
Master A 13 A
|
||||
Master A 14 B
|
||||
Master A 15 C
|
||||
Master A 16 D
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
Master B a b
|
||||
Master B 13 A
|
||||
Master B 14 B
|
||||
Master B 15 C
|
||||
Master B 16 D
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
Master C a b
|
||||
Master C 13 A
|
||||
Master C 14 B
|
||||
Master C 15 C
|
||||
Master C 16 D
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
Master D a b
|
||||
Master D 13 A
|
||||
Master D 14 B
|
||||
Master D 15 C
|
||||
Master D 16 D
|
||||
|
||||
* Transactions with commits *
|
||||
BEGIN;
|
||||
BEGIN;
|
||||
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
Master A b COUNT(*)
|
||||
Master A A 100
|
||||
Master A B 100
|
||||
Master A C 100
|
||||
Master A D 100
|
||||
SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
Master B b COUNT(*)
|
||||
Master B A 100
|
||||
Master B B 100
|
||||
Master B C 100
|
||||
Master B D 100
|
||||
SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
Master C b COUNT(*)
|
||||
Master C A 100
|
||||
Master C B 100
|
||||
Master C C 100
|
||||
Master C D 100
|
||||
SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
Master D b COUNT(*)
|
||||
Master D A 100
|
||||
Master D B 100
|
||||
Master D C 100
|
||||
Master D D 100
|
||||
|
||||
* Transactions with rollbacks *
|
||||
BEGIN;
|
||||
BEGIN;
|
||||
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
Master A b COUNT(*)
|
||||
Master A B 100
|
||||
Master A D 100
|
||||
SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
Master B b COUNT(*)
|
||||
Master B B 100
|
||||
Master B D 100
|
||||
SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
Master C b COUNT(*)
|
||||
Master C B 100
|
||||
Master C D 100
|
||||
SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
Master D b COUNT(*)
|
||||
Master D B 100
|
||||
Master D D 100
|
||||
|
||||
*** Clean up ***
|
||||
DROP TABLE t1,t2;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
|
@ -0,0 +1 @@
|
|||
--slave-num=3 --log-slave-updates --innodb
|
|
@ -0,0 +1 @@
|
|||
--log-slave-updates --innodb
|
328
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
Normal file
328
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
Normal file
|
@ -0,0 +1,328 @@
|
|||
#############################################################
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/12/2008
|
||||
# Purpose: Testing circular replication based on schema
|
||||
# A->B->C->D->A with using AUTO_INCREMENT_INCREMENT,
|
||||
# AUTO_INCREMENT_OFFSET variables and failover
|
||||
#############################################################
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# Set up circular ring and new names for servers
|
||||
--echo *** Set up circular ring by schema A->B->C->D->A ***
|
||||
--source include/circular_rpl_for_4_hosts_init.inc
|
||||
--echo
|
||||
|
||||
# Preparing data.
|
||||
--echo *** Preparing data ***
|
||||
--connection master_a
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
|
||||
--source include/circular_rpl_for_4_hosts_sync.inc
|
||||
--connection master_d
|
||||
--echo
|
||||
|
||||
#
|
||||
# Testing
|
||||
#
|
||||
|
||||
--echo *** Testing schema A->B->C->D->A ***
|
||||
--echo
|
||||
# insert data via all hosts
|
||||
--connection master_a
|
||||
INSERT INTO t1(b,c) VALUES('A',1);
|
||||
--sync_slave_with_master master_b
|
||||
INSERT INTO t1(b,c) VALUES('B',1);
|
||||
--sync_slave_with_master master_c
|
||||
INSERT INTO t1(b,c) VALUES('C',1);
|
||||
--sync_slave_with_master master_d
|
||||
INSERT INTO t1(b,c) VALUES('D',1);
|
||||
|
||||
--source include/circular_rpl_for_4_hosts_sync.inc
|
||||
|
||||
--connection master_a
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--connection master_b
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--connection master_c
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--connection master_d
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
|
||||
--echo
|
||||
|
||||
--echo *** Testing schema A->B->D->A if C has failure ***
|
||||
--echo
|
||||
--echo * Do failure for C and then make new connection B->D *
|
||||
# Do not replicate next event from C
|
||||
--connection master_d
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
|
||||
STOP SLAVE;
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
disconnect slave;
|
||||
--connection master_c
|
||||
INSERT INTO t1 VALUES(6,'C',2);
|
||||
--save_master_pos
|
||||
--connection master_b
|
||||
INSERT INTO t1(b,c) VALUES('B',2);
|
||||
# Wait while C will stop.
|
||||
--connection master_c
|
||||
--let $slave_param= Slave_SQL_Running
|
||||
--let $slave_param_value= No
|
||||
--source include/wait_for_slave_param.inc
|
||||
--connection master_a
|
||||
INSERT INTO t1(b,c) VALUES('A',2);
|
||||
--connection master_d
|
||||
INSERT INTO t1(b,c) VALUES('D',2);
|
||||
|
||||
|
||||
# Sync all servers except C
|
||||
--connection master_b
|
||||
let $wait_condition= SELECT COUNT(*)=3 FROM t1 WHERE a > 4;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo
|
||||
--echo * Data on servers (C failed) *
|
||||
# Masters C,D shouldn't have correct data
|
||||
--connection master_a
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection master_b
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection master_c
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection master_d
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--echo
|
||||
|
||||
--echo * Reconfigure replication to schema A->B->C->A *
|
||||
# Exclude Master C
|
||||
--connection master_c
|
||||
STOP SLAVE;
|
||||
--let $pos_c= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
|
||||
--let $file_c= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1)
|
||||
--connection master_d
|
||||
STOP SLAVE;
|
||||
--replace_result $SLAVE_MYPORT MASTER_B_PORT $file_c LOG_FILE $pos_c LOG_POS
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
disconnect slave;
|
||||
--connection master_b
|
||||
--sync_slave_with_master master_d
|
||||
--echo
|
||||
|
||||
--echo * Check data inserted before failure *
|
||||
--connection master_a
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection master_b
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection master_c
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--connection master_d
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
|
||||
--echo
|
||||
|
||||
--echo * Check data inserted after failure *
|
||||
--connection master_a
|
||||
INSERT INTO t1(b,c) VALUES('A',3);
|
||||
--connection master_b
|
||||
INSERT INTO t1(b,c) VALUES('B',3);
|
||||
--connection master_d
|
||||
INSERT INTO t1(b,c) VALUES('D',3);
|
||||
--connection master_a
|
||||
|
||||
--sync_slave_with_master master_b
|
||||
--sync_slave_with_master master_d
|
||||
--sync_slave_with_master master_a
|
||||
--sync_slave_with_master master_b
|
||||
|
||||
--connection master_a
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection master_b
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection master_c
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection master_d
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
|
||||
--connection master_a
|
||||
--echo
|
||||
|
||||
--echo *** Testing restoring scheme A->B->C->D->A after failure ***
|
||||
--echo
|
||||
# Master D will ignore a next event from C so that event will not be
|
||||
# distributed to other servers
|
||||
--echo * Remove wrong event from C and restore B->C->D *
|
||||
--connection master_d
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--connection master_c
|
||||
DELETE FROM t1 WHERE a = 6;
|
||||
START SLAVE;
|
||||
--connection master_b
|
||||
--sync_slave_with_master master_c
|
||||
RESET MASTER;
|
||||
--let $file_d= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $pos_d= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--connection master_d
|
||||
RESET SLAVE;
|
||||
--replace_result $SLAVE_MYPORT1 MASTER_C_PORT $file_d LOG_FILE $pos_d LOG_POS
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d
|
||||
START SLAVE;
|
||||
--connection master_c
|
||||
--sync_slave_with_master master_d
|
||||
--source include/circular_rpl_for_4_hosts_sync.inc
|
||||
|
||||
--echo
|
||||
--echo * Check data inserted before restoring schema A->B->C->D->A *
|
||||
--connection master_a
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master master_b
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master master_c
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master master_d
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
|
||||
--sync_slave_with_master master_a
|
||||
--echo
|
||||
|
||||
--echo * Check data inserted after restoring schema A->B->C->D->A *
|
||||
--connection master_a
|
||||
INSERT INTO t1(b,c) VALUES('A',4);
|
||||
--connection master_b
|
||||
INSERT INTO t1(b,c) VALUES('B',4);
|
||||
--connection master_c
|
||||
INSERT INTO t1(b,c) VALUES('C',4);
|
||||
--connection master_d
|
||||
INSERT INTO t1(b,c) VALUES('D',4);
|
||||
--connection master_a
|
||||
|
||||
--source include/circular_rpl_for_4_hosts_sync.inc
|
||||
|
||||
--connection master_a
|
||||
SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection master_b
|
||||
SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection master_c
|
||||
SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection master_d
|
||||
SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
|
||||
--connection master_a
|
||||
--echo
|
||||
|
||||
--echo * Transactions with commits *
|
||||
# Testing mixing of transactions and regular inserts
|
||||
--connection master_a
|
||||
BEGIN;
|
||||
--connection master_c
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection master_a
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection master_a
|
||||
INSERT INTO t2(b,c) VALUES('A',1);
|
||||
--connection master_b
|
||||
INSERT INTO t2(b,c) VALUES('B',1);
|
||||
--connection master_c
|
||||
INSERT INTO t2(b,c) VALUES('C',1);
|
||||
--connection master_d
|
||||
INSERT INTO t2(b,c) VALUES('D',1);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master_a
|
||||
COMMIT;
|
||||
--connection master_c
|
||||
COMMIT;
|
||||
--connection master_a
|
||||
--enable_query_log
|
||||
|
||||
|
||||
--let $wait_condition= SELECT COUNT(*)=400 FROM t2 WHERE c = 1
|
||||
--connection master_a
|
||||
--source include/wait_condition.inc
|
||||
--connection master_b
|
||||
--source include/wait_condition.inc
|
||||
--connection master_c
|
||||
--source include/wait_condition.inc
|
||||
--connection master_d
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--connection master_a
|
||||
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection master_b
|
||||
SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection master_c
|
||||
SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection master_d
|
||||
SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection master_a
|
||||
--echo
|
||||
|
||||
--echo * Transactions with rollbacks *
|
||||
# Testing mixing of transactions with rollback and regular inserts
|
||||
--connection master_a
|
||||
BEGIN;
|
||||
--connection master_c
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection master_a
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection master_a
|
||||
INSERT INTO t2(b,c) VALUES('A',2);
|
||||
--connection master_b
|
||||
INSERT INTO t2(b,c) VALUES('B',2);
|
||||
--connection master_c
|
||||
INSERT INTO t2(b,c) VALUES('C',2);
|
||||
--connection master_d
|
||||
INSERT INTO t2(b,c) VALUES('D',2);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master_a
|
||||
ROLLBACK;
|
||||
--connection master_c
|
||||
ROLLBACK;
|
||||
--connection master_a
|
||||
--enable_query_log
|
||||
|
||||
--let $wait_condition= SELECT COUNT(*)=200 FROM t2 WHERE c = 2
|
||||
--connection master_a
|
||||
--source include/wait_condition.inc
|
||||
--connection master_b
|
||||
--source include/wait_condition.inc
|
||||
--connection master_c
|
||||
--source include/wait_condition.inc
|
||||
--connection master_d
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--connection master_a
|
||||
SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection master_b
|
||||
SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection master_c
|
||||
SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection master_d
|
||||
SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection master_a
|
||||
|
||||
--echo
|
||||
|
||||
# Clean up
|
||||
--echo *** Clean up ***
|
||||
--connection master_a
|
||||
DROP TABLE t1,t2;
|
||||
--source include/circular_rpl_for_4_hosts_sync.inc
|
||||
|
||||
--connection master_a
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
--connection master_b
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
--connection master_c
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
--connection master_d
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
101
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result
Normal file
101
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result
Normal file
|
@ -0,0 +1,101 @@
|
|||
STOP SLAVE;
|
||||
STOP SLAVE;
|
||||
STOP SLAVE;
|
||||
STOP SLAVE;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
RESET MASTER;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
RESET MASTER;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
RESET MASTER;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_MYPORT,master_user='root';
|
||||
START SLAVE;
|
||||
RESET SLAVE;
|
||||
CHANGE MASTER TO master_host='127.0.0.1',master_port=SLAVE_MYPORT1,master_user='root';
|
||||
START SLAVE;
|
||||
|
||||
*** Check server_id of mysqld servers ***
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
Variable_name Value
|
||||
server_id 1
|
||||
SET auto_increment_offset = 1;
|
||||
SET auto_increment_increment = 2;
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
Variable_name Value
|
||||
server_id 1
|
||||
SET auto_increment_offset = 1;
|
||||
SET auto_increment_increment = 2;
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
Variable_name Value
|
||||
server_id 2
|
||||
SET auto_increment_offset = 2;
|
||||
SET auto_increment_increment = 2;
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
Variable_name Value
|
||||
server_id 2
|
||||
SET auto_increment_offset = 2;
|
||||
SET auto_increment_increment = 2;
|
||||
|
||||
*** Preparing data ***
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb;
|
||||
|
||||
*** Basic testing ***
|
||||
Insert rows via all hosts
|
||||
Check data on both clusters
|
||||
* Cluster A *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
COUNT(*) SUM(a) b
|
||||
10 190 master
|
||||
10 210 master1
|
||||
10 200 slave
|
||||
10 220 slave1
|
||||
* Cluster B *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
COUNT(*) SUM(a) b
|
||||
10 190 master
|
||||
10 210 master1
|
||||
10 200 slave
|
||||
10 220 slave1
|
||||
|
||||
*** Transaction testing ***
|
||||
BEGIN;
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
Check data on both clusters
|
||||
* Cluster A *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
COUNT(*) SUM(a) b
|
||||
100 23900 master
|
||||
100 24100 master1
|
||||
100 24000 slave
|
||||
100 24200 slave1
|
||||
* Cluster B *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
COUNT(*) SUM(a) b
|
||||
100 23900 master
|
||||
100 24100 master1
|
||||
100 24000 slave
|
||||
100 24200 slave1
|
||||
|
||||
BEGIN;
|
||||
BEGIN;
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
Check data on both clusters
|
||||
* Cluster A *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
|
||||
COUNT(*) SUM(a) b
|
||||
100 64100 master1
|
||||
100 64000 slave
|
||||
* Cluster B *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
|
||||
COUNT(*) SUM(a) b
|
||||
100 64100 master1
|
||||
100 64000 slave
|
||||
|
||||
DELETE FROM t1;
|
||||
|
|
@ -0,0 +1 @@
|
|||
--slave-num=2 --server-id=1 --log-bin -log-slave-updates
|
|
@ -0,0 +1 @@
|
|||
--server-id=2 --log-bin --log-slave-updates --skip-slave-start
|
179
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test
Normal file
179
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test
Normal file
|
@ -0,0 +1,179 @@
|
|||
#############################################################
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/17/2008
|
||||
# Purpose: Testing cluster circular replication based on two
|
||||
# independent channels between two clusters
|
||||
#############################################################
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave_2ch.inc
|
||||
--echo
|
||||
|
||||
# Check server_id and set auto_increment_* variables
|
||||
--echo *** Check server_id of mysqld servers ***
|
||||
--connection master
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 1;
|
||||
SET auto_increment_increment = 2;
|
||||
--connection master1
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 1;
|
||||
SET auto_increment_increment = 2;
|
||||
--connection slave
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 2;
|
||||
SET auto_increment_increment = 2;
|
||||
--connection slave1
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 2;
|
||||
SET auto_increment_increment = 2;
|
||||
--echo
|
||||
|
||||
# Preparing data.
|
||||
--echo *** Preparing data ***
|
||||
--connection master
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb;
|
||||
|
||||
let $wait_binlog_event= CREATE TABLE t1;
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--connection master1
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--connection slave
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--connection slave1
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--echo
|
||||
|
||||
#
|
||||
# Testing
|
||||
#
|
||||
|
||||
--echo *** Basic testing ***
|
||||
# insert data via all hosts
|
||||
--echo Insert rows via all hosts
|
||||
--disable_query_log
|
||||
let $counter= 10;
|
||||
while ($counter) {
|
||||
--connection master
|
||||
INSERT INTO t1(b,c) VALUES('master',1);
|
||||
--connection master1
|
||||
INSERT INTO t1(b,c) VALUES('master1',1);
|
||||
--connection slave
|
||||
INSERT INTO t1(b,c) VALUES('slave',1);
|
||||
--connection slave1
|
||||
INSERT INTO t1(b,c) VALUES('slave1',1);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master
|
||||
--enable_query_log
|
||||
|
||||
# Wait replication between clusters
|
||||
let $wait_condition= SELECT COUNT(*)=40 FROM t1 WHERE c = 1;
|
||||
--source include/wait_condition.inc
|
||||
--connection slave
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# Check data
|
||||
--echo Check data on both clusters
|
||||
--connection master
|
||||
--echo * Cluster A *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--connection slave
|
||||
--echo * Cluster B *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
|
||||
--echo
|
||||
|
||||
--echo *** Transaction testing ***
|
||||
# Start transaction for one mysqld and do mass of inserts for other.
|
||||
# Do it for for both clusters
|
||||
|
||||
--connection master
|
||||
BEGIN;
|
||||
--connection slave1
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection master
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection master
|
||||
INSERT INTO t1(b,c) VALUES('master',2);
|
||||
--connection master1
|
||||
INSERT INTO t1(b,c) VALUES('master1',2);
|
||||
--connection slave
|
||||
INSERT INTO t1(b,c) VALUES('slave',2);
|
||||
--connection slave1
|
||||
INSERT INTO t1(b,c) VALUES('slave1',2);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
--connection slave1
|
||||
COMMIT;
|
||||
|
||||
# Wait replication between clusters
|
||||
--connection master
|
||||
let $wait_condition= SELECT COUNT(*)=400 FROM t1 WHERE c = 2;
|
||||
--source include/wait_condition.inc
|
||||
--connection slave
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo Check data on both clusters
|
||||
--connection master
|
||||
--echo * Cluster A *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--connection slave
|
||||
--echo * Cluster B *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
|
||||
--echo
|
||||
|
||||
# Start transaction and then roll back
|
||||
|
||||
--connection master
|
||||
BEGIN;
|
||||
--connection slave1
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection master
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection master
|
||||
INSERT INTO t1(b,c) VALUES('master',3);
|
||||
--connection master1
|
||||
INSERT INTO t1(b,c) VALUES('master1',3);
|
||||
--connection slave
|
||||
INSERT INTO t1(b,c) VALUES('slave',3);
|
||||
--connection slave1
|
||||
INSERT INTO t1(b,c) VALUES('slave1',3);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master
|
||||
--enable_query_log
|
||||
ROLLBACK;
|
||||
--connection slave1
|
||||
ROLLBACK;
|
||||
|
||||
# Wait replication between clusters
|
||||
--connection master
|
||||
let $wait_condition= SELECT COUNT(*)=200 FROM t1 WHERE c = 3;
|
||||
--source include/wait_condition.inc
|
||||
--connection slave
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo Check data on both clusters
|
||||
--connection master
|
||||
--echo * Cluster A *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
|
||||
--connection slave
|
||||
--echo * Cluster B *
|
||||
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
|
||||
--echo
|
||||
|
||||
# Clean up
|
||||
--connection master
|
||||
DELETE FROM t1;
|
||||
--connection slave
|
||||
let $wait_condition= SELECT COUNT(*)=0 FROM t1;
|
||||
--source include/wait_condition.inc
|
||||
--echo
|
||||
|
||||
# End of test 5.1
|
Loading…
Reference in a new issue