ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [22/35] ambari git commit: AMBARI-21173. Not able to start Yarn services after restoring the configs to initial value.(vbrodetskyi)
Date Tue, 22 Aug 2017 18:02:38 GMT
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/5895040c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5895040c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5895040c

Branch: refs/heads/branch-feature-logsearch-ui
Commit: 5895040c8a3374012c11f0e351c8ba631a689ae7
Parents: d690844
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Mon Aug 21 23:57:12 2017 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Mon Aug 21 23:57:12 2017 +0300

----------------------------------------------------------------------
 .../ambari/server/state/cluster/ClusterImpl.java | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5895040c/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 84b411c..26be06e 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
@@ -1797,22 +1797,29 @@ public class ClusterImpl implements Cluster {
 
     // disable all configs related to service
     if (serviceConfigEntity.getGroupId() == null) {
+      // Here was fixed bug with entity changes revert. More you can find here AMBARI-21173.
+      // This issue reproduces only if you are changing same entity in first and second loop.
+      // In that case eclipselink will revert changes to cached, if entity has fluchGroup
and it
+      // needs to be refreshed. Actually we don't need to change same antities in few steps,
so i
+      // decided to filter out. duplicates and do not change them. It will be better for
performance and bug will be fixed.
       Collection<String> configTypes = serviceConfigTypes.get(serviceName);
       List<ClusterConfigEntity> enabledConfigs = clusterDAO.getEnabledConfigsByTypes(clusterId,
configTypes);
       List<ClusterConfigEntity> serviceConfigEntities = serviceConfigEntity.getClusterConfigEntities();
       ArrayList<ClusterConfigEntity> duplicatevalues = new ArrayList<>(serviceConfigEntities);
       duplicatevalues.retainAll(enabledConfigs);
-      enabledConfigs.removeAll(duplicatevalues);
-      serviceConfigEntities.removeAll(duplicatevalues);
 
       for (ClusterConfigEntity enabledConfig : enabledConfigs) {
-        enabledConfig.setSelected(false);
-        clusterDAO.merge(enabledConfig);
+        if (!duplicatevalues.contains(enabledConfig)) {
+          enabledConfig.setSelected(false);
+          clusterDAO.merge(enabledConfig);
+        }
       }
 
       for (ClusterConfigEntity configEntity : serviceConfigEntities) {
-        configEntity.setSelected(true);
-        clusterDAO.merge(configEntity);
+        if (!duplicatevalues.contains(configEntity)) {
+          configEntity.setSelected(true);
+          clusterDAO.merge(configEntity);
+        }
       }
     } else {
       Long configGroupId = serviceConfigEntity.getGroupId();


Mime
View raw message