You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2022/09/29 21:36:15 UTC

[impala] 02/02: IMPALA-11621: Remove hiveserver2.pid when shutting down HiveServer2

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 0a711cd5cb4d73bff1ea734cfe4dd2023d5b5f1d
Author: Joe McDonnell <jo...@cloudera.com>
AuthorDate: Wed Sep 28 11:21:28 2022 -0700

    IMPALA-11621: Remove hiveserver2.pid when shutting down HiveServer2
    
    In HIVE-22193, Hive added graceful shutdown for HiveServer2.
    This modified some of the startup scripts to maintain a
    pid file. On startup, it verified that the pid is not already
    running. Impala uses the hive startup script, but it kills
    HiveServer2 with testdata/bin/kill-java-service.sh. If the
    pid file outlives the process, then the OS may reuse the
    pid and this can cause problems on startup.
    
    This modifies testdata/bin/kill-hive-server.sh to remove
    the pid file. testdata/bin/kill-java-service.sh would fail
    if it did not kill HiveServer2, so it should be safe to
    remove the pid file after the kill-java-service.sh call.
    
    Testing:
     - Verified the hiveserver2.pid file is removed after shutting down.
    
    Change-Id: I813626d06829a86854c6d2c1715f0c5f5109836d
    Reviewed-on: http://gerrit.cloudera.org:8080/19051
    Reviewed-by: Joe McDonnell <jo...@cloudera.com>
    Tested-by: Joe McDonnell <jo...@cloudera.com>
---
 testdata/bin/kill-hive-server.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testdata/bin/kill-hive-server.sh b/testdata/bin/kill-hive-server.sh
index b79435c40..20345de1c 100755
--- a/testdata/bin/kill-hive-server.sh
+++ b/testdata/bin/kill-hive-server.sh
@@ -47,6 +47,11 @@ done
 if [[ $KILL_HIVESERVER -eq 1 ]]; then
   echo Stopping Hive server.
   "$DIR"/kill-java-service.sh -c HiveServer
+  # The kill-java-service.sh command would fail if it did not succeed in
+  # stopping HiveServer2. Remove the pid file so that a reuse of the pid cannot
+  # interfere with starting HiveServer2. By default, the pid is written to
+  # $HIVE_CONF_DIR.
+  rm -f "$HIVE_CONF_DIR"/hiveserver2.pid
 fi
 if [[ $KILL_METASTORE -eq 1 ]]; then
   echo Stopping Hive metastore.