List:Internals« Previous MessageNext Message »
From:sasha Date:October 9 2001 10:43pm
Subject:bk commit into 4.0 tree
View as plain text  
Below is the list of changes that have just been committed into a
4.0 repository of sasha. When sasha does a push, they will be propogated 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet@stripped, 2001-10-09 16:43:05-06:00, sasha@stripped
  support for three slaves in mysql-test

  mysql-test/mysql-test-run.sh
    1.110 01/10/09 16:43:04 sasha@stripped +71 -26
    start three slaves in failover test

  mysql-test/r/rpl_failsafe.result
    1.2 01/10/09 16:43:04 sasha@stripped +6 -0
    check two more slaves

  mysql-test/t/rpl_failsafe.test
    1.2 01/10/09 16:43:04 sasha@stripped +6 -0
    check two more slaves

# 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:	sasha
# Host:	mysql.sashanet.com
# Root:	/home/sasha/src/bk/mysql-4.0

--- 1.109/mysql-test/mysql-test-run.sh	Mon Oct  8 13:49:45 2001
+++ 1.110/mysql-test/mysql-test-run.sh	Tue Oct  9 16:43:04 2001
@@ -124,7 +124,7 @@
 MASTER_MYPORT=9306
 SLAVE_RUNNING=0
 SLAVE_MYPORT=9307
-MYSQL_MANAGER_PORT=9308
+MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves
 MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd
 MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
 MYSQL_MANAGER_USER=root
@@ -473,6 +473,13 @@
 	error "Could not install slave test DBs"
 	exit 1
     fi
