Commit c5b4eb56 authored by unknown's avatar unknown

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
parent ce696490
......@@ -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
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment