List:Commits« Previous MessageNext Message »
From:Serge Kozlov Date:April 15 2007 11:12pm
Subject:bk commit into 5.1 tree (skozlov:1.2535)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of ksm. When ksm does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-04-16 01:12:10+04:00, skozlov@stripped +3 -0
  WL#3754 REP: Circular - Multi Master Replication

  mysql-test/lib/mtr_cases.pl@stripped, 2007-04-16 01:11:32+04:00, skozlov@stripped +14 -3
    Added support 2 or 3 slave servers via --slave-num option in *-slave.opt file

  mysql-test/r/rpl_circular.result@stripped, 2007-04-16 01:11:32+04:00, skozlov@stripped +261
-0
    Result file for rpl_circular.test

  mysql-test/r/rpl_circular.result@stripped, 2007-04-16 01:11:32+04:00, skozlov@stripped +0 -0

  mysql-test/t/rpl_circular.test@stripped, 2007-04-16 01:11:43+04:00, skozlov@stripped +247 -0
    WL#3754 Test for circular replcation for 3 servers by scheme A->B->C->A with
fail-over for B

  mysql-test/t/rpl_circular.test@stripped, 2007-04-16 01:11:43+04:00, skozlov@stripped +0 -0

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	skozlov
# Host:	virtop.localdomain
# Root:	/home/ksm/commits/mysql-5.1-telco

--- 1.55/mysql-test/lib/mtr_cases.pl	2007-04-16 01:12:34 +04:00
+++ 1.56/mysql-test/lib/mtr_cases.pl	2007-04-16 01:12:34 +04:00
@@ -394,10 +394,21 @@
     foreach my $opt ( @$slave_opt )
     {
       # If we set default time zone, remove the one we have
-      my $value= mtr_match_prefix($opt, "--default-time-zone=");
-      $tinfo->{'slave_opt'}= [] if defined $value;
+      my $value;
+#      $value= mtr_match_prefix($opt, "--default-time-zone=");
+#      if ( defined $value )
+#      {
+#	next;
+#      }
+      # Define number of slaves
+      $value= mtr_match_prefix($opt, "--slave-num=");
+      if ( defined $value )
+      {
+	$tinfo->{'slave_num'}= $value;
+	next;
+      }
+      push(@{$tinfo->{'slave_opt'}}, $opt);
     }
-    push(@{$tinfo->{'slave_opt'}}, @$slave_opt);
   }
 
   if ( -f $slave_mi_file )
--- New file ---
+++ mysql-test/r/rpl_circular.result	07/04/16 01:11:32
server_a
USE test;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
STOP SLAVE;
RESET MASTER;
CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT2;
server_b
USE test;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
STOP SLAVE;
RESET MASTER;
CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT;
server_c
USE test;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
STOP SLAVE;
RESET MASTER;
CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT1;
server_a
START SLAVE;
server_b
START SLAVE;
server_c
START SLAVE;

server_a
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=myisam;
INSERT INTO t1 VALUES (1,1,'');
INSERT INTO t1 VALUES (11,11,UUID());
server_b
INSERT INTO t1 VALUES (2,2,'');
INSERT INTO t1 VALUES (12,12,UUID());
server_c
INSERT INTO t1 VALUES (3,3,'');
INSERT INTO t1 VALUES (13,13,UUID());
UPDATE t1 SET c='A->B->C->A';
server_a
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A

STOP SLAVE;
server_a
INSERT INTO t1 VALUES (100,100,'A->C->A');
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
100	100	A->C->A
server_b
server_c
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
STOP SLAVE;
CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT, MASTER_LOG_FILE = MASTER_LOG_FILE;
START SLAVE;
server_a
server_c
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
100	100	A->C->A
server_a
INSERT INTO t1 VALUES (101,101,'A->C->A');
server_c
INSERT INTO t1 VALUES (103,103,'A->C->A');
server_a
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
100	100	A->C->A
101	101	A->C->A
103	103	A->C->A
server_b
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
server_c
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
100	100	A->C->A
101	101	A->C->A
103	103	A->C->A

