Ver código fonte

AMBARI-2013. Fix to delete cluster with components in unknown state

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1471517 13f79535-47bb-0310-9956-ffa450edef68
Nate Cole 12 anos atrás
pai
commit
14f34bd20d

+ 2 - 0
CHANGES.txt

@@ -1258,6 +1258,8 @@ Trunk (unreleased changes):
  AMBARI-1657. User directories on HDFS do not get created with custom names 
  AMBARI-1657. User directories on HDFS do not get created with custom names 
  provided from Ambari UI. (swagle)
  provided from Ambari UI. (swagle)
 
 
+ AMBARI-2013. Fix to delete cluster with components in unknown state. (ncole)
+
  AMBARI-1977. Honor service configs when there are no matching cluster configs (ncole)
  AMBARI-1977. Honor service configs when there are no matching cluster configs (ncole)
 
 
  AMBARI-1976. When host expires, update each component for host with unknown state. (ncole)
  AMBARI-1976. When host expires, update each component for host with unknown state. (ncole)

+ 1 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/State.java

@@ -143,6 +143,7 @@ public enum State {
       case INSTALLED:
       case INSTALLED:
       case INSTALL_FAILED:
       case INSTALL_FAILED:
       case UNINSTALLED:
       case UNINSTALLED:
+      case UNKNOWN:
       case MAINTENANCE:
       case MAINTENANCE:
         return true;
         return true;
       default:
       default:

+ 8 - 0
ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java

@@ -55,6 +55,7 @@ import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.State;
 import org.junit.After;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Test;
@@ -356,12 +357,19 @@ public class ClustersTest {
     nameNode.persist();
     nameNode.persist();
     ServiceComponent dataNode = hdfs.addServiceComponent("DATANODE");
     ServiceComponent dataNode = hdfs.addServiceComponent("DATANODE");
     dataNode.persist();
     dataNode.persist();
+    
+    ServiceComponent serviceCheckNode = hdfs.addServiceComponent("HDFS_CLIENT");
+    serviceCheckNode.persist();
 
 
     ServiceComponentHost nameNodeHost = nameNode.addServiceComponentHost(h1);
     ServiceComponentHost nameNodeHost = nameNode.addServiceComponentHost(h1);
     nameNodeHost.persist();
     nameNodeHost.persist();
 
 
     ServiceComponentHost dataNodeHost = dataNode.addServiceComponentHost(h2);
     ServiceComponentHost dataNodeHost = dataNode.addServiceComponentHost(h2);
     dataNodeHost.persist();
     dataNodeHost.persist();
+    
+    ServiceComponentHost serviceCheckNodeHost = serviceCheckNode.addServiceComponentHost(h2);
+    serviceCheckNodeHost.persist();
+    serviceCheckNodeHost.setState(State.UNKNOWN);
 
 
     HostComponentStateEntityPK hkspk = new HostComponentStateEntityPK();
     HostComponentStateEntityPK hkspk = new HostComponentStateEntityPK();
     HostComponentDesiredStateEntityPK hkdspk = new HostComponentDesiredStateEntityPK();
     HostComponentDesiredStateEntityPK hkdspk = new HostComponentDesiredStateEntityPK();