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-18296. Database Consistency Check Fails With NPE With Missing Service From Stack.(vbrodetskyi)
Date Sat, 03 Sep 2016 01:02:54 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a6b96f835 -> 1aa13da87


AMBARI-18296. Database Consistency Check Fails With NPE With Missing Service From Stack.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 1aa13da878a0ccc6a0f40efae823ab767417462f
Parents: a6b96f8
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Sat Sep 3 03:59:26 2016 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Sat Sep 3 03:59:26 2016 +0300

----------------------------------------------------------------------
 .../server/checks/DatabaseConsistencyCheckHelper.java   | 12 +++++++++---
 .../checks/DatabaseConsistencyCheckHelperTest.java      |  6 +++---
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa13da8/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 9f7419c..f302b8b 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
@@ -546,9 +546,15 @@ public class DatabaseConsistencyCheckHelper {
         Map<String, ServiceInfo> serviceInfoMap = ambariMetaInfo.getServices(stackName,
stackVersion);
         for (String serviceName : serviceNames) {
           ServiceInfo serviceInfo = serviceInfoMap.get(serviceName);
-          Set<String> configTypes = serviceInfo.getConfigTypeAttributes().keySet();
-          for (String configType : configTypes) {
-            stackServiceConfigs.put(serviceName, configType);
+          if (serviceInfo != null) {
+            Set<String> configTypes = serviceInfo.getConfigTypeAttributes().keySet();
+            for (String configType : configTypes) {
+              stackServiceConfigs.put(serviceName, configType);
+            }
+          } else {
+            LOG.warn("Service {} is not available for stack {} in cluster {}",
+                    serviceName, stackName + "-" + stackVersion, clusterName);
+            warningAvailable = true;
           }
         }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1aa13da8/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
index d8f538e..4663310 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
@@ -251,9 +251,9 @@ public class DatabaseConsistencyCheckHelperTest {
 
     expect(mockHDFSServiceInfo.getConfigTypeAttributes()).andReturn(configAttributes);
     expect(mockAmbariMetainfo.getServices("HDP", "2.2")).andReturn(services);
-    expect(serviceConfigResultSet.next()).andReturn(true);
-    expect(serviceConfigResultSet.getString("service_name")).andReturn("HDFS");
-    expect(serviceConfigResultSet.getString("type_name")).andReturn("core-site");
+    expect(serviceConfigResultSet.next()).andReturn(true).times(2);
+    expect(serviceConfigResultSet.getString("service_name")).andReturn("HDFS").andReturn("HBASE");
+    expect(serviceConfigResultSet.getString("type_name")).andReturn("core-site").andReturn("hbase-env");
     expect(stackResultSet.next()).andReturn(true);
     expect(stackResultSet.getString("stack_name")).andReturn("HDP");
     expect(stackResultSet.getString("stack_version")).andReturn("2.2");


Mime
View raw message