List:Commits« Previous MessageNext Message »
From:tomas Date:January 10 2006 1:18pm
Subject:bk commit into 5.1 tree (tomas:1.2024)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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
  1.2024 06/01/10 14:18:37 tomas@stripped +5 -0
  Merge tulin@stripped:/home/bk/mysql-5.1-new
  into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-wl2325-v6

  mysql-test/mysql-test-run.sh
    1.286 06/01/10 14:18:30 tomas@stripped +0 -0
    SCCS merged

  mysql-test/t/mysqltest.test
    1.28 06/01/10 14:11:35 tomas@stripped +0 -0
    Auto merged

  mysql-test/r/mysqltest.result
    1.23 06/01/10 14:11:35 tomas@stripped +0 -0
    Auto merged

  mysql-test/mysql-test-run.pl
    1.50 06/01/10 14:11:35 tomas@stripped +0 -0
    Auto merged

  client/mysqltest.c
    1.170 06/01/10 14:11:35 tomas@stripped +0 -0
    Auto merged

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-wl2325-v6/RESYNC

--- 1.285/mysql-test/mysql-test-run.sh	2006-01-10 08:01:40 +01:00
+++ 1.286/mysql-test/mysql-test-run.sh	2006-01-10 14:18:30 +01:00
@@ -222,11 +222,14 @@
 
 MASTER_RUNNING=0
 MASTER1_RUNNING=0
+MASTER_MYHOST=127.0.0.1
 MASTER_MYPORT=9306
 SLAVE_RUNNING=0
+SLAVE_MYHOST=127.0.0.1
 SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
 MYSQL_MANAGER_PORT=9305 # needs to be out of the way of slaves
 NDBCLUSTER_PORT=9350
+NDBCLUSTER_PORT_SLAVE=9358
 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
@@ -262,7 +265,11 @@
 EXTRA_MYSQLBINLOG_OPT=""
 USE_RUNNING_SERVER=0
 USE_NDBCLUSTER=@USE_NDBCLUSTER@
+USE_NDBCLUSTER_SLAVE=@USE_NDBCLUSTER@
 USE_RUNNING_NDBCLUSTER=""
+USE_RUNNING_NDBCLUSTER_SLAVE=""
+NDB_EXTRA_TEST=0
+NDBCLUSTER_EXTRA_OPTS=""
 USE_PURIFY=""
 PURIFY_LOGS=""
 DO_GCOV=""
@@ -288,6 +295,7 @@
 NDB_MGM_EXTRA_OPTS=
 NDB_MGMD_EXTRA_OPTS=
 NDBD_EXTRA_OPTS=
+SLAVE_MYSQLDBINLOG=1
 
 DO_STRESS=""
 STRESS_SUITE="main"
@@ -325,9 +333,18 @@
     --extern)  USE_RUNNING_SERVER=1 ;;
     --with-ndbcluster)
       USE_NDBCLUSTER="--ndbcluster" ;;
+    --with-ndbcluster-slave)
+      USE_NDBCLUSTER_SLAVE="--ndbcluster" ;;
     --ndb-connectstring=*)
       USE_NDBCLUSTER="--ndbcluster" ;
       USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
+    --ndb-connectstring-slave=*)
+      USE_NDBCLUSTER_SLAVE="--ndbcluster" ;
+      USE_RUNNING_NDBCLUSTER_SLAVE=`$ECHO "$1" | $SED -e "s;--ndb-connectstring-slave=;;"` ;;
+    --ndb-extra-test)
+      NDBCLUSTER_EXTRA_OPTS=" "
+      NDB_EXTRA_TEST=1 ;
+      ;;
     --ndb_mgm-extra-opts=*)
       NDB_MGM_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgm-extra-opts=;;"` ;;
     --ndb_mgmd-extra-opts=*)
@@ -344,6 +361,8 @@
     --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
     --manager-port=*) MYSQL_MANAGER_PORT=`$ECHO "$1" | $SED -e "s;--manager_port=;;"` ;;
     --ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
