[
https://issues.apache.org/jira/browse/HIVE-22193?focusedWorklogId=796580&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796580
]
ASF GitHub Bot logged work on HIVE-22193:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Jul/22 07:02
Start Date: 30/Jul/22 07:02
Worklog Time Spent: 10m
Work Description: 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
Issue Time Tracking
-------------------
Worklog Id: (was: 796580)
Time Spent: 6h 40m (was: 6.5h)
> Graceful Shutdown HiveServer2
> -----------------------------
>
> Key: HIVE-22193
> URL: https://issues.apache.org/jira/browse/HIVE-22193
> Project: Hive
> Issue Type: Improvement
> Components: Server Infrastructure
> Reporter: chenshiyun
> Assignee: Zhihua Deng
> Priority: Major
> Labels: pull-request-available
> Time Spent: 6h 40m
> Remaining Estimate: 0h
>
> We have a lot of HiveSever2 servers deployed on production environment (about
> 10 nodes).
> However, if we want to change configuration or add patches, we would have to
> restart all of them one by one. So all the Hive Sql job running on the server
> will be defeated, and there may be some mistakes come up on the jdbc client
> occasionally.
> In the proposed changes, planning to add Graceful Shutdown HiveSever2 method
> to avoid affecting the production environment jobs
--
This message was sent by Atlassian Jira
(v8.20.10#820010)