+    
+    for slave_num in 1 2 ;
+    do
+     mkdir -p var/slave$slave_num-data/mysql
+     mkdir -p var/slave$slave_num-data/test
+     cp var/slave-data/mysql/* var/slave$slave_num-data/mysql
+    done
     # Give mysqld some time to die.
     sleep $SLEEP_TIME
     return 0
@@ -647,10 +654,33 @@
 start_slave()
 {
     [ x$SKIP_SLAVE = x1 ] && return
-    [ x$SLAVE_RUNNING = 1 ] && return
-    
+    eval "this_slave_running=\$SLAVE$1_RUNNING"
+    [ x$this_slave_running = 1 ] && return
+    #when testing fail-safe replication, we will have more than one slave
+    #in this case, we start secondary slaves with an argument
+    slave_ident="slave$1"
+    if [ -n "$1" ] ;
+    then
+     slave_server_id=`$EXPR 2 + $1`
+     slave_rpl_rank=$slave_server_id
+     slave_port=`expr $SLAVE_MYPORT + $1`
+     slave_log="$SLAVE_MYLOG.$1"
+     slave_err="$SLAVE_MYERR.$1"
+     slave_datadir="var/$slave_ident-data/"
+     slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
+     slave_sock="$SLAVE_MYSOCK-$1"
+    else
+     slave_server_id=2
+     slave_rpl_rank=2
+     slave_port=$SLAVE_MYPORT 
+     slave_log=$SLAVE_MYLOG
+     slave_err=$SLAVE_MYERR
+     slave_datadir=$SLAVE_MYDDIR
+     slave_pid=$SLAVE_MYPID
+     slave_sock="$SLAVE_MYSOCK"
+   fi 
     # Remove stale binary logs
-    $RM -f $MYSQL_TEST_DIR/var/log/slave-bin.*
+    $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-bin.*
     
     #run slave initialization shell script if one exists
     if [ -f "$slave_init_script" ] ;
@@ -664,22 +694,22 @@
 	    --master-host=127.0.0.1 \
 	    --master-password= \
 	    --master-port=$MASTER_MYPORT \
-	    --server-id=2 --rpl-recovery-rank=2"
+	    --server-id=$slave_server_id --rpl-recovery-rank=$slave_rpl_rank"
    else
      master_info=$SLAVE_MASTER_INFO
    fi	    
     
-    $RM -f $SLAVE_MYDDIR/log.*	
+    $RM -f $slave_datadir/log.*	
     slave_args="--no-defaults $master_info \
     	    --exit-info=256 \
-	    --log-bin=$MYSQL_TEST_DIR/var/log/slave-bin \
+	    --log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin \
 	    --log-slave-updates \
-            --log=$SLAVE_MYLOG \
+            --log=$slave_log \
             --basedir=$MY_BASEDIR \
-            --datadir=$SLAVE_MYDDIR \
-	    --pid-file=$SLAVE_MYPID \
-	    --port=$SLAVE_MYPORT \
-	    --socket=$SLAVE_MYSOCK \
+            --datadir=$slave_datadir \
+	    --pid-file=$slave_pid \
+	    --port=$slave_port \
+	    --socket=$slave_sock \
 	    --character-sets-dir=$CHARSETSDIR \
 	    --default-character-set=$CHARACTER_SET \
 	    --core \
@@ -688,27 +718,27 @@
 	    --skip-innodb --skip-slave-start \
 	    --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
 	    --report-host=127.0.0.1 --report-user=root \
-	    --report-port=$SLAVE_MYPORT \
+	    --report-port=$slave_port \
 	    --master-retry-count=5 \
 	     $SMALL_SERVER \
              $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
-    CUR_MYERR=$SLAVE_MYERR
-    CUR_MYSOCK=$SLAVE_MYSOCK
+    CUR_MYERR=$slave_err
+    CUR_MYSOCK=$slave_sock
   
     if [ x$DO_DDD = x1 ]
     then
       $ECHO "set args $master_args" > $GDB_SLAVE_INIT
-      manager_launch slave ddd -display $DISPLAY --debugger \
+      manager_launch $slave_ident ddd -display $DISPLAY --debugger \
        "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD 
     elif [ x$DO_GDB = x1 ]
     then
       $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
-      manager_launch slave $XTERM -display $DISPLAY -title "Slave" -e gdb -x \
+      manager_launch $slave_ident $XTERM -display $DISPLAY -title "Slave" -e gdb -x \
        $GDB_SLAVE_INIT $SLAVE_MYSQLD 
     else
-      manager_launch slave $SLAVE_MYSQLD $slave_args
+      manager_launch $slave_ident $SLAVE_MYSQLD $slave_args
     fi
-    SLAVE_RUNNING=1
+    eval "SLAVE$1_RUNNING=1"
 }
 
 mysql_start () {
@@ -721,23 +751,31 @@
 
 stop_slave ()
 {
-  if [ x$SLAVE_RUNNING = x1 ]
+  eval "this_slave_running=\$SLAVE$1_RUNNING"
+  slave_ident="slave$1"
+  if [ -n "$1" ] ;
   then
-    manager_term slave
-    if [ $? != 0 ] && [ -f $SLAVE_MYPID ]
+   slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
+  else
+   slave_pid=$SLAVE_MYPID
+  fi 
+  if [ x$this_slave_running = x1 ]
+  then
+    manager_term $slave_ident
+    if [ $? != 0 ] && [ -f $slave_pid ]
     then # try harder!
      $ECHO "slave not cooperating with mysqladmin, will try manual kill"
-     kill `$CAT $SLAVE_MYPID`
+     kill `$CAT $slave_pid`
      sleep $SLEEP_TIME
      if [ -f $SLAVE_MYPID ] ; then
        $ECHO "slave refused to die. Sending SIGKILL"
-       kill -9 `$CAT $SLAVE_MYPID`
-       $RM -f $SLAVE_MYPID
+       kill -9 `$CAT $slave_pid`
+       $RM -f $slave_pid
      else
       $ECHO "slave responded to SIGTERM " 
      fi
     fi
-    SLAVE_RUNNING=0
+    eval "SLAVE$1_RUNNING=0"
   fi  
 }
 
@@ -771,6 +809,8 @@
  stop_master
  $ECHO "Master shutdown finished"
  stop_slave
+ stop_slave 1
+ stop_slave 2
  $ECHO "Slave shutdown finished"
  
  return 1
@@ -800,6 +840,7 @@
  slave_init_script=$TESTDIR/$tname-slave.sh
  slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
  SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
+ many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0`
  if [ -n "$SKIP_TEST" ] ; then 
    SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0`
    if [ x$SKIP_THIS_TEST = x1 ] ;
@@ -873,6 +914,10 @@
    if [ x$do_slave_restart = x1 ] ; then
      stop_slave
      start_slave
+   fi
+   if [ x$many_slaves = x1 ]; then
+    start_slave 1
+    start_slave 2
    fi
  fi
  cd $MYSQL_TEST_DIR

--- 1.1/mysql-test/r/rpl_failsafe.result	Mon Oct  8 13:07:42 2001
+++ 1.2/mysql-test/r/rpl_failsafe.result	Tue Oct  9 16:43:04 2001
@@ -9,3 +9,9 @@
 show variables like 'rpl_recovery_rank';
 Variable_name	Value
 rpl_recovery_rank	2
+show variables like 'rpl_recovery_rank';
+Variable_name	Value
+rpl_recovery_rank	3
+show variables like 'rpl_recovery_rank';
+Variable_name	Value
+rpl_recovery_rank	4

--- 1.1/mysql-test/t/rpl_failsafe.test	Mon Oct  8 13:07:42 2001
+++ 1.2/mysql-test/t/rpl_failsafe.test	Tue Oct  9 16:43:04 2001
@@ -1,5 +1,11 @@
 source include/master-slave.inc;
+connect (slave_sec,localhost,root,,test,0,slave.sock-1); 
+connect (slave_ter,localhost,root,,test,0,slave.sock-2); 
 connection master;
 show variables like 'rpl_recovery_rank';
 connection slave;
+show variables like 'rpl_recovery_rank';
+connection slave_sec;
+show variables like 'rpl_recovery_rank';
+connection slave_ter;
 show variables like 'rpl_recovery_rank';
Thread
bk commit into 4.0 treesasha10 Oct