+    --ndbcluster-port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster-port=;;"` ;;
+    --ndbcluster-port-slave=*) NDBCLUSTER_PORT_SLAVE=`$ECHO "$1" | $SED -e "s;--ndbcluster-port-slave=;;"` ;;
     --with-openssl)
      EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
      --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
@@ -500,6 +519,10 @@
       TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
       VALGRIND="$VALGRIND $TMP"
       ;;
+    --skip-ndbcluster-slave | --skip-ndb-slave)
+      USE_NDBCLUSTER_SLAVE=""
+      EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
+      ;;
     --valgrind-mysqltest | --valgrind-mysqltest-all)
       find_valgrind;
       VALGRIND_MYSQLTEST=$FIND_VALGRIND
@@ -510,9 +533,11 @@
       ;;
     --skip-ndbcluster | --skip-ndb)
       USE_NDBCLUSTER=""
+      USE_NDBCLUSTER_SLAVE=""
       EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
       EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
       ;;
+    --skip-slave-binlog) SLAVE_MYSQLDBINLOG=0 ;;
     --skip-*)
       EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
       EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
@@ -582,9 +607,13 @@
 CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
 SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
 
-export MASTER_MYPORT SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
+export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
 
 NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
+NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var"
+if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then
+  USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE"
+fi
 NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
 NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
 
@@ -727,7 +756,6 @@
  fi
  MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
  MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck"
- MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
  MYSQL_SLAP="$CLIENT_BINDIR/mysqlslap"
  MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow"
  MYSQL_IMPORT="$CLIENT_BINDIR/mysqlimport"
@@ -767,6 +795,13 @@
    MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
    MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
  fi
+ if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
+   MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
+ elif  [ -f "$BASEDIR/client/mysqldump" ] ; then
+   MYSQL_DUMP="$BASEDIR/client/mysqldump"
+ else
+   MYSQL_DUMP="$BASEDIR/bin/mysqldump"
+ fi
 fi
 
 if [ -z "$MASTER_MYSQLD" ]
@@ -829,6 +864,9 @@
 export PURIFYOPTIONS
 NDB_STATUS_OK=1
 export NDB_STATUS_OK
+NDB_SLAVE_STATUS_OK=1
+export NDB_SLAVE_STATUS_OK
+export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE
 
 MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
  --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
