You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/02/11 19:36:25 UTC

ambari git commit: AMBARI-14988: DB consistency - Add consistency check on clusterconfigmapping in ClusterImpl::getDesiredConfigs() for NPE.

Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 f99db40c0 -> 5f7166c6e


AMBARI-14988: DB consistency - Add consistency check on clusterconfigmapping in ClusterImpl::getDesiredConfigs() for NPE.


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

Branch: refs/heads/branch-2.2
Commit: 5f7166c6e3fafc0104b9ff6fab126d68cb41fc15
Parents: f99db40
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Wed Feb 10 13:10:28 2016 -0800
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Thu Feb 11 10:36:21 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f7166c6/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 a1e1919..d3fdc65 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
@@ -2233,7 +2233,17 @@ public class ClusterImpl implements Cluster {
                 " unknown configType=" + e.getType());
             continue;
           }
-          c.setVersion(allConfigs.get(e.getType()).get(e.getTag()).getVersion());
+
+          Map<String, Config> configMap = allConfigs.get(e.getType());
+          if(!configMap.containsKey(e.getTag())) {
+            LOG.debug("Config inconsistency exists for typeName=" +
+                    e.getType() +
+                    ", unknown versionTag=" + e.getTag());
+            continue;
+          }
+
+          Config config = configMap.get(e.getTag());
+          c.setVersion(config.getVersion());
 
           Set<DesiredConfig> configs = map.get(e.getType());
           if (configs == null) {