AMBARI-19679. Dangling config-group hostmapping entries result in partial loading of config groups. (swagle)
Change-Id: Ie98d588d57d9bbd7226d3ba9142f364d3b3597db Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b5a47c43 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b5a47c43 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b5a47c43 Branch: refs/heads/AMBARI-2.4.2.16 Commit: b5a47c4373585d2a014f11ed65c744422f3b27ba Parents: 82d48aa Author: Siddharth Wagle <[email protected]> Authored: Mon Jan 23 10:37:08 2017 -0800 Committer: Siddharth Wagle <[email protected]> Committed: Wed Mar 1 12:14:37 2017 -0800 ---------------------------------------------------------------------- .../server/state/configgroup/ConfigGroupImpl.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b5a47c43/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java index ccca9fc..19b1be1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java @@ -125,8 +125,7 @@ public class ConfigGroupImpl implements ConfigGroup { hosts = new HashMap<Long, Host>(); // Populate configs - for (ConfigGroupConfigMappingEntity configMappingEntity : configGroupEntity - .getConfigGroupConfigMappingEntities()) { + for (ConfigGroupConfigMappingEntity configMappingEntity : configGroupEntity.getConfigGroupConfigMappingEntities()) { Config config = cluster.getConfig(configMappingEntity.getConfigType(), configMappingEntity.getVersionTag()); @@ -142,8 +141,7 @@ public class ConfigGroupImpl implements ConfigGroup { } // Populate Hosts - for (ConfigGroupHostMappingEntity hostMappingEntity : configGroupEntity - .getConfigGroupHostMappingEntities()) { + for (ConfigGroupHostMappingEntity hostMappingEntity : configGroupEntity.getConfigGroupHostMappingEntities()) { try { Host host = clusters.getHost(hostMappingEntity.getHostname()); @@ -151,9 +149,10 @@ public class ConfigGroupImpl implements ConfigGroup { if (host != null && hostEntity != null) { hosts.put(hostEntity.getHostId(), host); } - } catch (AmbariException e) { - String msg = "Host seems to be deleted but Config group mapping still " + - "exists !"; + } catch (Exception e) { + String msg = String.format("Host %s seems to be deleted but Config " + + "group %s mapping still exists !", hostMappingEntity.getHostname(), + configGroupEntity.getGroupName()); LOG.warn(msg); LOG.debug(msg, e); }
