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


##########
docker/thirdparties/run-thirdparties-docker.sh:
##########
@@ -1492,18 +1584,38 @@ start_kerberos() {
     if ! awk -v ip="${IP_HOST}" '$1 == ip && $2 == "hadoop-master-2" { found = 
1 } END { exit !found }' /etc/hosts; then
         sudo sed -i "1i${IP_HOST} hadoop-master-2" /etc/hosts
     fi
-    register_stack_metadata "kerberos" 
"${ROOT}/docker-compose/kerberos/kerberos.yaml" ""
-    compose_cmd "${ROOT}/docker-compose/kerberos/kerberos.yaml" "" down 
--remove-orphans
-    sudo rm -rf "${ROOT}"/docker-compose/kerberos/data
+    register_stack_metadata "kerberos" "${KERBEROS_DIR}/kerberos.yaml" ""
+    compose_cmd "${KERBEROS_DIR}/kerberos.yaml" "" down --remove-orphans
+    sudo rm -rf "${KERBEROS_DIR}/data"
     if [[ "${STOP}" -ne 1 ]]; then
         echo "PREPARE KERBEROS DATA"
-        rm -rf "${ROOT}"/docker-compose/kerberos/two-kerberos-hives/*.keytab
-        rm -rf "${ROOT}"/docker-compose/kerberos/two-kerberos-hives/*.jks
-        rm -rf "${ROOT}"/docker-compose/kerberos/two-kerberos-hives/*.conf
-        compose_cmd "${ROOT}/docker-compose/kerberos/kerberos.yaml" "" up 
--remove-orphans --wait -d
-        sudo ln -sfn "${ROOT}/docker-compose/kerberos/two-kerberos-hives" 
/keytabs
-        sudo cp "${ROOT}"/docker-compose/kerberos/common/conf/doris-krb5.conf 
/keytabs/krb5.conf
-        sudo cp "${ROOT}"/docker-compose/kerberos/common/conf/doris-krb5.conf 
/etc/krb5.conf
+        rm -rf "${KERBEROS_DIR}"/two-kerberos-hives/*.keytab
+        rm -rf "${KERBEROS_DIR}"/two-kerberos-hives/*.jks
+        rm -rf "${KERBEROS_DIR}"/two-kerberos-hives/*.conf
+        compose_cmd "${KERBEROS_DIR}/kerberos.yaml" "" up --build 
--remove-orphans -d
+        trap 'cleanup_kerberos_readiness_jobs "${readiness_pids[@]}"' EXIT
+        trap 'exit 143' TERM
+        trap 'exit 130' INT
+        for container in "${containers[@]}"; do
+            wait_for_kerberos_ready "${container}" &
+            readiness_pids+=("$!")
+        done
+        for pid in "${readiness_pids[@]}"; do
+            if ! wait "${pid}"; then

Review Comment:
   These waits are ordered, so a failure from the second readiness worker is 
not observed while the first worker is still pending. For example, if Kerberos 
realm 2 exits immediately but realm 1 stays alive without printing the 
readiness marker, this blocks on realm 1 until its `timeout 20m` expires and 
only then reaches the already-failed realm 2 PID. That turns an actionable 
startup failure into a 20-minute stall. Please collect completions as they 
arrive and, on the first nonzero result, terminate and reap every remaining 
readiness job before returning the failure.



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