You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sz...@apache.org on 2015/12/03 20:55:41 UTC

hive git commit: HIVE-12525 : Cleanup unused metrics in HMS (Szehon, reviewed by Jimmy Xiang)

Repository: hive
Updated Branches:
  refs/heads/master bef879d0a -> bdec08f9d


HIVE-12525 : Cleanup unused metrics in HMS (Szehon, reviewed by Jimmy Xiang)


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

Branch: refs/heads/master
Commit: bdec08f9dabcd0c50dc87003ee006c06d1e5903a
Parents: bef879d
Author: Szehon Ho <sz...@cloudera.com>
Authored: Thu Dec 3 11:54:38 2015 -0800
Committer: Szehon Ho <sz...@cloudera.com>
Committed: Thu Dec 3 11:55:31 2015 -0800

----------------------------------------------------------------------
 .../common/metrics/common/MetricsConstant.java  |  5 ----
 .../hive/metastore/TestMetaStoreMetrics.java    |  5 ----
 .../hadoop/hive/metastore/ObjectStore.java      | 29 --------------------
 3 files changed, 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/bdec08f9/common/src/java/org/apache/hadoop/hive/common/metrics/common/MetricsConstant.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/common/metrics/common/MetricsConstant.java b/common/src/java/org/apache/hadoop/hive/common/metrics/common/MetricsConstant.java
index f18aa6e..95e2bcf 100644
--- a/common/src/java/org/apache/hadoop/hive/common/metrics/common/MetricsConstant.java
+++ b/common/src/java/org/apache/hadoop/hive/common/metrics/common/MetricsConstant.java
@@ -29,11 +29,6 @@ public class MetricsConstant {
   public static final String OPEN_CONNECTIONS = "open_connections";
   public static final String OPEN_OPERATIONS = "open_operations";
 
-  public static final String JDO_ACTIVE_TRANSACTIONS = "active_jdo_transactions";
-  public static final String JDO_ROLLBACK_TRANSACTIONS = "rollbacked_jdo_transactions";
-  public static final String JDO_COMMIT_TRANSACTIONS = "committed_jdo_transactions";
-  public static final String JDO_OPEN_TRANSACTIONS = "opened_jdo_transactions";
-
   public static final String METASTORE_HIVE_LOCKS = "metastore_hive_locks";
   public static final String ZOOKEEPER_HIVE_SHAREDLOCKS = "zookeeper_hive_sharedlocks";
   public static final String ZOOKEEPER_HIVE_EXCLUSIVELOCKS = "zookeeper_hive_exclusivelocks";

http://git-wip-us.apache.org/repos/asf/hive/blob/bdec08f9/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreMetrics.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreMetrics.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreMetrics.java
index c9da95a..f571c7c 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreMetrics.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreMetrics.java
@@ -93,11 +93,6 @@ public class TestMetaStoreMetrics {
     JsonNode methodCounterNode = timersNode.path("api_get_all_databases");
     JsonNode methodCountNode = methodCounterNode.path("count");
     Assert.assertTrue(methodCountNode.asInt() > 0);
-
-    JsonNode countersNode = rootNode.path("counters");
-    JsonNode committedJdoTxNode = countersNode.path("committed_jdo_transactions");
-    JsonNode committedCountNode = committedJdoTxNode.path("count");
-    Assert.assertTrue(committedCountNode.asInt() > 0);
   }
 
 

http://git-wip-us.apache.org/repos/asf/hive/blob/bdec08f9/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 1a8913c..1c0ab6d 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -64,10 +64,6 @@ import org.apache.hadoop.hive.common.FileUtils;
 import org.apache.hadoop.hive.common.ObjectPair;
 import org.apache.hadoop.hive.common.classification.InterfaceAudience;
 import org.apache.hadoop.hive.common.classification.InterfaceStability;
-import org.apache.hadoop.hive.common.metrics.common.Metrics;
-import org.apache.hadoop.hive.common.metrics.common.MetricsConstant;
-import org.apache.hadoop.hive.common.metrics.common.MetricsFactory;
-import org.apache.hadoop.hive.common.metrics.common.MetricsVariable;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.metastore.api.AggrStats;
@@ -287,17 +283,6 @@ public class ObjectStore implements RawStore, Configurable {
 
       initialize(propsFromConf);
 
-      //Add metric for number of active JDO transactions.
-      Metrics metrics = MetricsFactory.getInstance();
-      if (metrics != null) {
-        metrics.addGauge(MetricsConstant.JDO_ACTIVE_TRANSACTIONS, new MetricsVariable() {
-          @Override
-          public Object getValue() {
-            return openTrasactionCalls;
-          }
-        });
-      }
-
       String partitionValidationRegex =
           hiveConf.get(HiveConf.ConfVars.METASTORE_PARTITION_NAME_WHITELIST_PATTERN.name());
       if (partitionValidationRegex != null && partitionValidationRegex.equals("")) {
@@ -472,7 +457,6 @@ public class ObjectStore implements RawStore, Configurable {
 
     boolean result = currentTransaction.isActive();
     debugLog("Open transaction: count = " + openTrasactionCalls + ", isActive = " + result);
-    incrementMetricsCount(MetricsConstant.JDO_OPEN_TRANSACTIONS);
     return result;
   }
 
@@ -511,7 +495,6 @@ public class ObjectStore implements RawStore, Configurable {
       currentTransaction.commit();
     }
 
-    incrementMetricsCount(MetricsConstant.JDO_COMMIT_TRANSACTIONS);
     return true;
   }
 
@@ -549,7 +532,6 @@ public class ObjectStore implements RawStore, Configurable {
       // from reattaching in future transactions
       pm.evictAll();
     }
-    incrementMetricsCount(MetricsConstant.JDO_ROLLBACK_TRANSACTIONS);
   }
 
   @Override
@@ -7331,17 +7313,6 @@ public class ObjectStore implements RawStore, Configurable {
     }
   }
 
-  private void incrementMetricsCount(String name) {
-    try {
-      Metrics metrics = MetricsFactory.getInstance();
-      if (metrics != null) {
-        metrics.incrementCounter(name);
-      }
-    } catch (Exception e) {
-      LOG.warn("Error Reporting JDO operation to Metrics system", e);
-    }
-  }
-
   private void debugLog(String message) {
     if (LOG.isDebugEnabled()) {
       LOG.debug(message + getCallStack());