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 <joemcdonnell@cloudera.com>
Tested-by: Joe McDonnell <joemcdonnell@cloudera.com>
This commit is contained in:
Joe McDonnell
2022-09-28 11:21:28 -07:00
parent 3577030df6
commit 0a711cd5cb

View File

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