@@ -1207,24 +1245,30 @@
 
 start_ndbcluster()
 {
-  if [ ! -z "$USE_NDBCLUSTER" ]
+  if [ ! -n "$USE_NDBCLUSTER" ] ;
+  then
+    USING_NDBCLUSTER=0
+    USE_NDBCLUSTER_OPT=
+  fi
+  
+  if [ x$USING_NDBCLUSTER = x1 -a -z "$USE_NDBCLUSTER_OPT" ]
   then
   rm -f $NDB_TOOLS_OUTPUT
   if [ -z "$USE_RUNNING_NDBCLUSTER" ]
   then
-    echo "Starting ndbcluster"
-    if [ "$DO_BENCH" = 1 ]
+    if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
     then
-      NDBCLUSTER_EXTRA_OPTS=""
-    else
       NDBCLUSTER_EXTRA_OPTS="--small"
     fi
-    ./ndb/ndbcluster $NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --initial || NDB_STATUS_OK=0
+    OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --verbose=2 --initial"
+    echo "Starting master ndbcluster " $OPTS
+    ./ndb/ndbcluster $OPTS || NDB_STATUS_OK=0
     if [ x$NDB_STATUS_OK != x1 ] ; then
       if [ x$FORCE != x1 ] ; then
         exit 1
       fi
-      USE_NDBCLUSTER=
+      USING_NDBCLUSTER=0
+      USE_NDBCLUSTER_OPT=
       return
     fi
 
@@ -1233,18 +1277,20 @@
     NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
     echo "Using ndbcluster at $NDB_CONNECTSTRING"
   fi
-  USE_NDBCLUSTER="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\""
+  USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\""
   export NDB_CONNECTSTRING
   fi
 }
 
 stop_ndbcluster()
 {
- if [ ! -z "$USE_NDBCLUSTER" ]
+ if [ -n "$USE_NDBCLUSTER_OPT" ]
  then
+ USE_NDBCLUSTER_OPT=
  if [ -z "$USE_RUNNING_NDBCLUSTER" ]
  then
    # Kill any running ndbcluster stuff
+   $ECHO "Stopping master cluster"
    ./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
  fi
  fi
@@ -1300,7 +1346,7 @@
           --local-infile \
           --exit-info=256 \
           --core \
-          $USE_NDBCLUSTER \
+          $USE_NDBCLUSTER_OPT \
           --datadir=$MASTER_MYDDIR$1 \
           --pid-file=$MASTER_MYPID$1 \
           --socket=$MASTER_MYSOCK$1 \
@@ -1330,7 +1376,7 @@
           --character-sets-dir=$CHARSETSDIR \
           --default-character-set=$CHARACTER_SET \
           --core \
-          $USE_NDBCLUSTER \
+          $USE_NDBCLUSTER_OPT \
           --tmpdir=$MYSQL_TMP_DIR \
           --language=$LANGUAGE \
           --innodb_data_file_path=ibdata1:128M:autoextend \
@@ -1397,6 +1443,7 @@
   [ x$SKIP_SLAVE = x1 ] && 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"
@@ -1420,6 +1467,36 @@
    slave_pid=$SLAVE_MYPID
    slave_sock="$SLAVE_MYSOCK"
  fi
+
+  #
+  if [ x$USING_NDBCLUSTER = x1 -a -n "$USE_NDBCLUSTER_SLAVE" ] ; then
+    if [ $slave_server_id -eq 2 ] ; then
+      savedir=`pwd`
+      cd $MYSQL_TEST_DIR
+      if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
+       then
+         NDBCLUSTER_EXTRA_OPTS="--small"
+      fi
+
+      OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --diskless --ndbd-nodes=1 --verbose=2"
+      echo "Starting slave ndbcluster " $OPTS
+      ./ndb/ndbcluster $OPTS \
+                      || NDB_SLAVE_STATUS_OK=0
+      #                > /dev/null 2>&1 || NDB_SLAVE_STATUS_OK=0
+      cd $savedir
+      if [ x$NDB_SLAVE_STATUS_OK != x1 ] ; then
+        if [ x$FORCE != x1 ] ; then
+          exit 1
+        fi
+        USE_NDBCLUSTER_SLAVE_OPT=
+        USE_NDBCLUSTER_SLAVE=
+      fi
+      USE_NDBCLUSTER_SLAVE_OPT=$USE_NDBCLUSTER_SLAVE
+    fi
+  else
+    USE_NDBCLUSTER_SLAVE_OPT=
+  fi
+
   # Remove stale binary logs and old master.info files
   # except for too tests which need them
   if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
@@ -1445,12 +1522,16 @@
    master_info=$SLAVE_MASTER_INFO
  fi
 
+  if [ x$SLAVE_MYSQLDBINLOG = x1 ]
+  then
+    EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates"
+  fi
+
   $RM -f $slave_datadir/log.*
   slave_args="--no-defaults $master_info \
   	    --exit-info=256 \
-          --log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin \
+          $SLAVE_MYSQLDBINLOG_OPT \
           --relay-log=$MYSQL_TEST_DIR/var/log/$slave_ident-relay-bin \
-          --log-slave-updates \
           --log=$slave_log \
           --basedir=$MY_BASEDIR \
           --datadir=$slave_datadir \
@@ -1472,7 +1553,8 @@
           --log-bin-trust-function-creators \
           --loose-binlog-show-xid=0 \
            $SMALL_SERVER \
-           $EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT"
+           $EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \
+           $USE_NDBCLUSTER_SLAVE_OPT"
   CUR_MYERR=$slave_err
   CUR_MYSOCK=$slave_sock
 
@@ -1520,7 +1602,6 @@
 #  start_master
 #  start_slave
   cd $MYSQL_TEST_DIR
-  start_ndbcluster
   return 1
 }
 
@@ -1554,6 +1635,13 @@
       sleep $SLEEP_TIME_AFTER_RESTART
     fi
     eval "SLAVE$1_RUNNING=0"