server_c
STOP SLAVE;
server_b
START SLAVE;
server_a
server_c
CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT1, MASTER_LOG_FILE = MASTER_LOG_FILE;
START SLAVE;
server_b
server_c
server_a
INSERT INTO t1 VALUES(201,201,'A->B->C->A');
server_b
INSERT INTO t1 VALUES(202,202,'A->B->C->A');
server_c
INSERT INTO t1 VALUES(203,203,'A->B->C->A');
server_a
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
100	100	A->C->A
101	101	A->C->A
103	103	A->C->A
201	201	A->B->C->A
202	202	A->B->C->A
203	203	A->B->C->A
server_b
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
100	100	A->C->A
101	101	A->C->A
103	103	A->C->A
201	201	A->B->C->A
202	202	A->B->C->A
203	203	A->B->C->A
server_c
SELECT * FROM t1 ORDER BY a;
a	b	c
1	1	A->B->C->A
2	2	A->B->C->A
3	3	A->B->C->A
11	11	A->B->C->A
12	12	A->B->C->A
13	13	A->B->C->A
100	100	A->C->A
101	101	A->C->A
103	103	A->C->A
201	201	A->B->C->A
202	202	A->B->C->A
203	203	A->B->C->A
server_a
SHOW BINLOG EVENTS;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
slave-bin.000001	4	Format_desc	2	106	Server ver: SERVER VERSION
slave-bin.000001	106	Query	2	249	use `test`; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY,
b INT, c VARCHAR(64)) ENGINE=myisam
slave-bin.000001	249	Query	2	342	use `test`; INSERT INTO t1 VALUES (1,1,'')
slave-bin.000001	342	Table_map	2	383	table_id # (test.t1)
slave-bin.000001	383	Write_rows	2	458	table_id # flags: STMT_END_F
slave-bin.000001	458	Query	3	551	use `test`; INSERT INTO t1 VALUES (2,2,'')
slave-bin.000001	551	Table_map	3	592	table_id # (test.t1)
slave-bin.000001	592	Write_rows	3	667	table_id # flags: STMT_END_F
slave-bin.000001	667	Query	4	760	use `test`; INSERT INTO t1 VALUES (3,3,'')
slave-bin.000001	760	Table_map	4	801	table_id # (test.t1)
slave-bin.000001	801	Write_rows	4	876	table_id # flags: STMT_END_F
slave-bin.000001	876	Query	4	967	use `test`; UPDATE t1 SET c='A->B->C->A'
slave-bin.000001	967	Query	2	1071	use `test`; INSERT INTO t1 VALUES
(100,100,'A->C->A')
slave-bin.000001	1071	Query	2	1175	use `test`; INSERT INTO t1 VALUES
(101,101,'A->C->A')
slave-bin.000001	1175	Query	4	1279	use `test`; INSERT INTO t1 VALUES
(103,103,'A->C->A')
slave-bin.000001	1279	Query	2	1385	use `test`; INSERT INTO t1
VALUES(201,201,'A->B->C->A')
slave-bin.000001	1385	Query	3	1491	use `test`; INSERT INTO t1
VALUES(202,202,'A->B->C->A')
slave-bin.000001	1491	Query	4	1597	use `test`; INSERT INTO t1
VALUES(203,203,'A->B->C->A')
server_b
SHOW BINLOG EVENTS;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
slave1-bin.000001	4	Format_desc	3	106	Server ver: SERVER VERSION
slave1-bin.000001	106	Query	2	249	use `test`; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY,
b INT, c VARCHAR(64)) ENGINE=myisam
slave1-bin.000001	249	Query	2	342	use `test`; INSERT INTO t1 VALUES (1,1,'')
slave1-bin.000001	342	Table_map	2	383	table_id # (test.t1)
slave1-bin.000001	383	Write_rows	2	458	table_id # flags: STMT_END_F
slave1-bin.000001	458	Query	3	551	use `test`; INSERT INTO t1 VALUES (2,2,'')
slave1-bin.000001	551	Table_map	3	592	table_id # (test.t1)
slave1-bin.000001	592	Write_rows	3	667	table_id # flags: STMT_END_F
slave1-bin.000001	667	Query	4	760	use `test`; INSERT INTO t1 VALUES (3,3,'')
slave1-bin.000001	760	Table_map	4	801	table_id # (test.t1)
slave1-bin.000001	801	Write_rows	4	876	table_id # flags: STMT_END_F
slave1-bin.000001	876	Query	4	967	use `test`; UPDATE t1 SET c='A->B->C->A'
slave1-bin.000001	967	Query	2	1071	use `test`; INSERT INTO t1 VALUES
(100,100,'A->C->A')
slave1-bin.000001	1071	Query	2	1175	use `test`; INSERT INTO t1 VALUES
(101,101,'A->C->A')
slave1-bin.000001	1175	Query	4	1279	use `test`; INSERT INTO t1 VALUES
(103,103,'A->C->A')
slave1-bin.000001	1279	Query	2	1385	use `test`; INSERT INTO t1
VALUES(201,201,'A->B->C->A')
slave1-bin.000001	1385	Query	3	1491	use `test`; INSERT INTO t1
VALUES(202,202,'A->B->C->A')
slave1-bin.000001	1491	Query	4	1597	use `test`; INSERT INTO t1
VALUES(203,203,'A->B->C->A')
server_c
SHOW BINLOG EVENTS;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
slave2-bin.000001	4	Format_desc	4	106	Server ver: SERVER VERSION
slave2-bin.000001	106	Query	2	249	use `test`; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY,
b INT, c VARCHAR(64)) ENGINE=myisam
slave2-bin.000001	249	Query	2	342	use `test`; INSERT INTO t1 VALUES (1,1,'')
slave2-bin.000001	342	Table_map	2	383	table_id # (test.t1)
slave2-bin.000001	383	Write_rows	2	458	table_id # flags: STMT_END_F
slave2-bin.000001	458	Query	3	551	use `test`; INSERT INTO t1 VALUES (2,2,'')
slave2-bin.000001	551	Table_map	3	592	table_id # (test.t1)
slave2-bin.000001	592	Write_rows	3	667	table_id # flags: STMT_END_F
slave2-bin.000001	667	Query	4	760	use `test`; INSERT INTO t1 VALUES (3,3,'')
slave2-bin.000001	760	Table_map	4	801	table_id # (test.t1)
slave2-bin.000001	801	Write_rows	4	876	table_id # flags: STMT_END_F
slave2-bin.000001	876	Query	4	967	use `test`; UPDATE t1 SET c='A->B->C->A'
slave2-bin.000001	967	Query	2	1071	use `test`; INSERT INTO t1 VALUES
(100,100,'A->C->A')
slave2-bin.000001	1071	Query	2	1175	use `test`; INSERT INTO t1 VALUES
(101,101,'A->C->A')
slave2-bin.000001	1175	Query	4	1279	use `test`; INSERT INTO t1 VALUES
(103,103,'A->C->A')
slave2-bin.000001	1279	Query	2	1385	use `test`; INSERT INTO t1
VALUES(201,201,'A->B->C->A')
slave2-bin.000001	1385	Query	3	1491	use `test`; INSERT INTO t1
VALUES(202,202,'A->B->C->A')
slave2-bin.000001	1491	Query	4	1597	use `test`; INSERT INTO t1
VALUES(203,203,'A->B->C->A')
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;

