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


##########
service/src/java/org/apache/hive/service/server/HiveServer2.java:
##########
@@ -438,7 +439,7 @@ public synchronized void init(HiveConf hiveConf) {
     }
 
     // Add a shutdown hook for catching SIGTERM & SIGINT
-    ShutdownHookManager.addShutdownHook(() -> hiveServer2.stop());
+    ShutdownHookManager.addShutdownHook(() -> graceful_stop());

Review Comment:
   Hi @nrg4878, thank you for the comment.
   The `graceful_stop` will check both timeout and number of running queries:
   
https://github.com/apache/hive/blob/746eba21e39965d56d358ef4c195f64054ef27ec/service/src/java/org/apache/hive/service/server/HiveServer2.java#L928
   If there's no running queries, then call `stop` to terminate the process 
with no delay.
   For long running queries(timeout happens), then this case will also call 
`stop`, the operation will cancel the running queries on stopping:
   
https://github.com/apache/hive/blob/746eba21e39965d56d358ef4c195f64054ef27ec/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java#L95-L105
   Besides the command will force shutdown the process when timeout and the 
process is still alive:
   
https://github.com/apache/hive/blob/746eba21e39965d56d358ef4c195f64054ef27ec/bin/ext/hiveserver2.sh#L91-L94
  



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