From 76211d8689c28fbc49625998b237dacbd9f13408 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 15:57:29 +0000 Subject: 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 --- mysql-test/ndb/ndbcluster.sh | 60 ++++++++++++++++++++++++++++++++++++++------ ndb/test/run-test/main.cpp | 2 +- 2 files changed, 54 insertions(+), 8 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 diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index 22799a9a1b2..e5f73bc6a5c 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -459,7 +459,7 @@ setup_config(atrt_config& config){ proc.m_type = atrt_process::NDB_MGM; proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd"); proc.m_proc.m_path.assign(dir).append("/libexec/ndb_mgmd"); - proc.m_proc.m_args = "--nodaemon -c initconfig.txt"; + proc.m_proc.m_args = "--nodaemon -f config.ini"; proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index); connect_string.appfmt("host=%s:%d;", proc.m_hostname.c_str(), proc.m_ndb_mgm_port); -- cgit v1.2.1 From a68b4095ac7267631f866c1382955239d9afa33e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Nov 2004 16:24:41 +0000 Subject: to make sure we get the kill right on the different platforms --- mysql-test/ndb/ndbcluster.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index 9894e70c788..9c6b6093b93 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -257,9 +257,13 @@ if [ -f "$fs_ndb/$pidfile" ] ; then attempt=`expr $attempt + 1` done if [ "$kill_pids2" != "" ] ; then - do_command="kill -9 $kill_pids2" - echo "Failed to shutdown ndbcluster, executing "$do_command - $do_command + echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2 + kill -9 -- $kill_pids2 2> /dev/null + /bin/kill -9 -- $kill_pids2 2> /dev/null + /usr/bin/kill -9 -- $kill_pids2 2> /dev/null + kill -9 $kill_pids2 2> /dev/null + /bin/kill -9 $kill_pids2 2> /dev/null + /usr/bin/kill -9 $kill_pids2 2> /dev/null fi rm "$fs_ndb/$pidfile" fi -- cgit v1.2.1