summaryrefslogtreecommitdiff
path: root/mysql-test/ndb/ndbcluster.sh
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-11-08 17:53:32 +0200
committerunknown <monty@mysql.com>2004-11-08 17:53:32 +0200
commit47a5ac0e30599ea287fd206d4d21b7c304fd8c80 (patch)
tree8b26ea79c2cf98b50f42ec02a9c92e62c98f6276 /mysql-test/ndb/ndbcluster.sh
parent87abc13d6fcca99cccfdc76782cbbd0b880fa9bf (diff)
parent8793e2197aeab3a2d434a180f804f295de3a3cce (diff)
downloadmariadb-git-47a5ac0e30599ea287fd206d4d21b7c304fd8c80.tar.gz
Merge with 4.1 to get new thd->mem_root handling
BitKeeper/etc/ignore: auto-union client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged innobase/include/row0mysql.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_in.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/type_float.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/innodb.test: Auto merged mysql-test/t/user_var.test: Auto merged mysql-test/t/variables.test: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_ndbcluster.h: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_db.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'mysql-test/ndb/ndbcluster.sh')
-rw-r--r--mysql-test/ndb/ndbcluster.sh64
1 files changed, 57 insertions, 7 deletions
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index d7b115d71b6..9c6b6093b93 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,14 @@ 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
+ 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