diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2004-11-04 15:57:29 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2004-11-04 15:57:29 +0000 |
commit | 76211d8689c28fbc49625998b237dacbd9f13408 (patch) | |
tree | bfdcafc708f5fe7a4d5f7613b93445b1207453d4 /mysql-test/ndb | |
parent | c9a75ccf1acfc4578496a1606fcf009301366997 (diff) | |
download | mariadb-git-76211d8689c28fbc49625998b237dacbd9f13408.tar.gz |
updated start script for ndbcluster to make better cleanup
changed to use new switch
mysql-test/ndb/ndbcluster.sh:
updated start script for ndbcluster to make better cleanup
ndb/test/run-test/main.cpp:
changed to use new switch
Diffstat (limited to 'mysql-test/ndb')
-rw-r--r-- | mysql-test/ndb/ndbcluster.sh | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index d7b115d71b6..9894e70c788 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -102,12 +102,43 @@ if [ ! -x "$exec_mgmtsrvr" ]; then echo "$exec_mgmtsrvr missing" exit 1 fi +if [ ! -x "$exec_waiter" ]; then + echo "$exec_waiter missing" + exit 1 +fi + +exec_mgmtclient="$exec_mgmtclient --no-defaults" +exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults" +exec_ndb="$exec_ndb --no-defaults" +exec_waiter="$exec_waiter --no-defaults" ndb_host="localhost" ndb_mgmd_port=$port_base NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port" export NDB_CONNECTSTRING +sleep_until_file_created () { + file=$1 + loop=$2 + org_time=$2 + message=$3 + while (test $loop -gt 0) + do + if [ -r $file ] + then + return 0 + fi + sleep 1 + loop=`expr $loop - 1` + done + if [ $message ] + then + echo $message + fi + echo "ERROR: $file was not created in $org_time seconds; Aborting" + return 1; +} + start_default_ndbcluster() { # do some checks @@ -127,8 +158,8 @@ port_transporter=`expr $ndb_mgmd_port + 2` # Start management server as deamon # Edit file system path and ports in config file - if [ $initial_ndb ] ; then + rm -f $fs_ndb/ndb_* sed \ -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ @@ -150,21 +181,32 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else echo "Unable to start $exec_mgmtsrvr from `pwd`" exit 1 fi - +if sleep_until_file_created $fs_ndb/ndb_3.pid 30 +then :; else + exit 1 +fi cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # Start database node echo "Starting ndbd" ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) - +if sleep_until_file_created $fs_ndb/ndb_1.pid 30 +then :; else + stop_default_ndbcluster + exit 1 +fi cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # Start database node echo "Starting ndbd" ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) - +if sleep_until_file_created $fs_ndb/ndb_2.pid 30 +then :; else + stop_default_ndbcluster + exit 1 +fi cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # test if Ndb Cluster starts properly @@ -172,6 +214,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" echo "Waiting for started..." if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else echo "Ndbcluster startup failed" + stop_default_ndbcluster exit 1 fi @@ -198,10 +241,12 @@ if [ -f "$fs_ndb/$pidfile" ] ; then attempt=0 while [ $attempt -lt 10 ] ; do new_kill_pid="" + kill_pids2="" for p in $kill_pids ; do kill -0 $p 2> /dev/null if [ $? -eq 0 ] ; then new_kill_pid="$p $new_kill_pid" + kill_pids2="-$p $kill_pids2" fi done kill_pids=$new_kill_pid @@ -211,9 +256,10 @@ if [ -f "$fs_ndb/$pidfile" ] ; then sleep 1 attempt=`expr $attempt + 1` done - if [ "$kill_pids" != "" ] ; then - echo "Failed to shutdown ndbcluster, executing kill "$kill_pids - kill $kill_pids + if [ "$kill_pids2" != "" ] ; then + do_command="kill -9 $kill_pids2" + echo "Failed to shutdown ndbcluster, executing "$do_command + $do_command fi rm "$fs_ndb/$pidfile" fi |