ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-17430. Fix serviceconfig NPE in db consistency checker.(vbrodetskyi)
Date Fri, 24 Jun 2016 18:21:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 6afb23b21 -> c873c2465


AMBARI-17430. Fix serviceconfig NPE in db consistency checker.(vbrodetskyi)


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

Branch: refs/heads/branch-2.4
Commit: c873c24654b85cab6ad0e5897c650eb339501406
Parents: 6afb23b
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Fri Jun 24 04:14:57 2016 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Fri Jun 24 04:14:57 2016 +0300

----------------------------------------------------------------------
 .../checks/DatabaseConsistencyCheckHelper.java  | 26 +++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c873c246/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index d85b6f2..3035de9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -511,17 +511,21 @@ public class DatabaseConsistencyCheckHelper {
 
         //compare required service configs from stack with mapped service configs from db
         Map<Integer, Multimap<String, String>> dbServiceVersionConfigs = dbClusterServiceVersionConfigs.get(clusterName);
-        for (Integer serviceVersion : dbServiceVersionConfigs.keySet()) {
-          Multimap<String, String> dbServiceConfigs = dbServiceVersionConfigs.get(serviceVersion);
-          for (String serviceName : dbServiceConfigs.keySet()) {
-            Collection<String> serviceConfigsFromStack = stackServiceConfigs.get(serviceName);
-            Collection<String> serviceConfigsFromDB = dbServiceConfigs.get(serviceName);
-            if (serviceConfigsFromDB != null && serviceConfigsFromStack != null)
{
-              serviceConfigsFromStack.removeAll(serviceConfigsFromDB);
-              if (!serviceConfigsFromStack.isEmpty()) {
-                LOG.error("Required config(s): {} is(are) not available for service {} with
service config version {} in cluster {}",
-                        StringUtils.join(serviceConfigsFromStack, ","), serviceName, Integer.toString(serviceVersion),
clusterName);
-                errorAvailable = true;
+        if (dbServiceVersionConfigs != null) {
+          for (Integer serviceVersion : dbServiceVersionConfigs.keySet()) {
+            Multimap<String, String> dbServiceConfigs = dbServiceVersionConfigs.get(serviceVersion);
+            if (dbServiceConfigs != null) {
+              for (String serviceName : dbServiceConfigs.keySet()) {
+                Collection<String> serviceConfigsFromStack = stackServiceConfigs.get(serviceName);
+                Collection<String> serviceConfigsFromDB = dbServiceConfigs.get(serviceName);
+                if (serviceConfigsFromDB != null && serviceConfigsFromStack != null)
{
+                  serviceConfigsFromStack.removeAll(serviceConfigsFromDB);
+                  if (!serviceConfigsFromStack.isEmpty()) {
+                    LOG.error("Required config(s): {} is(are) not available for service {}
with service config version {} in cluster {}",
+                            StringUtils.join(serviceConfigsFromStack, ","), serviceName,
Integer.toString(serviceVersion), clusterName);
+                    errorAvailable = true;
+                  }
+                }
               }
             }
           }


Mime
View raw message