ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stoa...@apache.org
Subject ambari git commit: AMBARI-16013. Host_status stuck in UNKNOWN status after blueprint deploy with host in heartbeat-lost. (stoader)
Date Thu, 21 Apr 2016 17:11:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2.2 4550430bc -> 95bc6b605


AMBARI-16013. Host_status stuck in UNKNOWN status after blueprint deploy with host in heartbeat-lost.
(stoader)


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

Branch: refs/heads/branch-2.2.2
Commit: 95bc6b6056f7c87890cb2b1473b2fc72e6be89c4
Parents: 4550430
Author: Toader, Sebastian <stoader@hortonworks.com>
Authored: Thu Apr 21 19:07:36 2016 +0200
Committer: Toader, Sebastian <stoader@hortonworks.com>
Committed: Thu Apr 21 19:08:24 2016 +0200

----------------------------------------------------------------------
 .../ambari/server/state/host/HostImpl.java      |  2 +
 .../ambari/server/topology/TopologyManager.java | 52 +++++++++++---------
 2 files changed, 32 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/95bc6b60/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
index d221112..545068c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
@@ -395,6 +395,8 @@ public class HostImpl implements Host {
           + ", host=" + e.getHostName()
           + ", lastHeartbeatTime=" + host.getLastHeartbeatTime());
       host.setHealthStatus(new HostHealthStatus(HealthStatus.UNKNOWN, host.getHealthStatus().getHealthReport()));
+
+      topologyManager.onHostHeartBeatLost(host);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/95bc6b60/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
index 5a0aca0..2de2180 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
@@ -18,21 +18,30 @@
 
 package org.apache.ambari.server.topology;
 
-import com.google.inject.Injector;
-import com.google.inject.Singleton;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.inject.Inject;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
-import org.apache.ambari.server.actionmanager.Request;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorBlueprintProcessor;
-import org.apache.ambari.server.controller.ClusterRequest;
-import org.apache.ambari.server.controller.KerberosHelper;
 import org.apache.ambari.server.controller.RequestStatusResponse;
 import org.apache.ambari.server.controller.internal.ArtifactResourceProvider;
 import org.apache.ambari.server.controller.internal.CalculatedStatus;
 import org.apache.ambari.server.controller.internal.CredentialResourceProvider;
 import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.apache.ambari.server.controller.internal.RequestImpl;
-import org.apache.ambari.server.controller.internal.RequestStageContainer;
 import org.apache.ambari.server.controller.internal.ScaleClusterRequest;
 import org.apache.ambari.server.controller.internal.Stack;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
@@ -44,28 +53,14 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.orm.dao.HostRoleCommandStatusSummaryDTO;
 import org.apache.ambari.server.orm.entities.StageEntity;
-import org.apache.ambari.server.security.encryption.CredentialStoreService;
-import org.apache.ambari.server.serveraction.kerberos.KerberosOperationException;
-import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.state.host.HostImpl;
 import org.apache.ambari.server.utils.RetryHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import com.google.inject.Singleton;
 
 /**
  * Manages all cluster provisioning actions on the cluster topology.
@@ -381,6 +376,19 @@ public class TopologyManager {
     }
   }
 
+  /**
+   * Through this method {@see TopologyManager} gets notified when a connection to a host
in the cluster is lost.
+   * The passed host will be excluded from scheduling any tasks onto it as it can't be reached.
+   * @param host
+   */
+  public void onHostHeartBeatLost(Host host) {
+    ensureInitialized();
+    synchronized (availableHosts) {
+      LOG.info("Hearbeat for host {} lost thus removing it from available hosts.", host.getHostName());
+      availableHosts.remove(host);
+    }
+  }
+
   public LogicalRequest getRequest(long requestId) {
     ensureInitialized();
     return allRequests.get(requestId);


Mime
View raw message