AMBARI-21173. Not able to start Yarn services after restoring the configs to 
initial value.(vbrodetskyi)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 86c7f92c31fda6b89eb7c9389072a94abe35d917
Parents: d016878
Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Authored: Fri Aug 11 03:03:55 2017 +0300
Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Committed: Fri Aug 11 03:04:36 2017 +0300

----------------------------------------------------------------------
 .../org/apache/ambari/server/state/cluster/ClusterImpl.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/86c7f92c/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index c950d67..c191358 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -1806,12 +1806,18 @@ public class ClusterImpl implements Cluster {
     if (serviceConfigEntity.getGroupId() == null) {
       Collection<String> configTypes = serviceConfigTypes.get(serviceName);
       List<ClusterConfigEntity> enabledConfigs = 
clusterDAO.getEnabledConfigsByTypes(clusterId, configTypes);
+      List<ClusterConfigEntity> serviceConfigEntities = 
serviceConfigEntity.getClusterConfigEntities();
+      ArrayList<ClusterConfigEntity> duplicatevalues = new 
ArrayList<ClusterConfigEntity>(serviceConfigEntities);
+      duplicatevalues.retainAll(enabledConfigs);
+      enabledConfigs.removeAll(duplicatevalues);
+      serviceConfigEntities.removeAll(duplicatevalues);
+
       for (ClusterConfigEntity enabledConfig : enabledConfigs) {
         enabledConfig.setSelected(false);
         clusterDAO.merge(enabledConfig);
       }
 
-      for (ClusterConfigEntity configEntity : 
serviceConfigEntity.getClusterConfigEntities()) {
+      for (ClusterConfigEntity configEntity : serviceConfigEntities) {
         configEntity.setSelected(true);
         clusterDAO.merge(configEntity);
       }

Reply via email to