+    if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
+      savedir=`pwd`
+      cd $MYSQL_TEST_DIR
+        $ECHO "Stopping slave cluster"
+      ./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop
+      cd $savedir
+    fi
   fi
 }
 
@@ -1642,6 +1730,7 @@
  result_file="r/$tname.result"
  echo $tname > $CURRENT_TEST
  SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
+ NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
  if [ "$USE_MANAGER" = 1 ] ; then
   many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
  fi
@@ -1731,9 +1820,19 @@
      esac
      stop_master
      stop_master 1
+
+     # only stop the cluster if this test will not use cluster
+     if [ x$NDBCLUSTER_TEST != x1 ] ;
+     then
+       stop_ndbcluster
+     fi
+
      report_current_test $tname
+     USING_NDBCLUSTER=$NDBCLUSTER_TEST
+     # start_ndbcluster knows if cluster is already started
+     start_ndbcluster
      start_master
-     if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+     if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
        start_master 1
      fi
      TZ=$MY_TZ; export TZ
@@ -1742,14 +1841,25 @@
      # or there is no master running (FIXME strange.....)
      # or there is a master init script
      if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \
-	[ -f $master_init_script ]
+	[ -f $master_init_script ] || \
+        [ -n "$USE_NDBCLUSTER" -a x$NDBCLUSTER_TEST != x$USING_NDBCLUSTER ]
      then
        EXTRA_MASTER_OPT=""
        stop_master
        stop_master 1
+
+       # only stop the cluster if this test will not use cluster
+       if [ x$NDBCLUSTER_TEST != x1 ] ;
+       then
+         stop_ndbcluster
+       fi
+
        report_current_test $tname
+       USING_NDBCLUSTER=$NDBCLUSTER_TEST
+       # start_ndbcluster knows if cluster is already started
+       start_ndbcluster
        start_master
