[BugFix] Remove the deregister logic from container (backport #63085) (#63514)

Signed-off-by: yandongxiao <yandongxiao@starrocks.com>
Co-authored-by: yandongxiao <yandongxiao@starrocks.com>
This commit is contained in:
mergify[bot] 2025-09-24 19:16:11 +08:00 committed by GitHub
parent c5ebf3e063
commit c36f909425
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 30 deletions

View File

@ -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