Browse Source

AMBARI-15714. Express Upgrade hung after FAILED step is retried. (mpapirkovskyy)

Myroslav Papirkovskyi 9 years ago
parent
commit
fa2fe9d8ef

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java

@@ -888,8 +888,8 @@ class ActionScheduler implements Runnable {
       return false;
     } else {
       String hostName = host.getHostName();
-      long lastStageAttemptTime = stage.getLastAttemptTime(hostName, role);
-      return lastStageAttemptTime > 0 && lastStageAttemptTime <= host.getLastRegistrationTime();
+      long taskStartTime = stage.getHostRoleCommand(hostName, role).getStartTime();
+      return taskStartTime > 0 && taskStartTime <= host.getLastRegistrationTime();
     }
   }
 

+ 7 - 4
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java

@@ -2418,10 +2418,13 @@ public class TestActionScheduler {
     ActionScheduler scheduler = new ActionScheduler(100, 50, db, aq, fsm, 3,
         new HostsMap((String) null), unitOfWork, null, conf);
 
-    doReturn(STAGE_LAST_ATTEMPT_TIME).when(stageInProgress1).getLastAttemptTime(anyString(), anyString());
-    doReturn(STAGE_LAST_ATTEMPT_TIME).when(stageInProgress2).getLastAttemptTime(anyString(), anyString());
-    doReturn(STAGE_LAST_ATTEMPT_TIME).when(stageInProgress3).getLastAttemptTime(anyString(), anyString());
-    doReturn(STAGE_LAST_ATTEMPT_TIME).when(stageInProgress4).getLastAttemptTime(anyString(), anyString());
+    HostRoleCommand hostRoleCommand = mock(HostRoleCommand.class);
+    doReturn(STAGE_LAST_ATTEMPT_TIME).when(hostRoleCommand).getStartTime();
+    doReturn(hostRoleCommand).when(stageInProgress1).getHostRoleCommand(anyString(), anyString());
+    doReturn(hostRoleCommand).when(stageInProgress2).getHostRoleCommand(anyString(), anyString());
+    doReturn(hostRoleCommand).when(stageInProgress3).getHostRoleCommand(anyString(), anyString());
+    doReturn(hostRoleCommand).when(stageInProgress4).getHostRoleCommand(anyString(), anyString());
+
 
     // Execution of request 1