-       if [ -n "$USE_NDBCLUSTER"  -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
+       if [ x$USING_NDBCLUSTER = x1  -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
          start_master 1
        fi
      else
@@ -1783,6 +1893,18 @@
        fi
      fi
 
+     USING_NDBCLUSTER=$NDBCLUSTER_TEST
+     if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
+       if [ x$USING_NDBCLUSTER != x1 ] ; then
+         do_slave_restart=1
+       fi
+     else
+       if [ x$USING_NDBCLUSTER = x1 ] ; then
+         do_slave_restart=1
+       fi
+     fi
+
+
      if [ x$do_slave_restart = x1 ] ; then
        stop_slave
        echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
@@ -2041,6 +2163,8 @@
     fi
   fi
 
+  # just to force stopping anything from previous runs
+  USE_NDBCLUSTER_OPT=$USE_NDBCLUSTER
   stop_ndbcluster
 
   # Remove files that can cause problems
@@ -2058,7 +2182,8 @@
 
   if [ -n "$1" -a `expr "X$*" : '.*ndb'` -eq 0 ]
   then
-    USE_NDBCLUSTER=""
+    USING_NDBCLUSTER=0
+    USE_NDBCLUSTER_OPT=
   fi
 
   start_manager
@@ -2090,7 +2215,7 @@
     EXTRA_BENCH_ARGS="--small-test --small-tables"
   fi
 
-  if [ ! -z "$USE_NDBCLUSTER" ]
+  if [ x$USING_NDBCLUSTER = x1 ]
   then
     EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS"
   fi 

--- 1.49/mysql-test/mysql-test-run.pl	2006-01-10 08:01:40 +01:00
+++ 1.50/mysql-test/mysql-test-run.pl	2006-01-10 14:11:35 +01:00
@@ -140,6 +140,7 @@
 our $glob_timers=                 undef;
 our $glob_use_running_server=     0;
 our $glob_use_running_ndbcluster= 0;
+our $glob_use_running_ndbcluster_slave= 0;
 our $glob_use_embedded_server=    0;
 our @glob_test_mode;
 
@@ -233,6 +234,8 @@
 
 our $opt_ndbcluster_port;
 our $opt_ndbconnectstring;
+our $opt_ndbcluster_port_slave;
+our $opt_ndbconnectstring_slave;
 
 our $opt_no_manager;            # Does nothing now, we never use manager
 our $opt_manager_port;          # Does nothing now, we never use manager
@@ -300,12 +303,16 @@
 
 our $opt_skip_ndbcluster;
 our $opt_with_ndbcluster;
+our $opt_skip_ndbcluster_slave;
+our $opt_with_ndbcluster_slave;
+our $opt_ndb_extra_test;
 
 our $exe_ndb_mgm;
 our $path_ndb_tools_dir;
 our $path_ndb_backup_dir;
 our $file_ndb_testrun_log;
 our $flag_ndb_status_ok= 1;
+our $flag_ndb_slave_status_ok= 1;
 
 ######################################################################
 #
@@ -325,6 +332,9 @@
 sub ndbcluster_install ();
 sub ndbcluster_start ();
 sub ndbcluster_stop ();
+sub ndbcluster_install_slave ();
+sub ndbcluster_start_slave ();
+sub ndbcluster_stop_slave ();
 sub run_benchmarks ($);
 sub run_tests ();
 sub mysql_install_db ();
@@ -493,6 +503,7 @@
   my $opt_master_myport= 9306;
   my $opt_slave_myport=  9308;
   $opt_ndbcluster_port=  9350;
+  $opt_ndbcluster_port_slave=  9358;
   my $im_port=           9310;
   my $im_mysqld1_port=   9312;
   my $im_mysqld2_port=   9314;
@@ -529,6 +540,10 @@
              'force'                    => \$opt_force,
              'with-ndbcluster'          => \$opt_with_ndbcluster,
              'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
+             'with-ndbcluster-slave'    => \$opt_with_ndbcluster_slave,
+             'skip-ndbcluster-slave|skip-ndb-slave'
+                                        => \$opt_skip_ndbcluster_slave,
+             'ndb-extra-test'           => \$opt_ndb_extra_test,
              'do-test=s'                => \$opt_do_test,
              'suite=s'                  => \$opt_suite,
              'skip-rpl'                 => \$opt_skip_rpl,
@@ -539,6 +554,7 @@
              'master_port=i'            => \$opt_master_myport,
              'slave_port=i'             => \$opt_slave_myport,
              'ndbcluster_port=i'        => \$opt_ndbcluster_port,
+             'ndbcluster_port_slave=i'  => \$opt_ndbcluster_port_slave,
              'manager-port=i'           => \$opt_manager_port, # Currently not used
              'im-port=i'                => \$im_port, # Instance Manager port.
              'im-mysqld1-port=i'        => \$im_mysqld1_port, # Port of mysqld, controlled by IM
@@ -553,6 +569,7 @@
              # Run test on running server
              'extern'                   => \$opt_extern,
              'ndbconnectstring=s'       => \$opt_ndbconnectstring,
+             'ndbconnectstring-slave=s' => \$opt_ndbconnectstring_slave,
 
              # Debugging
              'gdb'                      => \$opt_gdb,
@@ -759,9 +776,25 @@
     $opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port";
   }
 
+  if ( $opt_ndbconnectstring_slave )
+  {
+    $glob_use_running_ndbcluster_slave= 1;
+    $opt_with_ndbcluster_slave= 1;
+  }
+  else
+  {
+    $opt_ndbconnectstring_slave= "host=localhost:$opt_ndbcluster_port_slave";
+  }
+
   if ( $opt_skip_ndbcluster )
   {
     $opt_with_ndbcluster= 0;
+    $opt_skip_ndbcluster_slave= 1;
+  }
+
+  if ( $opt_skip_ndbcluster_slave )
+  {
+    $opt_with_ndbcluster_slave= 0;
   }
 
   # The ":s" in the argument spec, means we have three different cases
@@ -855,6 +888,8 @@
    path_mysock   => "$sockdir/slave.sock",
    path_myport   => $opt_slave_myport,
    start_timeout => 400,
+
+   ndbcluster    =>  1, # ndbcluster not started
   };
 
   $slave->[1]=
@@ -1188,6 +1223,8 @@
 
     ndbcluster_stop();
     $master->[0]->{'ndbcluster'}= 1;
