ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-14611. ConcurrentModificationException w/ blueprint provisioning w/ stack advisor.(Oliver Szabo via vbrodetskyi)
Date Tue, 12 Jan 2016 16:01:37 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 cc9405dcb -> f2a917731


AMBARI-14611. ConcurrentModificationException w/ blueprint provisioning w/ stack advisor.(Oliver
Szabo via vbrodetskyi)


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

Branch: refs/heads/branch-2.2
Commit: f2a917731ba21a7d5da861411bb3c285a52b7914
Parents: cc9405d
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Tue Jan 12 18:01:23 2016 +0200
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Tue Jan 12 18:01:23 2016 +0200

----------------------------------------------------------------------
 .../internal/BlueprintConfigurationProcessor.java  | 17 +++++++++--------
 .../BlueprintConfigurationProcessorTest.java       | 12 +++++++++---
 2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f2a91773/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 261798c..0b6721a 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
@@ -21,6 +21,7 @@ package org.apache.ambari.server.controller.internal;
 
 import com.google.common.base.Predicates;
 import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
 import org.apache.ambari.server.state.PropertyDependencyInfo;
 import org.apache.ambari.server.state.ValueAttributesInfo;
 import org.apache.ambari.server.topology.AdvisedConfiguration;
@@ -412,28 +413,27 @@ public class BlueprintConfigurationProcessor {
     ConfigRecommendationStrategy configRecommendationStrategy = clusterTopology.getConfigRecommendationStrategy();
     Map<String, AdvisedConfiguration> advisedConfigurations = clusterTopology.getAdvisedConfigurations();
     if (ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY.equals(configRecommendationStrategy))
{
-      LOG.debug("Filter out recommended configurations. Keep only the stack defaults.");
-      doFilterStackDefaults(configuration, advisedConfigurations);
+      LOG.info("Filter out recommended configurations. Keep only the stack defaults.");
+      doFilterStackDefaults(advisedConfigurations);
     }
     if (!ConfigRecommendationStrategy.NEVER_APPLY.equals(configRecommendationStrategy)) {
       for (Map.Entry<String, AdvisedConfiguration> advConfEntry : advisedConfigurations.entrySet())
{
         String configType = advConfEntry.getKey();
         AdvisedConfiguration advisedConfig = advConfEntry.getValue();
-        LOG.debug("Update '{}' configurations with recommended configurations provided by
the stack advisor.", configType);
+        LOG.info("Update '{}' configurations with recommended configurations provided by
the stack advisor.", configType);
         doReplaceProperties(configuration, configType, advisedConfig, configTypesUpdated);
         doRemovePropertiesIfNeeded(configuration, configType, advisedConfig, configTypesUpdated);
       }
     } else {
-      LOG.debug("No any recommended configuration applied. (strategy: {})", ConfigRecommendationStrategy.NEVER_APPLY);
+      LOG.info("No any recommended configuration applied. (strategy: {})", ConfigRecommendationStrategy.NEVER_APPLY);
     }
   }
 
   /**
    * Drop every configuration property from advised configuration that is not found in the
stack defaults.
-   * @param configuration configuration being processed
    * @param advisedConfigurations advised configuration instance
    */
-  private void doFilterStackDefaults(Configuration configuration, Map<String, AdvisedConfiguration>
advisedConfigurations) {
+  private void doFilterStackDefaults(Map<String, AdvisedConfiguration> advisedConfigurations)
{
     Blueprint blueprint = clusterTopology.getBlueprint();
     Configuration stackDefaults = blueprint.getStack().getConfiguration(blueprint.getServices());
     Map<String, Map<String, String>> stackDefaultProps = stackDefaults.getProperties();
@@ -443,12 +443,13 @@ public class BlueprintConfigurationProcessor {
         Map<String, String> defaultProps = stackDefaultProps.get(adConfEntry.getKey());
         Map<String, String> outFilteredProps = Maps.filterKeys(advisedConfiguration.getProperties(),
           Predicates.not(Predicates.in(defaultProps.keySet())));
-        advisedConfiguration.getProperties().keySet().removeAll(outFilteredProps.keySet());
+        advisedConfiguration.getProperties().keySet().removeAll(Sets.newCopyOnWriteArraySet(outFilteredProps.keySet()));
 
         if (advisedConfiguration.getPropertyValueAttributes() != null) {
           Map<String, ValueAttributesInfo> outFilteredValueAttrs = Maps.filterKeys(advisedConfiguration.getPropertyValueAttributes(),
             Predicates.not(Predicates.in(defaultProps.keySet())));
-          advisedConfiguration.getPropertyValueAttributes().keySet().removeAll(outFilteredValueAttrs.keySet());
+          advisedConfiguration.getPropertyValueAttributes().keySet().removeAll(
+            Sets.newCopyOnWriteArraySet(outFilteredValueAttrs.keySet()));
         }
       } else {
         advisedConfiguration.getProperties().clear();

http://git-wip-us.apache.org/repos/asf/ambari/blob/f2a91773/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 21710e5..5a0f859 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
@@ -6243,9 +6243,15 @@ public class BlueprintConfigurationProcessorTest {
     confProp.put("fs.stackDefault.key1", "stackDefaultUpgraded");
     confProp.put("fs.notStackDefault", "notStackDefault");
     Map<String, ValueAttributesInfo> valueAttributesInfoMap = new HashMap<String,
ValueAttributesInfo>();
-    ValueAttributesInfo vaInfo = new ValueAttributesInfo();
-    vaInfo.setDelete("true");
-    valueAttributesInfoMap.put("fs.stackDefault.key2", vaInfo);
+    ValueAttributesInfo vaInfo1 = new ValueAttributesInfo();
+    vaInfo1.setDelete("true");
+    ValueAttributesInfo vaInfo2 = new ValueAttributesInfo();
+    vaInfo2.setMaximum("150");
+    ValueAttributesInfo vaInfo3 = new ValueAttributesInfo();
+    vaInfo3.setMinimum("100");
+    valueAttributesInfoMap.put("fs.stackDefault.key2", vaInfo1);
+    valueAttributesInfoMap.put("fs.notStackDefault", vaInfo2);
+    valueAttributesInfoMap.put("fs.stackDefault.key3", vaInfo3);
     advMap.put("core-site", new AdvisedConfiguration(confProp, valueAttributesInfoMap));
     Map<String, String> dummyConfProp = new HashMap<String, String>();
     dummyConfProp.put("dummy.prop", "dummyValue");


Mime
View raw message