ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject ambari git commit: AMBARI-12400. Blueprint config processor should retain property hbase.coprocessor.master.classes with default value (smohanty)
Date Mon, 13 Jul 2015 21:58:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 3913b5a9a -> 465f958ed


AMBARI-12400. Blueprint config processor should retain property hbase.coprocessor.master.classes
with default value (smohanty)


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

Branch: refs/heads/branch-2.1
Commit: 465f958ed5bb71a4dc9e8fde866aa9fbae567dd4
Parents: 3913b5a
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Mon Jul 13 14:57:34 2015 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Mon Jul 13 14:58:19 2015 -0700

----------------------------------------------------------------------
 .../BlueprintConfigurationProcessor.java        | 21 +++++++++++++++++++-
 .../BlueprintConfigurationProcessorTest.java    | 17 ++++++++++++++--
 2 files changed, 35 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/465f958e/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index f567c64..14b13ef 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -24,6 +24,7 @@ import org.apache.ambari.server.topology.Cardinality;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.Configuration;
 import org.apache.ambari.server.topology.HostGroupInfo;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -64,6 +65,8 @@ public class BlueprintConfigurationProcessor {
 
   private final static String CLUSTER_ENV_CONFIG_TYPE_NAME = "cluster-env";
 
+  private final static String HBASE_SITE_HBASE_COPROCESSOR_MASTER_CLASSES = "hbase.coprocessor.master.classes";
+
   /**
    * Single host topology updaters
    */
@@ -257,6 +260,20 @@ public class BlueprintConfigurationProcessor {
   }
 
   /**
+   * Returns true if property should be retained with default value instead of deleting
+   * TODO: This is a temporary work-around till BP integrates with stack advisor
+   * @param propertyName
+   * @return
+   */
+  private static boolean shouldPropertyBeStoredWithDefault(String propertyName) {
+    if (!StringUtils.isBlank(propertyName) && HBASE_SITE_HBASE_COPROCESSOR_MASTER_CLASSES.equals(propertyName))
{
+      return true;
+    }
+
+    return false;
+  }
+
+  /**
    * Update properties for blueprint export.
    * This involves converting concrete topology information to host groups.
    */
@@ -740,7 +757,9 @@ public class BlueprintConfigurationProcessor {
     for(PropertyFilter filter : clusterUpdatePropertyFilters) {
       try {
         if (!filter.isPropertyIncluded(propertyName, propertyValue, propertyType, topology))
{
-          return true;
+          if (!shouldPropertyBeStoredWithDefault(propertyName)) {
+            return true;
+          }
         }
       } catch (Throwable throwable) {
         // if any error occurs during a filter execution, just log it

http://git-wip-us.apache.org/repos/asf/ambari/blob/465f958e/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index c8daf09..7117b05 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -4026,12 +4026,13 @@ public class BlueprintConfigurationProcessorTest {
     // setup properties for HBase to simulate the case of authorization being off
     hbaseSiteProperties.put("hbase.security.authorization", "false");
     hbaseSiteProperties.put("hbase.coprocessor.regionserver.classes", " ");
+    hbaseSiteProperties.put("hbase.coprocessor.master.classes", "");
 
     Map<String, Stack.ConfigProperty> mapOfMetadata =
       new HashMap<String, Stack.ConfigProperty>();
 
     // simulate the stack dependencies for these Hive properties, that are dependent upon
-    // hive.server2.authorization being enabled
+    // hbase.security.authorization being enabled
     Stack.ConfigProperty configProperty1 =
       new Stack.ConfigProperty("hbase-site", "hbase.coprocessor.regionserver.classes", "
") {
         @Override
@@ -4041,7 +4042,17 @@ public class BlueprintConfigurationProcessorTest {
         }
       };
 
+    Stack.ConfigProperty configProperty2 =
+        new Stack.ConfigProperty("hbase-site", "hbase.coprocessor.master.classes", "") {
+          @Override
+          Set<PropertyDependencyInfo> getDependsOnProperties() {
+            PropertyDependencyInfo dependencyInfo = new PropertyDependencyInfo("hbase-site",
"hbase.security.authorization");
+            return Collections.singleton(dependencyInfo);
+          }
+        };
+
     mapOfMetadata.put("hbase.coprocessor.regionserver.classes", configProperty1);
+    mapOfMetadata.put("hbase.coprocessor.master.classes", configProperty2);
 
     // defaults from init() method that we need
     expect(stack.getName()).andReturn("testStack").anyTimes();
@@ -4071,7 +4082,9 @@ public class BlueprintConfigurationProcessorTest {
     updater.doUpdateForClusterCreate();
 
     assertFalse("hbase.coprocessor.regionserver.classes should have been filtered out of
configuration",
-        hbaseSiteProperties.containsKey("hbase.coprocessor.regionserver.classes"));
+                hbaseSiteProperties.containsKey("hbase.coprocessor.regionserver.classes"));
+    assertTrue("hbase.coprocessor.master.classes should not have been filtered out of configuration",
+               hbaseSiteProperties.containsKey("hbase.coprocessor.master.classes"));
 
   }
 


Mime
View raw message