+    ndbcluster_stop_slave();
+    $slave->[0]->{'ndbcluster'}= 1;
   }
 }
 
@@ -1374,6 +1411,68 @@
   return;
 }
 
+sub ndbcluster_install_slave () {
+
+  if ( ! $opt_with_ndbcluster_slave or $glob_use_running_ndbcluster_slave )
+  {
+    return 0;
+  }
+  mtr_report("Install ndbcluster slave");
+  if (  mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
+		["--port=$opt_ndbcluster_port_slave",
+		 "--data-dir=$opt_vardir",
+		 "--small",
+		 "--diskless",
+		 "--ndbd-nodes=1",
+		 "--initial"],
+		"", "", "", "") )
+  {
+    mtr_error("Error ndbcluster_install_slave");
+    return 1;
+  }
+
+  ndbcluster_stop_slave();
+  $slave->[0]->{'ndbcluster'}= 1;
+
+  return 0;
+}
+
+sub ndbcluster_start_slave () {
+
+  if ( ! $opt_with_ndbcluster_slave or $glob_use_running_ndbcluster_slave )
+  {
+    return 0;
+  }
+  # FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
+  if ( mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
+	       ["--port=$opt_ndbcluster_port_slave",
+		"--data-dir=$opt_vardir",
+		"--ndbd-nodes=1"],
+	       "", "/dev/null", "", "") )
+  {
+    mtr_error("Error ndbcluster_start_slave");
+    return 1;
+  }
+
+  return 0;
+}
+
+sub ndbcluster_stop_slave () {
+
+  if ( ! $opt_with_ndbcluster_slave or $glob_use_running_ndbcluster_slave )
+  {
+    return;
+  }
+  # FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
+  mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
+          ["--port=$opt_ndbcluster_port_slave",
+           "--data-dir=$opt_vardir",
+           "--stop"],
+          "", "/dev/null", "", "");
+
+  return;
+}
+
 
 ##############################################################################
 #
@@ -1525,6 +1624,13 @@
     $flag_ndb_status_ok= 0;
   }
 
+  if ( ndbcluster_install_slave() )
+  {
+    # failed to install, disable usage but flag that its no ok
+    $opt_with_ndbcluster_slave= 0;
+    $flag_ndb_slave_status_ok= 0;
+  }
+
   return 0;
 }
 
@@ -1848,6 +1954,18 @@
       {
         if ( ! $slave->[$idx]->{'pid'} )
         {
+          if ( $idx == 0)
+	  {
+	    if ( $slave->[0]->{'ndbcluster'} )
+	    {
+	      $slave->[0]->{'ndbcluster'}= ndbcluster_start_slave();
+	      if ( $slave->[0]->{'ndbcluster'} )
+	      {
+		report_failure_and_restart($tinfo);
+		return;
+	      }
+	    }
+	  }
           $slave->[$idx]->{'pid'}=
             mysqld_start('slave',$idx,
                          $tinfo->{'slave_opt'}, $tinfo->{'slave_mi'});
@@ -2115,6 +2233,12 @@
     {
       mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
     }
+    if ( $opt_with_ndbcluster )
+    {
+      mtr_add_arg($args, "%s--ndbcluster", $prefix);
+      mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
+                  $opt_ndbconnectstring);
+    }
   }
 
   if ( $type eq 'slave' )
@@ -2171,6 +2295,17 @@
       mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
       mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
     }
+    
+    if ( $opt_skip_ndbcluster_slave )
+    {
+      mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
+    }
+    if ( $idx == 0 and $opt_with_ndbcluster_slave )
+    {
+      mtr_add_arg($args, "%s--ndbcluster", $prefix);
+      mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
+                  $opt_ndbconnectstring_slave);
+    }
   } # end slave
 
   if ( $opt_debug )
@@ -2187,13 +2322,6 @@
     }
   }
 
-  if ( $opt_with_ndbcluster )
-  {
-    mtr_add_arg($args, "%s--ndbcluster", $prefix);
-    mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
-                $opt_ndbconnectstring);
-  }
-
   # FIXME always set nowdays??? SMALL_SERVER
   mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
   mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
