dengzhhu653 commented on code in PR #3386:
URL: https://github.com/apache/hive/pull/3386#discussion_r909329833


##########
bin/ext/hiveserver2.sh:
##########
@@ -16,24 +16,83 @@
 THISSERVICE=hiveserver2
 export SERVICE_LIST="${SERVICE_LIST}${THISSERVICE} "
 
+if [ "$HIVESERVER2_PID_DIR" = "" ]; then
+  HIVESERVER2_PID_DIR=$HIVE_CONF_DIR
+fi
+
+HIVESERVER2_PID=$HIVESERVER2_PID_DIR/hiveserver2.pid
+
+before_start() {
+  #ckeck if the process is not running
+  mkdir -p "$HIVESERVER2_PID_DIR"
+  if [ -f $HIVESERVER2_PID ]; then
+    if kill -0 $(cat $HIVESERVER2_PID) >/dev/null 2>&1; then
+      echo "HiveServer2 running as process $(cat $HIVESERVER2_PID).  Stop it 
first."
+      exit 1
+    fi
+  fi
+}
+
 hiveserver2() {
-  >&2 echo "$(timestamp): Starting HiveServer2"
-  CLASS=org.apache.hive.service.server.HiveServer2
-  if $cygwin; then
-    HIVE_LIB=`cygpath -w "$HIVE_LIB"`
+  if [ "$1" = "--graceful_stop" ]; then
+    pid=$2
+    if [ "$pid" = "" -a -f $HIVESERVER2_PID ]; then
+      pid=$(cat $HIVESERVER2_PID)
+    fi
+    if [ "$pid" != "" ]; then
+      timeout=$3
+      killAndWait $pid ${timeout:-1800}

Review Comment:
   Get the `timeout` value by issuing --getHiveConf 'timeout key' to the 
hiveserver2, which read it from hive-site.xml



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