Repository: ambari Updated Branches: refs/heads/trunk 40aac602f -> 4917a2385
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/4917a238 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4917a238 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4917a238 Branch: refs/heads/trunk Commit: 4917a2385e83be80617bce30c1d0d6b1a859d907 Parents: 40aac60 Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Authored: Tue Jan 12 18:03:14 2016 +0200 Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Committed: Tue Jan 12 18:03:14 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/4917a238/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 f8221b5..cded321 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.Role; import org.apache.ambari.server.state.PropertyDependencyInfo; import org.apache.ambari.server.state.ValueAttributesInfo; @@ -413,28 +414,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(); @@ -444,12 +444,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/4917a238/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 ab6913e..3c643be 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 @@ -6331,9 +6331,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");