@@ -2408,6 +2536,12 @@
     }
   }
 
+  if ( ! $slave->[0]->{'ndbcluster'} )
+  {
+    ndbcluster_stop_slave();
+    $slave->[0]->{'ndbcluster'}= 1;
+  }
+
   mtr_stop_mysqld_servers(\@args);
 }
 
@@ -2617,6 +2751,8 @@
   $ENV{'MYSQL_MY_PRINT_DEFAULTS'}=  $exe_my_print_defaults;
 
   $ENV{'NDB_STATUS_OK'}=            $flag_ndb_status_ok;
+  $ENV{'NDB_SLAVE_STATUS_OK'}=      $flag_ndb_slave_status_ok;
+  $ENV{'NDB_EXTRA_TEST'}=           $opt_ndb_extra_test;
   $ENV{'NDB_MGM'}=                  $exe_ndb_mgm;
   $ENV{'NDB_BACKUP_DIR'}=           $path_ndb_backup_dir;
   $ENV{'NDB_TOOLS_DIR'}=            $path_ndb_tools_dir;

--- 1.22/mysql-test/r/mysqltest.result	2005-12-29 09:48:36 +01:00
+++ 1.23/mysql-test/r/mysqltest.result	2006-01-10 14:11:35 +01:00
@@ -215,12 +215,11 @@
 
 mysqltest: At line 1: Missing arguments to let
 mysqltest: At line 1: Missing variable name in let
-mysqltest: At line 1: Variable name in hi=hi does not start with '$'
 mysqltest: At line 1: Missing assignment operator in let
 mysqltest: At line 1: Missing assignment operator in let
 mysqltest: At line 1: Missing arguments to let
 mysqltest: At line 1: Missing variable name in let
-mysqltest: At line 1: Variable name in =hi does not start with '$'
+mysqltest: At line 1: Missing variable name in let
 mysqltest: At line 1: Missing assignment operator in let
 var1
 hi	1	hi there

--- 1.27/mysql-test/t/mysqltest.test	2006-01-10 08:01:40 +01:00
+++ 1.28/mysql-test/t/mysqltest.test	2006-01-10 14:11:35 +01:00
@@ -519,9 +519,6 @@
 --exec echo "let $=hi;" | $MYSQL_TEST  2>&1
 
 --error 1
---exec echo "let hi=hi;" | $MYSQL_TEST  2>&1
-
---error 1
 --exec echo "let $1 hi;" | $MYSQL_TEST  2>&1
 
 --error 1

--- 1.169/client/mysqltest.c	2006-01-10 08:01:39 +01:00
+++ 1.170/client/mysqltest.c	2006-01-10 14:11:35 +01:00
@@ -855,7 +855,7 @@
 int var_set(const char *var_name, const char *var_name_end,
             const char *var_val, const char *var_val_end)
 {
-  int digit;
+  int digit, result, env_var= 0;
   VAR* v;
   DBUG_ENTER("var_set");
   DBUG_PRINT("enter", ("var_name: '%.*s' = '%.*s' (length: %d)",
@@ -863,11 +863,11 @@
                        (int) (var_val_end - var_val), var_val,
                        (int) (var_val_end - var_val)));
 
-  if (*var_name++ != '$')
-  {
-    var_name--;
-    die("Variable name in %s does not start with '$'", var_name);
-  }
+  if (*var_name != '$')
+    env_var= 1;
+  else
+    var_name++;
+
   digit = *var_name - '0';
   if (!(digit < 10 && digit >= 0))
   {
@@ -875,7 +875,23 @@
   }
   else
     v = var_reg + digit;
-  DBUG_RETURN(eval_expr(v, var_val, (const char**)&var_val_end));
+
+  result= eval_expr(v, var_val, (const char**) &var_val_end);
+
+  if (env_var)
+  {
+    char buf[1024];
+    memcpy(buf, v->name, v->name_len);
+    buf[v->name_len]= 0;
+    if (v->int_dirty)
+    {
+      sprintf(v->str_val, "%d", v->int_val);
+      v->int_dirty= 0;
+      v->str_val_len= strlen(v->str_val);
+    }
+    setenv(buf, v->str_val, 1);
+  }
+  DBUG_RETURN(result);
 }
 
 
