You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ct...@apache.org on 2016/07/22 18:39:58 UTC

hive git commit: HIVE-14267: HS2 open_operations metrics not decremented when an operation gets timed out (Naveen Gangam, reviewed by Chaoyu Tang, Aihua Xu)

Repository: hive
Updated Branches:
  refs/heads/master 64a053b69 -> 589ced8f2


HIVE-14267: HS2 open_operations metrics not decremented when an operation gets timed out (Naveen Gangam, reviewed by Chaoyu Tang, Aihua Xu)


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

Branch: refs/heads/master
Commit: 589ced8f204736bb60509693d13e1bad2b107516
Parents: 64a053b
Author: ctang <ct...@cloudera.com>
Authored: Fri Jul 22 14:39:32 2016 -0400
Committer: ctang <ct...@cloudera.com>
Committed: Fri Jul 22 14:39:32 2016 -0400

----------------------------------------------------------------------
 .../hive/service/cli/operation/OperationManager.java      | 10 ++++++++++
 .../apache/hive/service/cli/session/HiveSessionImpl.java  |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/589ced8f/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java b/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java
index c26a611..fb328d7 100644
--- a/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java
+++ b/service/src/java/org/apache/hive/service/cli/operation/OperationManager.java
@@ -221,6 +221,16 @@ public class OperationManager extends AbstractService {
   private Operation removeTimedOutOperation(OperationHandle operationHandle) {
     Operation operation = handleToOperation.get(operationHandle);
     if (operation != null && operation.isTimedOut(System.currentTimeMillis())) {
+      LOG.info("Operation is timed out,operation=" + operation.getHandle() + ",state=" + operation.getState().toString());
+      Metrics metrics = MetricsFactory.getInstance();
+      if (metrics != null) {
+        try {
+          metrics.decrementCounter(MetricsConstant.OPEN_OPERATIONS);
+        } catch (Exception e) {
+          LOG.warn("Error decrementing open_operations metric, reported values may be incorrect", e);
+        }
+      }
+
       handleToOperation.remove(operationHandle, operation);
       if (operation instanceof SQLOperation) {
         removeSaveSqlOperationDisplay(operationHandle);

http://git-wip-us.apache.org/repos/asf/hive/blob/589ced8f/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
index ef37ff5..72ad86c 100644
--- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
+++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
@@ -793,7 +793,7 @@ public class HiveSessionImpl implements HiveSession {
         try {
           operation.close();
         } catch (Exception e) {
-          LOG.warn("Exception is thrown closing timed-out operation " + operation.getHandle(), e);
+          LOG.warn("Exception is thrown closing timed-out operation, reported open_operations metrics may be incorrect " + operation.getHandle(), e);
         }
       }
     } finally {