MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Martin Skold Date:May 6 2010 12:28pm
Subject:bzr commit into mysql-5.1-telco-7.0 branch (Martin.Skold:3525) Bug#52859
View as plain text  
#At file:///home/marty/MySQL/mysql-5.1-telco-7.0/

 3525 Martin Skold	2010-05-06 [merge]
      Merge
      added:
        mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_restart.result
        mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_restart.test
      modified:
        sql/rpl_mi.cc

=== added file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_restart.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_restart.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_slave_restart.result	2010-05-06 12:17:56 +0000
@@ -0,0 +1,71 @@
+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;
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+CREATE TABLE t2 (a int key) ENGINE = NDB ;
+reset master;
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+c1	c2	c3
+row1	will go away	1
+SELECT * FROM t1 ORDER BY c3;
+c1	c2	c3
+row1	will go away	1
+SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
+@the_epoch:=MAX(epoch)
+<the_epoch>
+SELECT * FROM t1 ORDER BY c3;
+c1	c2	c3
+row1	will go away	1
+stop slave;
+set SQL_LOG_BIN=0;
+insert into t2 values (1);
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	3	#	BEGIN
+master-bin.000001	#	Table_map	3	#	table_id: # (test.t1)
+master-bin.000001	#	Table_map	3	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	3	#	table_id: #
+master-bin.000001	#	Write_rows	3	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	3	#	COMMIT
+set SQL_LOG_BIN=1;
+SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
+@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+107	master-bin.000001
+CHANGE MASTER TO
+master_port=<MASTER_PORT1>,
+master_log_file = 'master-bin.000001',
+master_log_pos = 107 ;
+start slave;
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+SELECT * FROM t1 ORDER BY c3;
+c1	c2	c3
+row3	C	3
+row4	D	4
+INSERT INTO t1 VALUES ("row5","E",5);
+SELECT * FROM t1 ORDER BY c3;
+c1	c2	c3
+row3	C	3
+row4	D	4
+row5	E	5
+SELECT * FROM t1 ORDER BY c3;
+c1	c2	c3
+row3	C	3
+row4	D	4
+row5	E	5
+==== clean up ====
+DROP TABLE t1;
+DROP TABLE t2;
+STOP SLAVE;

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_restart.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_restart.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_slave_restart.test	2010-05-06 12:17:56 +0000
@@ -0,0 +1,86 @@
+--source include/have_multi_ndb.inc
+--source include/have_binlog_format_mixed_or_row.inc
+--source include/ndb_master-slave.inc
+
+# note: server2 is another "master" connected to the master cluster
+
+#
+# Currently test only works with ndb since it retrieves "old"
+# binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
+#
+
+# create a table with one row, and make sure the other "master" gets it
+CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
+# a dummy table such that we can make sure data gets into binlog on server2
+CREATE TABLE t2 (a int key) ENGINE = NDB ;
+connection server2;
+reset master;
+SHOW TABLES;
+connection master;
+INSERT INTO t1 VALUES ("row1","will go away",1);
+SELECT * FROM t1 ORDER BY c3;
+connection server2;
+SELECT * FROM t1 ORDER BY c3;
+
+# sync slave and retrieve epoch and stop the slave
+connection master;
+sync_slave_with_master;
+--replace_column 1 <the_epoch>
+SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
+let $the_epoch= `select @the_epoch` ;
+SELECT * FROM t1 ORDER BY c3;
+stop slave;
+
+# restart the slave server
+let $mysqld_name=mysqld.1.slave;
+--source include/restart_mysqld.inc
+
+# get the master binlog pos from the epoch, from the _other_ "master", server2
+connection server2;
+# insert some data to t1 which should not come into the binlog
+# just so that we can do "show binlog events" to make sure the t1
+# update is actually in the server2 binlog
+set SQL_LOG_BIN=0;
+insert into t2 values (1);
+-- source include/show_binlog_events2.inc
+set SQL_LOG_BIN=1;
+--replace_result $the_epoch <the_epoch>
+eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+   FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
+let $the_pos= `SELECT @the_pos` ;
+let $the_file= `SELECT @the_file` ;
+
+# now connect the slave to the _other_ "master"
+connection slave;
+--replace_result $MASTER_MYPORT1 <MASTER_PORT1>
+eval CHANGE MASTER TO
+  master_port=$MASTER_MYPORT1,
+  master_log_file = '$the_file',
+  master_log_pos = $the_pos ;
+start slave;
+
+# insert some more values on the first master
+connection master;
+INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
+DELETE FROM t1 WHERE c3 = 1;
+UPDATE t1 SET c2="should go away" WHERE c3 = 2;
+UPDATE t1 SET c2="C" WHERE c3 = 3;
+DELETE FROM t1 WHERE c3 = 2;
+
+SELECT * FROM t1 ORDER BY c3;
+
+# insert another row, and check that we have it on the slave
+connection server2;
+INSERT INTO t1 VALUES ("row5","E",5);
+SELECT * FROM t1 ORDER BY c3;
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t1 ORDER BY c3;
+
+--echo ==== clean up ====
+connection server2;
+DROP TABLE t1;
+DROP TABLE t2;
+sync_slave_with_master;
+
+STOP SLAVE;

=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	2009-12-16 14:21:41 +0000
+++ b/sql/rpl_mi.cc	2010-05-06 12:28:22 +0000
@@ -495,7 +495,7 @@ int flush_master_info(Master_info* mi, b
               mi->password, mi->port, mi->connect_retry,
               (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
               mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert,
-              mi->bind_addr, heartbeat_buf,
+              heartbeat_buf, mi->bind_addr, 
               ignore_server_ids_buf);
   my_free(ignore_server_ids_buf, MYF(0));
   DBUG_RETURN(-flush_io_cache(file));

Thread
bzr commit into mysql-5.1-telco-7.0 branch (Martin.Skold:3525) Bug#52859Martin Skold6 May