--- New file ---
+++ mysql-test/t/rpl_circular.test	07/04/16 01:11:43
#########################################
# Author:  Serge Kozlov skozlov@stripped
# Date:    04/12/2007
# Purpose: Testing circular replication
#          for scheme A->B->C->A and
#          fail-over
#########################################

--source include/have_innodb.inc

# Create connections to three slave servers
connect (server_a,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (server_b,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
connect (server_c,127.0.0.1,root,,test,$SLAVE_MYPORT2,);

#
# Create circular replication by scheme
# server_a->server_b->server_c->server_a
#

--disable_warnings

# make server_a as slave for server_c and clean up
--connection server_a
--echo server_a
USE test;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
STOP SLAVE;
RESET MASTER;
--echo CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT2;
--disable_query_log
eval CHANGE MASTER TO MASTER_PORT = $SLAVE_MYPORT2;
--enable_query_log

# make server_b as slave for server_a and clean up
--connection server_b
--echo server_b
USE test;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
STOP SLAVE;
RESET MASTER;
--echo CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT;
--disable_query_log
eval CHANGE MASTER TO MASTER_PORT = $SLAVE_MYPORT;
--enable_query_log

# make server_c as slave for server_b and clean up
--connection server_c
--echo server_c
USE test;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
STOP SLAVE;
RESET MASTER;
--echo CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT1;
--disable_query_log
eval CHANGE MASTER TO MASTER_PORT = $SLAVE_MYPORT1;
--enable_query_log

# start server_a
--connection server_a
--echo server_a
START SLAVE;

# start server_b
--connection server_b
--echo server_b
START SLAVE;

# start server_c
--connection server_c
--echo server_c
START SLAVE;

--enable_warnings

# Circular replication for 3 servers is ready
--echo

#
# Simply test for testing of circular replication
#

--connection server_a
--echo server_a
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=myisam;
# put rows on server_a
INSERT INTO t1 VALUES (1,1,'');
INSERT INTO t1 VALUES (11,11,UUID());
--sync_slave_with_master server_b
--echo server_b
# put rows on server_b
INSERT INTO t1 VALUES (2,2,'');
INSERT INTO t1 VALUES (12,12,UUID());
--sync_slave_with_master server_c
--echo server_c
# put rows on server_c
INSERT INTO t1 VALUES (3,3,'');
INSERT INTO t1 VALUES (13,13,UUID());
UPDATE t1 SET c='A->B->C->A';
--sync_slave_with_master server_a
--sync_slave_with_master server_b
--sync_slave_with_master server_c
--sync_slave_with_master server_a
# make sure that all rows replicated correctly
--echo server_a
# make sure that all rows replicated correctly
SELECT * FROM t1 ORDER BY a;
--connection server_b
SELECT * FROM t1 ORDER BY a;
--connection server_c
SELECT * FROM t1 ORDER BY a;

--echo
#
# Testing fail-over:
# Stop server_b and make new replication scheme
# server_a->server_c->server_a
#

# stop server_b
--connection server_b
STOP SLAVE;

--connection server_a
--echo server_a
INSERT INTO t1 VALUES (100,100,'A->C->A');
SELECT * FROM t1 ORDER BY a;
--connection server_b
--echo server_b
--sync_slave_with_master server_c
--echo server_c
SELECT * FROM t1 ORDER BY a;
STOP SLAVE;
--echo CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT, MASTER_LOG_FILE = MASTER_LOG_FILE;
--disable_query_log
eval CHANGE MASTER TO MASTER_PORT = $SLAVE_MYPORT, MASTER_LOG_FILE = 'slave-bin.000001';
--enable_query_log
START SLAVE;
--connection server_a
--echo server_a
--sync_slave_with_master server_c
--echo server_c
SELECT * FROM t1 ORDER BY a;

--connection server_a
--echo server_a
INSERT INTO t1 VALUES (101,101,'A->C->A');
--sync_slave_with_master server_c
# put row on server_c
--echo server_c
INSERT INTO t1 VALUES (103,103,'A->C->A');
--sync_slave_with_master server_a
--sync_slave_with_master server_c
--sync_slave_with_master server_a
# make sure that all rows replicated correctly
--echo server_a
SELECT * FROM t1 ORDER BY a;
# but server server_b shouldn't have some rows
--connection server_b
--echo server_b
SELECT * FROM t1 ORDER BY a;
--connection server_c
--echo server_c
SELECT * FROM t1 ORDER BY a;

--echo

#
# Testing fail-over:
# Start server_b and restore replication scheme
# server_a->server_b->server_c->server_a
#

--connection server_a
--sync_slave_with_master server_c
--echo server_c
STOP SLAVE;
--connection server_b
--echo server_b
START SLAVE;
--connection server_a
--echo server_a
--sync_slave_with_master server_b
--connection server_c
--echo server_c
--echo CHANGE MASTER TO MASTER_PORT = SLAVE_MYPORT1, MASTER_LOG_FILE = MASTER_LOG_FILE;
--disable_query_log
eval CHANGE MASTER TO MASTER_PORT = $SLAVE_MYPORT1, MASTER_LOG_FILE = 'slave1-bin.000001';
--enable_query_log
START SLAVE;
--connection server_b
--echo server_b
--sync_slave_with_master server_c
--echo server_c

--connection server_a
--echo server_a
INSERT INTO t1 VALUES(201,201,'A->B->C->A');
--sync_slave_with_master server_b
--echo server_b
INSERT INTO t1 VALUES(202,202,'A->B->C->A');
--sync_slave_with_master server_c
--echo server_c
INSERT INTO t1 VALUES(203,203,'A->B->C->A');
--sync_slave_with_master server_a
--sync_slave_with_master server_b
--sync_slave_with_master server_c
--sync_slave_with_master server_a
--echo server_a
SELECT * FROM t1 ORDER BY a;
--connection server_b
--echo server_b
SELECT * FROM t1 ORDER BY a;
--connection server_c
--echo server_c
SELECT * FROM t1 ORDER BY a;


#
# Check binlog for all servers
#

--connection server_a
--echo server_a
--replace_regex /table_id: [0-9]+/table_id #/ /Server ver:.+/Server ver: SERVER VERSION/
SHOW BINLOG EVENTS;

--connection server_b
--echo server_b
--replace_regex /table_id: [0-9]+/table_id #/ /Server ver:.+/Server ver: SERVER VERSION/
SHOW BINLOG EVENTS;

--connection server_c
--echo server_c
--replace_regex /table_id: [0-9]+/table_id #/ /Server ver:.+/Server ver: SERVER VERSION/
SHOW BINLOG EVENTS;


#
# Clean up
#

--disable_warnings
--connection server_a
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
--enable_warnings


Thread
bk commit into 5.1 tree (skozlov:1.2535)Serge Kozlov15 Apr