MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Serge Kozlov Date:April 26 2010 7:53pm
Subject:bzr commit into mysql-trunk branch (Serge.Kozlov:3009) WL#5139
View as plain text  
#At file:///home/ksm/sun/repo/WL5139/commit-mysql-trunk/ based on revid:alik@stripped

 3009 Serge Kozlov	2010-04-26
      WL#5139. Add blackhole slave support to rpl suite
      1. New primitive master-slave-init.inc must be used for tests that included in testing with blackhole slave
      2. Current basic primitive master-slave.inc forces to skip test if blackhole slave is found.
      3. Configuration for rpl suite: blackhole_my.cnf and rpl_blackhole_slave.cnf
      4. Updated rpl_alter as the example of test which will run in both ways: regular testin and with blackhole slave
      5. Fix for start_slave.inc

    added:
      mysql-test/include/master-slave-init.inc
      mysql-test/include/sync_slave_with_master.inc
      mysql-test/suite/rpl/blackhole_my.cnf
      mysql-test/suite/rpl/rpl_blackhole_slave.cnf
    modified:
      mysql-test/include/master-slave.inc
      mysql-test/include/start_slave.inc
      mysql-test/suite/rpl/r/rpl_alter.result
      mysql-test/suite/rpl/t/rpl_alter.test
=== added file 'mysql-test/include/master-slave-init.inc'
--- a/mysql-test/include/master-slave-init.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/master-slave-init.inc	2010-04-26 19:52:55 +0000
@@ -0,0 +1,76 @@
+#
+# Purpose: Set up regular replication from master 
+# to slave and put blackhole slave if that slave 
+# is running.
+# 
+--source include/have_log_bin.inc
+
+#
+# Set up replication master->[blackhole]->slave
+#
+
+--disable_query_log
+
+# master
+connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
+RESET MASTER;
+--disable_warnings
+STOP SLAVE;
+--enable_warnings
+RESET SLAVE;
+let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $_master_port= $MASTER_MYPORT;
+
+# blackhole
+if (`SELECT '$BLACKHOLE_SLAVE_MYPORT' != ''`) {
+  connect (blackhole,127.0.0.1,root,,test,$BLACKHOLE_SLAVE_MYPORT,);
+  RESET MASTER;
+  RESET SLAVE;
+#  SET GLOBAL STORAGE_ENGINE = 'BLACKHOLE';
+  --replace_result $MASTER_MYPORT BLACKHOLE_PORT $_binlog_file BLACKHOLE_LOG_FILE
+  --eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file'
+  let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+  let $_master_port= $BLACKHOLE_SLAVE_MYPORT;
+}
+
+# slave
+connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+RESET MASTER;
+--disable_warnings
+STOP SLAVE;
+--enable_warnings
+RESET SLAVE;
+--replace_result $SLAVE_MYPORT SLAVE_PORT $_binlog_file SLAVE_LOG_FILE
+--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$_master_port,master_user='root',MASTER_LOG_FILE='$_binlog_file'
+let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+
+
+# Check server_ids: they should be different
+--connection master
+let $_id_a= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
+if (`SELECT '$BLACKHOLE_SLAVE_MYPORT' != ''`) { 
+  --connection blackhole
+  let $_id_b= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
+}
+--connection slave
+let $_id_c= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
+--connection master
+if (`SELECT '$_id_a' = '$_id_b' OR '$_id_a' = '$_id_c' OR '$_id_b' = '$_id_c'`) {
+  --echo Error: server ids were not different: master = $_id_a, blackhole =  $_id_b, slave $_id_c
+  exit;
+}
+
+let $noecho= 1;    
+# Start replication
+if (`SELECT '$BLACKHOLE_SLAVE_MYPORT' != ''`) {
+  --connection blackhole
+  --source include/start_slave.inc
+}    
+--connection slave
+--source include/start_slave.inc
+    
+--connection master
+--enable_query_log    
+let $noecho= ;
\ No newline at end of file

=== modified file 'mysql-test/include/master-slave.inc'
--- a/mysql-test/include/master-slave.inc	2009-11-04 12:28:20 +0000
+++ b/mysql-test/include/master-slave.inc	2010-04-26 19:52:55 +0000
@@ -3,6 +3,15 @@
 # $skip_slave_start  If true, the slave will not be started
 source include/have_log_bin.inc;
 
+# 'master-slave.inc' does not support blackhole slave so all test cases
+# with this included file must be skipped if blackhole slave is running.
+# Test cases with support of blackhole slave should use 'master-slave-init.inc'
+# primitive.
+
+if (`SELECT '$BLACKHOLE_SLAVE_MYPORT' != ''`) {
+  skip Test does not support blackhole slave
+}
+
 connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
 connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
 connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);

=== modified file 'mysql-test/include/start_slave.inc'
--- a/mysql-test/include/start_slave.inc	2009-01-09 14:12:31 +0000
+++ b/mysql-test/include/start_slave.inc	2010-04-26 19:52:55 +0000
@@ -17,5 +17,7 @@
 --disable_query_log
 START SLAVE;
 --enable_query_log
---echo include/start_slave.inc
+if (`SELECT '$noecho' != '1'`) {
+  --echo include/start_slave.inc
+}
 source include/wait_for_slave_to_start.inc;

