ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-21298. Pausing An Upgrade In Progress Does Not Resume PENDING Tasks (dlysnichenko)
Date Fri, 23 Jun 2017 08:25:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk ec8deeba2 -> 0dbc7976d


AMBARI-21298. Pausing An Upgrade In Progress Does Not Resume PENDING Tasks (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 0dbc7976d95dd0bb25232a4fc4d204e55929eb9a
Parents: ec8deeb
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Fri Jun 23 11:21:03 2017 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Fri Jun 23 11:24:36 2017 +0300

----------------------------------------------------------------------
 .../server/actionmanager/ActionDBAccessorImpl.java | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0dbc7976/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
index 94bb892..f0e2ce7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
@@ -23,9 +23,11 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.EnumSet;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.ambari.annotations.Experimental;
@@ -814,7 +816,15 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
   @Override
   public void resubmitTasks(List<Long> taskIds) {
     List<HostRoleCommandEntity> tasks = hostRoleCommandDAO.findByPKs(taskIds);
+    Set<RequestEntity> requestEntities = new HashSet<>();
+    Set<StageEntity> stageEntities = new HashSet<>();
     for (HostRoleCommandEntity task : tasks) {
+      StageEntity stage = task.getStage();
+      stage.setStatus(HostRoleStatus.PENDING);
+      stageEntities.add(stage);
+      RequestEntity request = stage.getRequest();
+      request.setStatus(HostRoleStatus.IN_PROGRESS);
+      requestEntities.add(request);
       task.setStatus(HostRoleStatus.PENDING);
       // TODO HACK, shouldn't reset start time.
       // Because it expects -1, RetryActionMonitor.java also had to set it to -1.
@@ -824,6 +834,13 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
       auditLog(task, task.getRequestId());
     }
 
+    for (StageEntity stageEntity : stageEntities) {
+      stageDAO.merge(stageEntity);
+    }
+    for (RequestEntity requestEntity : requestEntities) {
+      requestDAO.merge(requestEntity);
+    }
+
     // no need to merge if there's nothing to merge
     if (!tasks.isEmpty()) {
       hostRoleCommandDAO.mergeAll(tasks);


Mime
View raw message