hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss...@apache.org
Subject hive git commit: HIVE-14810. Fix failing test: TestMetaStoreMetrics.testMetaDataCounts. (Barna Zsombor Klara, reviewed by Siddharth Seth)
Date Mon, 03 Oct 2016 18:06:41 GMT
Repository: hive
Updated Branches:
  refs/heads/master 84e49742a -> b86342f0d


HIVE-14810. Fix failing test: TestMetaStoreMetrics.testMetaDataCounts. (Barna Zsombor Klara,
reviewed by Siddharth Seth)


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

Branch: refs/heads/master
Commit: b86342f0d44be9655c2d44b8cf666e540969afca
Parents: 84e4974
Author: Siddharth Seth <sseth@apache.org>
Authored: Mon Oct 3 11:06:07 2016 -0700
Committer: Siddharth Seth <sseth@apache.org>
Committed: Mon Oct 3 11:06:07 2016 -0700

----------------------------------------------------------------------
 .../metastore/TestHiveMetaStoreStatsMerge.java  |  2 +-
 .../hive/metastore/TestMetaStoreMetrics.java    | 21 +++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b86342f0/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreStatsMerge.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreStatsMerge.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreStatsMerge.java
index d6df32b..600aef4 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreStatsMerge.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreStatsMerge.java
@@ -66,7 +66,7 @@ public class TestHiveMetaStoreStatsMerge extends TestCase {
   private final Database db = new Database();
   private Table table = new Table();
 
-  private static final String dbName = "hive3252";
+  private static final String dbName = "hive3253";
   private static final String tblName = "tmptbl";
 
   @Override

http://git-wip-us.apache.org/repos/asf/hive/blob/b86342f0/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 f231af7..b462b2a 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
@@ -77,6 +77,16 @@ public class TestMetaStoreMetrics {
 
   @Test
   public void testMetaDataCounts() throws Exception {
+    CodahaleMetrics metrics = (CodahaleMetrics) MetricsFactory.getInstance();
+    String json = metrics.dumpJson();
+
+    int initDbCount = (new Integer((MetricsTestUtils.getJsonNode(json, MetricsTestUtils.GAUGE,
+        MetricsConstant.INIT_TOTAL_DATABASES)).asText())).intValue();
+    int initTblCount = (new Integer((MetricsTestUtils.getJsonNode(json, MetricsTestUtils.GAUGE,
+        MetricsConstant.INIT_TOTAL_TABLES)).asText())).intValue();
+    int initPartCount = (new Integer((MetricsTestUtils.getJsonNode(json, MetricsTestUtils.GAUGE,
+        MetricsConstant.INIT_TOTAL_PARTITIONS)).asText())).intValue();
+
     //1 databases created
     driver.run("create database testdb1");
 
@@ -113,9 +123,7 @@ public class TestMetaStoreMetrics {
     driver.run("use default");
     driver.run("drop database tempdb cascade");
 
-    //give timer thread a chance to print the metrics
-    CodahaleMetrics metrics = (CodahaleMetrics) MetricsFactory.getInstance();
-    String json = metrics.dumpJson();
+    json = metrics.dumpJson();
     MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.COUNTER, MetricsConstant.CREATE_TOTAL_DATABASES,
2);
     MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.COUNTER, MetricsConstant.CREATE_TOTAL_TABLES,
7);
     MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.COUNTER, MetricsConstant.CREATE_TOTAL_PARTITIONS,
9);
@@ -130,11 +138,10 @@ public class TestMetaStoreMetrics {
     baseHandler.init();
     baseHandler.updateMetrics();
 
-    //1 new db + default
     json = metrics.dumpJson();
-    MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.GAUGE, MetricsConstant.INIT_TOTAL_DATABASES,
2);
-    MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.GAUGE, MetricsConstant.INIT_TOTAL_TABLES,
4);
-    MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.GAUGE, MetricsConstant.INIT_TOTAL_PARTITIONS,
6);
+    MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.GAUGE, MetricsConstant.INIT_TOTAL_DATABASES,
initDbCount + 1);
+    MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.GAUGE, MetricsConstant.INIT_TOTAL_TABLES,
initTblCount + 4);
+    MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.GAUGE, MetricsConstant.INIT_TOTAL_PARTITIONS,
initPartCount + 6);
   }
 
 


Mime
View raw message