Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 6c66f2095 -> 20f1adbd9


AMBARI-17779 : Fix enable/disable normalizer issue in AMS (avijayan)


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

Branch: refs/heads/branch-2.4
Commit: 20f1adbd9ff103c12363431c35d30c7a2065167c
Parents: 6c66f20
Author: Aravindan Vijayan <[email protected]>
Authored: Tue Jul 19 07:08:54 2016 -0700
Committer: Aravindan Vijayan <[email protected]>
Committed: Tue Jul 19 07:16:41 2016 -0700

----------------------------------------------------------------------
 ambari-metrics/ambari-metrics-assembly/pom.xml            |  7 ++++++-
 ambari-metrics/ambari-metrics-timelineservice/pom.xml     | 10 ++++------
 .../metrics/timeline/HBaseTimelineMetricStore.java        |  3 ++-
 .../metrics/timeline/PhoenixHBaseAccessor.java            |  8 ++++----
 .../metrics/timeline/ITPhoenixHBaseAccessor.java          |  8 ++++----
 5 files changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/20f1adbd/ambari-metrics/ambari-metrics-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/pom.xml 
b/ambari-metrics/ambari-metrics-assembly/pom.xml
index ea180f5..6cc7d2c 100644
--- a/ambari-metrics/ambari-metrics-assembly/pom.xml
+++ b/ambari-metrics/ambari-metrics-assembly/pom.xml
@@ -240,6 +240,9 @@
                       <sources>
                         <source>
                           <location>${collector.dir}/target/lib</location>
+                          <excludes>
+                            <exclude>*tests.jar</exclude>
+                          </excludes>
                         </source>
                         <source>
                           <location>
