github-actions[bot] commented on code in PR #65564:
URL: https://github.com/apache/doris/pull/65564#discussion_r3612494067


##########
docker/thirdparties/docker-compose/kerberos/entrypoint-hive-master.sh:
##########
@@ -15,83 +15,125 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+
 set -euo pipefail
-source /usr/local/common/hive-configure.sh
-source /usr/local/common/event-hook.sh
-
-echo "Configuring hive"
-configure /etc/hive/conf/hive-site.xml hive HIVE_SITE_CONF
-configure /etc/hive/conf/hiveserver2-site.xml hive HIVE_SITE_CONF
-configure /etc/hadoop/conf/core-site.xml core CORE_CONF
-configure /etc/hadoop/conf/hdfs-site.xml hdfs HDFS_CONF
-configure /etc/hadoop/conf/yarn-site.xml yarn YARN_CONF
-configure /etc/hadoop/conf/mapred-site.xml mapred MAPRED_CONF
-configure /etc/hive/conf/beeline-site.xml beeline BEELINE_SITE_CONF
-
-echo "Copying kerberos keytabs to keytabs/"
-mkdir -p /etc/hadoop-init.d/
-
-if [ "$1" == "1" ]; then
-    cp /etc/trino/conf/* /keytabs/
-elif [ "$1" == "2" ]; then
-    cp /etc/trino/conf/hive-presto-master.keytab 
/keytabs/other-hive-presto-master.keytab
-    cp /etc/trino/conf/presto-server.keytab /keytabs/other-presto-server.keytab
-else
-    echo "Invalid index parameter. Exiting."
-    exit 1
-fi
-cd /usr/hdp/3.1.0.0-78/hive/auxlib
-curl -O https://s3BucketName.s3Endpoint/regression/docker/hive3/jdom-1.1.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/aliyun-java-sdk-core-3.4.0.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/aliyun-java-sdk-ecs-4.2.0.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/aliyun-java-sdk-ram-3.0.0.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/aliyun-java-sdk-sts-3.0.0.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/jindo-core-6.3.4.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/jindo-core-linux-el7-aarch64-6.3.4.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/jindo-sdk-6.3.4.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/aws-java-sdk-bundle-1.11.375.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/hadoop-huaweicloud-3.1.1-hw-54.5.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/hadoop-cos-3.1.0-8.3.22.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/cos_api-bundle-5.6.244.4.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/hadoop-aws-3.2.1.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/paimon-hive-connector-3.1-1.3-SNAPSHOT.jar
-curl -O 
https://s3BucketName.s3Endpoint/regression/docker/hive3/gcs-connector-hadoop3-2.2.24-shaded.jar
-
-
-/usr/local/hadoop-run.sh &
-
-# check healthy hear
-echo "Waiting for hadoop to be healthy"
-
-for i in {1..60}; do
-    if /usr/local/health.sh; then
-        echo "Hadoop is healthy"
+
+: "${HOST:?}"
+: "${REALM:?}"
+: "${KDC_PORT:?}"
+: "${FS_PORT:?}"
+: "${HMS_PORT:?}"
+: "${HIVE_CLIENT_KEYTAB:?}"
+: "${PRESTO_CLIENT_KEYTAB:?}"
+
+export HADOOP_CONF_DIR=/opt/doris/conf
+export HIVE_CONF_DIR=/opt/doris/conf
+export KRB5_KDC_PROFILE=/opt/doris/conf/kdc.conf
+export PATH="/usr/local/sbin:/usr/sbin:${PATH}"
+export HADOOP_CLIENT_OPTS="-Xms192m -Xmx320m"
+
+readonly HDFS_PRINCIPAL="hdfs/${HOST}@${REALM}"
+readonly HTTP_PRINCIPAL="HTTP/${HOST}@${REALM}"
+readonly HIVE_PRINCIPAL="hive/${HOST}@${REALM}"
+readonly HIVE_CLIENT_PRINCIPAL="hive/presto-master.docker.cluster@${REALM}"
+readonly 
PRESTO_CLIENT_PRINCIPAL="presto-server/presto-master.docker.cluster@${REALM}"
+
+declare -a SERVICE_PIDS=()
+
+stop_services() {
+    kill "${SERVICE_PIDS[@]}" 2>/dev/null || true
+    wait "${SERVICE_PIDS[@]}" 2>/dev/null || true
+}
+
+trap stop_services EXIT INT TERM
+

Review Comment:
   This installs `stop_services` as the TERM/INT action, but that function 
returns successfully instead of terminating PID 1. If Docker stops the 
container while a foreground startup command such as NameNode formatting, a 
readiness sleep, or `schematool` is running, Bash runs the trap after that 
command and then continues into the next stages, potentially starting 
DataNode/HMS again until the 30-second grace period forces SIGKILL. Keep 
cleanup on EXIT and make the signal handlers exit so shutdown cannot resume 
initialization:
   
   ```suggestion
   trap stop_services EXIT
   trap 'exit 130' INT
   trap 'exit 143' TERM
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to