hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sunc...@apache.org
Subject hive git commit: HIVE-13760: Add a HIVE_QUERY_TIMEOUT configuration to kill a query if a query is running for more than the configured timeout value. (Zhihai Xu via Chao Sun)
Date Tue, 07 Jun 2016 17:39:19 GMT
Repository: hive
Updated Branches:
  refs/heads/master b7de5b81b -> 721423d22


HIVE-13760: Add a HIVE_QUERY_TIMEOUT configuration to kill a query if a query is running for
more than the configured timeout value. (Zhihai Xu via Chao Sun)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/721423d2
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/721423d2
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/721423d2

Branch: refs/heads/master
Commit: 721423d229d489fc29666248ce72723bcb6beda2
Parents: b7de5b8
Author: Zhihai Xu <zhihaixu2012@gmail.com>
Authored: Tue Jun 7 10:29:51 2016 -0700
Committer: Chao Sun <sunchao@apache.org>
Committed: Tue Jun 7 10:38:21 2016 -0700

----------------------------------------------------------------------
 common/src/java/org/apache/hadoop/hive/conf/HiveConf.java      | 6 +++++-
 .../org/apache/hive/service/cli/operation/SQLOperation.java    | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/721423d2/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index d06aa44..2d7489b 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2944,8 +2944,12 @@ public class HiveConf extends Configuration {
         "Comma separated list of configuration options which should not be read by normal
user like passwords"),
     HIVE_CONF_INTERNAL_VARIABLE_LIST("hive.conf.internal.variable.list",
         "hive.added.files.path,hive.added.jars.path,hive.added.archives.path",
-        "Comma separated list of variables which are used internally and should not be configurable.");
+        "Comma separated list of variables which are used internally and should not be configurable."),
 
+    HIVE_QUERY_TIMEOUT_SECONDS("hive.query.timeout.seconds", "0s",
+        new TimeValidator(TimeUnit.SECONDS),
+        "Timeout for Running Query in seconds. A nonpositive value means infinite. " +
+        "If the query timeout is also set by thrift API call, the smaller one will be taken.");
 
     public final String varname;
     private final String altName;

http://git-wip-us.apache.org/repos/asf/hive/blob/721423d2/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java b/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
index 33f95fb..3bf40eb 100644
--- a/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
+++ b/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
@@ -112,6 +112,12 @@ public class SQLOperation extends ExecuteStatementOperation {
     // TODO: call setRemoteUser in ExecuteStatementOperation or higher.
     super(parentSession, statement, confOverlay, runInBackground);
     this.queryTimeout = queryTimeout;
+    long timeout = HiveConf.getTimeVar(queryState.getConf(),
+        HiveConf.ConfVars.HIVE_QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+    if (timeout > 0 && (queryTimeout <= 0 || timeout < queryTimeout)) {
+      this.queryTimeout = timeout;
+    }
+
     setupSessionIO(parentSession.getSessionState());
     try {
       sqlOpDisplay = new SQLOperationDisplay(this);


Mime
View raw message