瀏覽代碼

AMBARI-12611 Ambari upgrade to 2.1 fails (thinks hbase is installed) (dsen)

Dmytro Sen 10 年之前
父節點
當前提交
ffc45f57a8
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java

+ 5 - 2
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java

@@ -1621,7 +1621,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
 
       if (clusterMap != null && !clusterMap.isEmpty()) {
         for (final Cluster cluster : clusterMap.values()) {
-          if (cluster.getDesiredConfigByType("hbase-site") != null) {
+          if (cluster.getDesiredConfigByType("hbase-site") != null && cluster.getDesiredConfigByType("hbase-env") != null) {
             Map<String, String> hbaseEnvProps = new HashMap<String, String>();
             Map<String, String> hbaseSiteProps = new HashMap<String, String>();
             Set<String> hbaseEnvRemoveProps = new HashSet<String>();
@@ -1660,7 +1660,10 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
 
             int threshold = 23;
             int totalMem = 0;
-            String hostName = cluster.getHosts("HBASE", "HBASE_MASTER").iterator().next();
+            String hostName = null;
+            if (cluster.getHosts("HBASE", "HBASE_MASTER").iterator().hasNext()) {
+              hostName = cluster.getHosts("HBASE", "HBASE_MASTER").iterator().next();
+            }
             for (Host host : cluster.getHosts()) {
               if(host.getHostName().equalsIgnoreCase(hostName)) {
                 totalMem = (int)(host.getTotalMemBytes() / (1024 * 1024));