@@ -257,6 +260,7 @@
                           <excludes>
                             <exclude>bin/**</exclude>
                             <exclude>bin/*</exclude>
+                            <exclude>lib/*tests.jar</exclude>
                           </excludes>
                         </source>
                       </sources>
@@ -770,6 +774,7 @@
                 <data>
                   <src>${collector.dir}/target/lib</src>
                   <type>directory</type>
+                  <excludes>*tests.jar</excludes>
                   <mapper>
                     <type>perm</type>
                     <filemode>644</filemode>
@@ -779,7 +784,7 @@
                 <data>
                   <src>${collector.dir}/target/embedded/${hbase.folder}</src>
                   <type>directory</type>
-                  <excludes>bin/**,bin/*</excludes>
+                  <excludes>bin/**,bin/*,lib/*tests.jar</excludes>
                   <mapper>
                     <type>perm</type>
                     <prefix>/usr/lib/ams-hbase</prefix>

http://git-wip-us.apache.org/repos/asf/ambari/blob/20f1adbd/ambari-metrics/ambari-metrics-timelineservice/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/pom.xml 
b/ambari-metrics/ambari-metrics-timelineservice/pom.xml
index a0e4adf..4444cce 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/pom.xml
+++ b/ambari-metrics/ambari-metrics-timelineservice/pom.xml
@@ -124,6 +124,9 @@
               <sources>
                 <source>
                   <location>target/lib</location>
+                  <excludes>
+                  <exclude>*tests.jar</exclude>
+                  </excludes>
                 </source>
                 <source>
                   
<location>${project.build.directory}/${project.artifactId}-${project.version}.jar</location>
@@ -139,6 +142,7 @@
                   <excludes>
                     <exclude>bin/**</exclude>
                     <exclude>bin/*</exclude>
+                    <exclude>lib/*tests.jar</exclude>
                   </excludes>
                 </source>
               </sources>
@@ -251,12 +255,6 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.phoenix</groupId>
-      <artifactId>phoenix-server</artifactId>
-      <version>${phoenix.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.phoenix</groupId>
       <artifactId>phoenix-core</artifactId>
       <version>${phoenix.version}</version>
       <exclusions>

http://git-wip-us.apache.org/repos/asf/ambari/blob/20f1adbd/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java
index dd1ae3f..0b82506 100644
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java
+++ 
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java
@@ -210,7 +210,8 @@ public class HBaseTimelineMetricStore extends 
AbstractService implements Timelin
       } else {
         LOG.info("Invalid Input for TopN query. Ignoring TopN Request.");
       }
-    } else if (hostnames != null && hostnames.size() > defaultTopNHostsLimit) {
+    } else if (startTime != null && hostnames != null && hostnames.size() > 
defaultTopNHostsLimit) {
+      // if (timeseries query AND hostnames passed AND size(hostnames) > limit)
       LOG.info("Requesting data for more than " + defaultTopNHostsLimit +  " 
Hosts. " +
         "Defaulting to Top " + defaultTopNHostsLimit);
       conditionBuilder.topN(defaultTopNHostsLimit);

http://git-wip-us.apache.org/repos/asf/ambari/blob/20f1adbd/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index 16ebcd9..dfd730d 100644
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ 
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -488,7 +488,7 @@ public class PhoenixHBaseAccessor {
   }
 
   protected void initPoliciesAndTTL() {
-    boolean enableNormalizer = 
hbaseConf.getBoolean("hbase.normalizer.enabled", true);
+    boolean enableNormalizer = 
hbaseConf.getBoolean("hbase.normalizer.enabled", false);
     boolean enableFifoCompaction = 
metricsConf.getBoolean("timeline.metrics.hbase.fifo.compaction.enabled", true);
 
     HBaseAdmin hBaseAdmin = null;
@@ -504,9 +504,9 @@ public class PhoenixHBaseAccessor {
           boolean modifyTable = false;
           HTableDescriptor tableDescriptor = 
hBaseAdmin.getTableDescriptor(tableName.getBytes());
 
-          if (enableNormalizer && !tableDescriptor.isNormalizationEnabled()) {
-            tableDescriptor.setNormalizationEnabled(true);
-            LOG.info("Enabling normalizer for " + tableName);
+          if (enableNormalizer ^ tableDescriptor.isNormalizationEnabled()) {
+            tableDescriptor.setNormalizationEnabled(enableNormalizer);
+            LOG.info("Normalizer set to " + enableNormalizer + " for " + 
tableName);
             modifyTable = true;
           }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/20f1adbd/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
index 7c6e7f4..d93cabc 100644
--- 
a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
+++ 
b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/ITPhoenixHBaseAccessor.java
@@ -325,8 +325,8 @@ public class ITPhoenixHBaseAccessor extends 
AbstractMiniHBaseClusterTest {
     // Verify policies are unset
     for (String tableName : PHOENIX_TABLES) {
       HTableDescriptor tableDescriptor = 
hBaseAdmin.getTableDescriptor(tableName.getBytes());
-
-      Assert.assertFalse("Normalizer disabled by default.", 
tableDescriptor.isNormalizationEnabled());
+      tableDescriptor.setNormalizationEnabled(true);
+      Assert.assertTrue("Normalizer enabled.", 
tableDescriptor.isNormalizationEnabled());
       Assert.assertNull("Default compaction policy is null.",
         tableDescriptor.getConfigurationValue(HSTORE_COMPACTION_CLASS_KEY));
 
@@ -364,7 +364,7 @@ public class ITPhoenixHBaseAccessor extends 
AbstractMiniHBaseClusterTest {
         LOG.debug("Table: " + tableName + ", normalizerEnabled = " + 
normalizerEnabled);
         LOG.debug("Table: " + tableName + ", compactionPolicy = " + 
compactionPolicy);
         // Best effort for 20 seconds
-        if (!normalizerEnabled || compactionPolicy == null) {
+        if (normalizerEnabled || compactionPolicy == null) {
           Thread.sleep(2000l);
         }
         if (tableName.equals(METRICS_RECORD_TABLE_NAME)) {
@@ -375,7 +375,7 @@ public class ITPhoenixHBaseAccessor extends 
AbstractMiniHBaseClusterTest {
       }
     }
 
-    Assert.assertTrue("Normalizer enabled.", normalizerEnabled);
+    Assert.assertFalse("Normalizer disabled.", normalizerEnabled);
     Assert.assertTrue("Durability Set.", tableDurabilitySet);
     Assert.assertEquals("FIFO compaction policy is set.", 
FIFO_COMPACTION_POLICY_CLASS, compactionPolicy);
     Assert.assertEquals("Precision TTL value not changed.", String.valueOf(2 * 
86400), precisionTtl);

Reply via email to