This is an automated email from the ASF dual-hosted git repository. mpapirkovskyy pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 80c4f89 AMBARI-23882. Service stop/start/restart times out when agent registration was not completed. (mpapirkovskyy) (#1343) 80c4f89 is described below commit 80c4f8977f14fe901b9c62ca22a944294fa9f37e Author: Myroslav Papirkovskyi <mpapirkovs...@apache.org> AuthorDate: Mon May 21 21:22:09 2018 +0300 AMBARI-23882. Service stop/start/restart times out when agent registration was not completed. (mpapirkovskyy) (#1343) --- .../org/apache/ambari/server/state/host/HostImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 cb7af46..2fef3ae 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 @@ -367,6 +367,8 @@ public class HostImpl implements Host { } catch (AmbariException e1) { LOG.error("Unable to restore last valid host components status for host", e1); } + // initialize agent times in the last time to prevent setting registering/heartbeat times for failed registration. + host.updateHostTimestamps(e); } } @@ -1291,18 +1293,20 @@ public class HostImpl implements Host { @Transactional public void updateHost(HostRegistrationRequestEvent e) { importHostInfo(e.hostInfo); - setLastRegistrationTime(e.registrationTime); - //Initialize heartbeat time and timeInState with registration time. - setLastHeartbeatTime(e.registrationTime); - setLastAgentStartTime(e.agentStartTime); setLastAgentEnv(e.agentEnv); - setTimeInState(e.registrationTime); setAgentVersion(e.agentVersion); setPublicHostName(e.publicHostName); - setTimeInState(System.currentTimeMillis()); setState(HostState.INIT); } + @Transactional + public void updateHostTimestamps(HostRegistrationRequestEvent e) { + setLastHeartbeatTime(e.registrationTime); + setLastRegistrationTime(e.registrationTime); + setLastAgentStartTime(e.agentStartTime); + setTimeInState(e.registrationTime); + } + /** * {@inheritDoc} */ -- To stop receiving notification emails like this one, please contact mpapirkovs...@apache.org.