@@ -1493,6 +1509,91 @@
   rpl_parse = mysql_rpl_parse_enabled(mysql);
   mysql_disable_rpl_parse(mysql);
 
+#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
+  /*
+     Wait for ndb binlog to be up-to-date with all changes
+     done on the local mysql server
+  */
+  {
+    ulong have_ndbcluster;
+    if (mysql_query(mysql, query= "show variables like 'have_ndbcluster'"))
+      die("At line %u: failed in %s: %d: %s", start_lineno, query,
+          mysql_errno(mysql), mysql_error(mysql));
+    if (!(last_result= res= mysql_store_result(mysql)))
+      die("line %u: mysql_store_result() retuned NULL for '%s'", start_lineno,
+          query);
+    if (!(row= mysql_fetch_row(res)))
+      die("line %u: empty result in %s", start_lineno, query);
+
+    have_ndbcluster= strcmp("YES", row[1]) == 0;
+    mysql_free_result(res);
+    last_result= 0;
+
+    if (have_ndbcluster)
+    {
+      ulonglong epoch, tmp_epoch= 0;
+      int count= 0;
+
+      do
+      {
+        const char binlog[]= "binlog";
+        const char latest_trans_epoch[]=
+          "latest_trans_epoch=";
+        const char latest_applied_binlog_epoch[]=
+          "latest_applied_binlog_epoch=";
+        if (count)
+          sleep(1);
+        if (mysql_query(mysql, query= "show engine ndb status"))
+          die("At line %u: failed in '%s': %d: %s", start_lineno, query,
+              mysql_errno(mysql), mysql_error(mysql));
+        if (!(last_result= res= mysql_store_result(mysql)))
+          die("line %u: mysql_store_result() retuned NULL for '%s'",
+              start_lineno, query);
+        while ((row= mysql_fetch_row(res)))
+        {
+          if (strcmp(row[1], binlog) == 0)
+          {
+            const char *status= row[2];
+            /* latest_trans_epoch */
+            if (count == 0)
+            {
+              while (*status && strncmp(status, latest_trans_epoch,
+                                        sizeof(latest_trans_epoch)-1))
+                status++;
+              if (*status)
+              {
+                status+= sizeof(latest_trans_epoch)-1;
+                epoch= strtoull(status, (char**) 0, 10);
+              }
+              else
+                die("line %u: result does not contain '%s' in '%s'",
+                    start_lineno, latest_trans_epoch, query);
+            }
+            /* latest_applied_binlog_epoch */
+            while (*status && strncmp(status, latest_applied_binlog_epoch,
+                                      sizeof(latest_applied_binlog_epoch)-1))
+              status++;
+            if (*status)
+            {
+              status+= sizeof(latest_applied_binlog_epoch)-1;
+              tmp_epoch= strtoull(status, (char**) 0, 10);
+            }
+            else
+              die("line %u: result does not contain '%s' in '%s'",
+                  start_lineno, latest_applied_binlog_epoch, query);
+            break;
+          }
+        }
+        mysql_free_result(res);
+        if (!row)
+          die("line %u: result does not contain '%s' in '%s'",
+              start_lineno, binlog, query);
+        last_result=0;
+        count++;
+      } while (tmp_epoch < epoch && count <= 3);
+    }
+  }
+#endif
   if (mysql_query(mysql, query= "show master status"))
     die("failed in show master status: %d: %s",
 	mysql_errno(mysql), mysql_error(mysql));
@@ -1543,7 +1644,8 @@
   while (*p && (*p != '=') && !my_isspace(charset_info,*p))
     p++;
   var_name_end= p;
-  if (var_name+1 == var_name_end)
+  if (var_name == var_name_end ||
+      (var_name+1 == var_name_end && *var_name == '$'))
     die("Missing variable name in let");
   while (my_isspace(charset_info,*p))
     p++;
Thread
bk commit into 5.1 tree (tomas:1.2024)tomas10 Jan