=== added file 'mysql-test/include/sync_slave_with_master.inc'
--- a/mysql-test/include/sync_slave_with_master.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/sync_slave_with_master.inc	2010-04-26 19:52:55 +0000
@@ -0,0 +1,17 @@
+# ==== Purpose ====
+#
+# Sync slave with master by schema master -> blackhole -> slave
+# if a blackhole slave found and as usual (master -> slave) if not
+#
+# ==== Usage ====
+#
+# source include/sync_slave_with_master.inc;
+#
+
+--connection master
+--disable_query_log
+if (`SELECT '$BLACKHOLE_SLAVE_MYPORT' != ''`) {
+--sync_slave_with_master blackhole
+}
+--sync_slave_with_master slave
+--enable_query_log

=== added file 'mysql-test/suite/rpl/blackhole_my.cnf'
--- a/mysql-test/suite/rpl/blackhole_my.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/blackhole_my.cnf	2010-04-26 19:52:55 +0000
@@ -0,0 +1,10 @@
+# Use settings from rpl_1slave_base.cnf
+# add setting to connect the slave to the master by default
+!include rpl_blackhole_slave.cnf
+!include include/default_client.cnf
+
+
+[mysqld.2]
+
+[mysqld.3]
+

=== modified file 'mysql-test/suite/rpl/r/rpl_alter.result'
--- a/mysql-test/suite/rpl/r/rpl_alter.result	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/r/rpl_alter.result	2010-04-26 19:52:55 +0000
@@ -1,9 +1,3 @@
-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;
 drop database if exists mysqltest;
 create database mysqltest;
 create table mysqltest.t1 ( n int);

=== added file 'mysql-test/suite/rpl/rpl_blackhole_slave.cnf'
--- a/mysql-test/suite/rpl/rpl_blackhole_slave.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/rpl_blackhole_slave.cnf	2010-04-26 19:52:55 +0000
@@ -0,0 +1,79 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+!include include/default_client.cnf
+
+[mysqld.1]
+
+# Run the master.sh script before starting this process
+#!run-master-sh
+
+log-bin=                 master-bin
+
+loose-innodb
+
+[mysqld.2]
+# Run the slave.sh script before starting this process
+#!run-slave-sh
+
+# Append <testname>-slave.opt file to the list of argument used when
+# starting the mysqld
+#!use-slave-opt
+
+log-bin=                    slave-bin
+relay-log=                  slave-relay-bin
+
+init-rpl-role=              slave
+log-slave-updates
+master-retry-count=         10
+
+# Values reported by slave when it connect to master
+# and shows up in SHOW SLAVE STATUS;
+report-host=                127.0.0.1
+report-port=                @mysqld.2.port
+report-user=                root
+
+skip-slave-start
+
+# Directory where slaves find the dumps generated by "load data"
+# on the server. The path need to have constant length otherwise
+# test results will vary, thus a relative path is used.
+slave-load-tmpdir=          ../../tmp
+
+loose-innodb
+
+
+[mysqld.3]
+
+log-bin=                    blackhole-slave-bin
+relay-log=                  blackhole-slave-relay-bin
+
+init-rpl-role=              slave
+log-slave-updates
+master-retry-count=         10
+
+# Values reported by slave when it connect to master
+# and shows up in SHOW SLAVE STATUS;
+report-host=                127.0.0.1
+report-port=                @mysqld.3.port
+report-user=                root
+
+skip-slave-start
+
+# Directory where slaves find the dumps generated by "load data"
+# on the server. The path need to have constant length otherwise
+# test results will vary, thus a relative path is used.
+slave-load-tmpdir=          ../../tmp
+
+loose-innodb
+
+
+[ENV]
+MASTER_MYPORT=              @mysqld.1.port
+MASTER_MYSOCK=              @mysqld.1.socket
+
+SLAVE_MYPORT=               @mysqld.2.port
+SLAVE_MYSOCK=               @mysqld.2.socket
+
+BLACKHOLE_SLAVE_MYPORT=     @mysqld.3.port
+BLACKHOLE_SLAVE_MYSOCK=     @mysqld.3.socket
+

=== modified file 'mysql-test/suite/rpl/t/rpl_alter.test'
--- a/mysql-test/suite/rpl/t/rpl_alter.test	2009-11-27 23:34:47 +0000
+++ b/mysql-test/suite/rpl/t/rpl_alter.test	2010-04-26 19:52:55 +0000
@@ -1,4 +1,4 @@
-source include/master-slave.inc;
+source include/master-slave-init.inc;
 --disable_warnings
 drop database if exists mysqltest;
 --enable_warnings
@@ -10,11 +10,11 @@ insert into mysqltest.t1 values (1,2);
 create table mysqltest.t2 (n int);
 insert into mysqltest.t2 values (45);
 rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
-sync_slave_with_master;
+source include/sync_slave_with_master.inc;
 select * from mysqltest.t2;
 select * from mysqltest.t3;
 connection master;
 drop database mysqltest;
-sync_slave_with_master;
+source include/sync_slave_with_master.inc;
 
 # End of 4.1 tests


Attachment: [text/bzr-bundle] bzr/serge.kozlov@sun.com-20100426195255-68i5ecvf9hokprj4.bundle
Thread
bzr commit into mysql-trunk branch (Serge.Kozlov:3009) WL#5139Serge Kozlov26 Apr