mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
added 2 masters for ndb tests
This commit is contained in:
@ -198,9 +198,10 @@ DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$DYLD_LIBRARY_PATH"
|
||||
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
|
||||
|
||||
MASTER_RUNNING=0
|
||||
MASTER1_RUNNING=0
|
||||
MASTER_MYPORT=9306
|
||||
SLAVE_RUNNING=0
|
||||
SLAVE_MYPORT=9307
|
||||
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
|
||||
MYSQL_MANAGER_PW_FILE=$MYSQL_TEST_DIR/var/tmp/manager.pwd
|
||||
@ -723,13 +724,22 @@ report_stats () {
|
||||
|
||||
mysql_install_db () {
|
||||
$ECHO "Removing Stale Files"
|
||||
$RM -rf $MASTER_MYDDIR $SLAVE_MYDDIR $MY_LOG_DIR/*
|
||||
$RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1" $SLAVE_MYDDIR $MY_LOG_DIR/*
|
||||
$ECHO "Installing Master Databases"
|
||||
$INSTALL_DB
|
||||
if [ $? != 0 ]; then
|
||||
error "Could not install master test DBs"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -z "$USE_NDBCLUSTER" ]
|
||||
then
|
||||
$ECHO "Installing Master Databases 1"
|
||||
$INSTALL_DB -1
|
||||
if [ $? != 0 ]; then
|
||||
error "Could not install master test DBs 1"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
$ECHO "Installing Slave Databases"
|
||||
$INSTALL_DB -slave
|
||||
if [ $? != 0 ]; then
|
||||
@ -868,10 +878,10 @@ manager_term()
|
||||
ident=$2
|
||||
if [ $USE_MANAGER = 0 ] ; then
|
||||
# Shutdown time must be high as slave may be in reconnect
|
||||
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
|
||||
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
|
||||
res=$?
|
||||
# Some systems require an extra connect
|
||||
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
|
||||
$MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
|
||||
if test $res = 0
|
||||
then
|
||||
wait_for_pid $pid
|
||||
@ -888,17 +898,18 @@ EOF
|
||||
|
||||
start_master()
|
||||
{
|
||||
if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
|
||||
eval "this_master_running=\$MASTER$1_RUNNING"
|
||||
if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
|
||||
return
|
||||
fi
|
||||
# Remove stale binary logs except for 2 tests which need them
|
||||
if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
|
||||
then
|
||||
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
|
||||
$RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.*
|
||||
fi
|
||||
|
||||
# Remove old master.info and relay-log.info files
|
||||
$RM -f $MYSQL_TEST_DIR/var/master-data/master.info $MYSQL_TEST_DIR/var/master-data/relay-log.info
|
||||
$RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info
|
||||
|
||||
#run master initialization shell script if one exists
|
||||
|
||||
@ -907,20 +918,27 @@ start_master()
|
||||
/bin/sh $master_init_script
|
||||
fi
|
||||
cd $BASEDIR # for gcov
|
||||
if [ -n "$1" ] ; then
|
||||
id=`$EXPR $1 + 101`;
|
||||
this_master_myport=`$EXPR $MASTER_MYPORT + $1`
|
||||
else
|
||||
id=1;
|
||||
this_master_myport=$MASTER_MYPORT
|
||||
fi
|
||||
if [ -z "$DO_BENCH" ]
|
||||
then
|
||||
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
|
||||
--server-id=1 \
|
||||
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
|
||||
--server-id=$id \
|
||||
--basedir=$MY_BASEDIR \
|
||||
--port=$MASTER_MYPORT \
|
||||
--port=$this_master_myport \
|
||||
--local-infile \
|
||||
--exit-info=256 \
|
||||
--core \
|
||||
$USE_NDBCLUSTER \
|
||||
--datadir=$MASTER_MYDDIR \
|
||||
--pid-file=$MASTER_MYPID \
|
||||
--socket=$MASTER_MYSOCK \
|
||||
--log=$MASTER_MYLOG \
|
||||
--datadir=$MASTER_MYDDIR$1 \
|
||||
--pid-file=$MASTER_MYPID$1 \
|
||||
--socket=$MASTER_MYSOCK$1 \
|
||||
--log=$MASTER_MYLOG$1 \
|
||||
--character-sets-dir=$CHARSETSDIR \
|
||||
--default-character-set=$CHARACTER_SET \
|
||||
--tmpdir=$MYSQL_TMP_DIR \
|
||||
@ -931,14 +949,14 @@ start_master()
|
||||
$SMALL_SERVER \
|
||||
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
|
||||
else
|
||||
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
|
||||
--server-id=1 --rpl-recovery-rank=1 \
|
||||
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1 \
|
||||
--server-id=$id --rpl-recovery-rank=1 \
|
||||
--basedir=$MY_BASEDIR --init-rpl-role=master \
|
||||
--port=$MASTER_MYPORT \
|
||||
--port=$this_master_myport \
|
||||
--local-infile \
|
||||
--datadir=$MASTER_MYDDIR \
|
||||
--pid-file=$MASTER_MYPID \
|
||||
--socket=$MASTER_MYSOCK \
|
||||
--datadir=$MASTER_MYDDIR$1 \
|
||||
--pid-file=$MASTER_MYPID$1 \
|
||||
--socket=$MASTER_MYSOCK$1 \
|
||||
--character-sets-dir=$CHARSETSDIR \
|
||||
--default-character-set=$CHARACTER_SET \
|
||||
--core \
|
||||
@ -982,11 +1000,11 @@ EOF
|
||||
-title "Master" -e gdb -x $GDB_MASTER_INIT $MASTER_MYSQLD
|
||||
fi
|
||||
else
|
||||
manager_launch master $MASTER_MYSQLD $master_args
|
||||
manager_launch master$1 $MASTER_MYSQLD $master_args
|
||||
fi
|
||||
sleep_until_file_created $MASTER_MYPID $wait_for_master
|
||||
sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
|
||||
wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
|
||||
MASTER_RUNNING=1
|
||||
eval "MASTER$1_RUNNING=1"
|
||||
}
|
||||
|
||||
start_slave()
|
||||
@ -1162,26 +1180,27 @@ stop_slave_threads ()
|
||||
|
||||
stop_master ()
|
||||
{
|
||||
if [ x$MASTER_RUNNING = x1 ]
|
||||
eval "this_master_running=\$MASTER$1_RUNNING"
|
||||
if [ x$this_master_running = x1 ]
|
||||
then
|
||||
pid=`$CAT $MASTER_MYPID`
|
||||
manager_term $pid master
|
||||
if [ $? != 0 ] && [ -f $MASTER_MYPID ]
|
||||
pid=`$CAT $MASTER_MYPID$1`
|
||||
manager_term $pid master $1
|
||||
if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
|
||||
then # try harder!
|
||||
$ECHO "master not cooperating with mysqladmin, will try manual kill"
|
||||
kill $pid
|
||||
sleep_until_file_deleted $pid $MASTER_MYPID
|
||||
if [ -f $MASTER_MYPID ] ; then
|
||||
sleep_until_file_deleted $pid $MASTER_MYPID$1
|
||||
if [ -f $MASTER_MYPID$1 ] ; then
|
||||
$ECHO "master refused to die. Sending SIGKILL"
|
||||
kill -9 `$CAT $MASTER_MYPID`
|
||||
$RM -f $MASTER_MYPID
|
||||
kill -9 `$CAT $MASTER_MYPID$1`
|
||||
$RM -f $MASTER_MYPID$1
|
||||
else
|
||||
$ECHO "master responded to SIGTERM "
|
||||
fi
|
||||
else
|
||||
sleep $SLEEP_TIME_AFTER_RESTART
|
||||
fi
|
||||
MASTER_RUNNING=0
|
||||
eval "MASTER$1_RUNNING=0"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -1191,6 +1210,7 @@ mysql_stop ()
|
||||
$ECHO "Shutting-down MySQL daemon"
|
||||
$ECHO ""
|
||||
stop_master
|
||||
stop_master 1
|
||||
$ECHO "Master shutdown finished"
|
||||
stop_slave
|
||||
stop_slave 1
|
||||
@ -1279,16 +1299,24 @@ run_testcase ()
|
||||
;;
|
||||
esac
|
||||
stop_master
|
||||
stop_master 1
|
||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
||||
start_master
|
||||
if [ ! -z "$USE_NDBCLUSTER" ] ; then
|
||||
start_master 1
|
||||
fi
|
||||
TZ=$MY_TZ; export TZ
|
||||
else
|
||||
if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || [ -f $master_init_script ]
|
||||
then
|
||||
EXTRA_MASTER_OPT=""
|
||||
stop_master
|
||||
stop_master 1
|
||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
||||
start_master
|
||||
if [ ! -z "$USE_NDBCLUSTER" ] ; then
|
||||
start_master 1
|
||||
fi
|
||||
else
|
||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
||||
fi
|
||||
@ -1432,11 +1460,11 @@ then
|
||||
|
||||
if [ ! -z "$USE_NDBCLUSTER" ]
|
||||
then
|
||||
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
|
||||
then
|
||||
# Kill any running ndbcluster stuff
|
||||
./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop
|
||||
fi
|
||||
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
|
||||
then
|
||||
# Kill any running ndbcluster stuff
|
||||
./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove files that can cause problems
|
||||
@ -1445,6 +1473,7 @@ then
|
||||
|
||||
# Remove old berkeley db log files that can confuse the server
|
||||
$RM -f $MASTER_MYDDIR/log.*
|
||||
$RM -f $MASTER_MYDDIR"1"/log.*
|
||||
|
||||
wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
|
||||
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
|
||||
@ -1456,7 +1485,7 @@ then
|
||||
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
|
||||
then
|
||||
echo "Starting ndbcluster"
|
||||
if [ "$DO_BENCH" = 1 ]
|
||||
if [ "$DO_BENCH" = 1 -a ! "$DO_SMALL_BENCH" = 1 ]
|
||||
then
|
||||
NDBCLUSTER_OPTS=""
|
||||
else
|
||||
|
Reference in New Issue
Block a user