Signed-off-by: yandongxiao <yandongxiao@starrocks.com> Co-authored-by: yandongxiao <yandongxiao@starrocks.com>
This commit is contained in:
parent
c5ebf3e063
commit
c36f909425
|
|
@ -139,30 +139,8 @@ drop_my_self()
|
|||
|
||||
exit_clean()
|
||||
{
|
||||
log_stderr "Receives signal to exit ..."
|
||||
pidfile=$STARROCKS_HOME/bin/cn.pid
|
||||
if ! test -f $pidfile ; then
|
||||
log_stderr "Can't find $pidfile!"
|
||||
else
|
||||
pid=`cat $pidfile`
|
||||
if [[ "x$pid" == "x" ]] ; then
|
||||
log_stderr "Empty pid file!"
|
||||
else
|
||||
log_stderr "detect cn pid $pid exists ..."
|
||||
while true
|
||||
do
|
||||
if ps -p $pid &>/dev/null ; then
|
||||
log_stderr "cn process $pid is still alive ..."
|
||||
sleep $PROBE_INTERVAL
|
||||
else
|
||||
log_stderr "cn process $pid dead."
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
# remove myself from FE
|
||||
drop_my_self $svc_name
|
||||
log_stderr "Got SIGTERM, exit ..."
|
||||
exit 143
|
||||
}
|
||||
|
||||
svc_name=$1
|
||||
|
|
@ -186,11 +164,12 @@ if [[ "x$LOG_CONSOLE" == "x1" ]] ; then
|
|||
fi
|
||||
$STARROCKS_HOME/bin/start_cn.sh $addition_args
|
||||
ret=$?
|
||||
if [[ $ret -ne 0 && "x$LOG_CONSOLE" != "x1" ]] ; then
|
||||
nol=50
|
||||
log_stderr "Last $nol lines of cn.INFO ..."
|
||||
tail -n $nol $STARROCKS_HOME/log/cn.INFO
|
||||
log_stderr "Last $nol lines of cn.out ..."
|
||||
tail -n $nol $STARROCKS_HOME/log/cn.out
|
||||
|
||||
if [[ $ret -eq 0 || $ret -eq 137 ]] ; then
|
||||
# The reason why we need to sleep here is to avoid the pod being killed by k8s before the preStop hook is exited.
|
||||
# If the CN subprocess fails to start, we also want the entrypoint script to exit as soon as possible.
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
# keep the same return code from start_cn.sh
|
||||
exit $ret
|
||||
|
|
|
|||
Loading…
Reference in New Issue