ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smn...@apache.org
Subject [1/2] ambari git commit: AMBARI-14988: DB consistency - Add consistency check on clusterconfigmapping in ClusterImpl::getDesiredConfigs() for NPE.
Date Thu, 11 Feb 2016 18:35:42 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2871d674f -> 966f3031d


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/966f3031
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/966f3031
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/966f3031

Branch: refs/heads/trunk
Commit: 966f3031d50b0106dfe5d19abbdd1e3b84d1f059
Parents: f247ddc
Author: Nahappan Somasundaram <nsomasundaram@hortonworks.com>
Authored: Wed Feb 10 13:10:28 2016 -0800
Committer: Nahappan Somasundaram <nsomasundaram@hortonworks.com>
Committed: Thu Feb 11 10:35:00 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/966f3031/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 50e02a5..57941d0 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
@@ -2267,7 +2267,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) {


Mime
View raw message