Commit 02af97cc authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1

parents 9afd24f0 a68b4095
...@@ -102,12 +102,43 @@ if [ ! -x "$exec_mgmtsrvr" ]; then ...@@ -102,12 +102,43 @@ if [ ! -x "$exec_mgmtsrvr" ]; then
echo "$exec_mgmtsrvr missing" echo "$exec_mgmtsrvr missing"
exit 1 exit 1
fi 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_host="localhost"
ndb_mgmd_port=$port_base ndb_mgmd_port=$port_base
NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port" NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
export NDB_CONNECTSTRING 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() { start_default_ndbcluster() {
# do some checks # do some checks
...@@ -127,8 +158,8 @@ port_transporter=`expr $ndb_mgmd_port + 2` ...@@ -127,8 +158,8 @@ port_transporter=`expr $ndb_mgmd_port + 2`
# Start management server as deamon # Start management server as deamon
# Edit file system path and ports in config file # Edit file system path and ports in config file
if [ $initial_ndb ] ; then if [ $initial_ndb ] ; then
rm -f $fs_ndb/ndb_*
sed \ sed \
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \ -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
...@@ -150,21 +181,32 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else ...@@ -150,21 +181,32 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`" echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1 exit 1
fi 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" cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node # Start database node
echo "Starting ndbd" echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) ( 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" cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node # Start database node
echo "Starting ndbd" echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & ) ( 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" cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# test if Ndb Cluster starts properly # test if Ndb Cluster starts properly
...@@ -172,6 +214,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" ...@@ -172,6 +214,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
echo "Waiting for started..." echo "Waiting for started..."
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
echo "Ndbcluster startup failed" echo "Ndbcluster startup failed"
stop_default_ndbcluster
exit 1 exit 1
fi fi
...@@ -198,10 +241,12 @@ if [ -f "$fs_ndb/$pidfile" ] ; then ...@@ -198,10 +241,12 @@ if [ -f "$fs_ndb/$pidfile" ] ; then
attempt=0 attempt=0
while [ $attempt -lt 10 ] ; do while [ $attempt -lt 10 ] ; do
new_kill_pid="" new_kill_pid=""
kill_pids2=""
for p in $kill_pids ; do for p in $kill_pids ; do
kill -0 $p 2> /dev/null kill -0 $p 2> /dev/null
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
new_kill_pid="$p $new_kill_pid" new_kill_pid="$p $new_kill_pid"
kill_pids2="-$p $kill_pids2"
fi fi
done done
kill_pids=$new_kill_pid kill_pids=$new_kill_pid
...@@ -211,9 +256,14 @@ if [ -f "$fs_ndb/$pidfile" ] ; then ...@@ -211,9 +256,14 @@ if [ -f "$fs_ndb/$pidfile" ] ; then
sleep 1 sleep 1
attempt=`expr $attempt + 1` attempt=`expr $attempt + 1`
done done
if [ "$kill_pids" != "" ] ; then if [ "$kill_pids2" != "" ] ; then
echo "Failed to shutdown ndbcluster, executing kill "$kill_pids echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2
kill $kill_pids 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 fi
rm "$fs_ndb/$pidfile" rm "$fs_ndb/$pidfile"
fi fi
......
...@@ -459,7 +459,7 @@ setup_config(atrt_config& config){ ...@@ -459,7 +459,7 @@ setup_config(atrt_config& config){
proc.m_type = atrt_process::NDB_MGM; proc.m_type = atrt_process::NDB_MGM;
proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd"); 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_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); proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index);
connect_string.appfmt("host=%s:%d;", connect_string.appfmt("host=%s:%d;",
proc.m_hostname.c_str(), proc.m_ndb_mgm_port); 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