This is an automated email from the ASF dual-hosted git repository.

jonathanhurley pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 3d66765  AMBARI-25325 : Updating Transactional method as public, log 
Transaction failure (#3033)
3d66765 is described below

commit 3d6676581379198e4c17f11afd2c344a73dfc1a9
Author: Viraj Jasani <vjas...@salesforce.com>
AuthorDate: Tue Jul 9 23:29:54 2019 +0530

    AMBARI-25325 : Updating Transactional method as public, log Transaction 
failure (#3033)
---
 .../state/services/RetryUpgradeActionService.java  | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
index a19e83e..e521909 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
@@ -190,7 +190,7 @@ public class RetryUpgradeActionService extends 
AbstractScheduledService {
    * @param requestId Request Id to search tasks for.
    */
   @Transactional
-  void retryHoldingCommandsInRequest(Long requestId) {
+  public void retryHoldingCommandsInRequest(Long requestId) {
     if (requestId == null) {
       return;
     }
@@ -294,13 +294,17 @@ public class RetryUpgradeActionService extends 
AbstractScheduledService {
    * @param hrc Host Role Command entity
    */
   private void retryHostRoleCommand(HostRoleCommandEntity hrc) {
-    hrc.setStatus(HostRoleStatus.PENDING);
-    hrc.setStartTime(-1L);
-    // Don't change the original start time.
-    hrc.setEndTime(-1L);
-    hrc.setLastAttemptTime(-1L);
-
-    // This will invalidate the cache, as expected.
-    m_hostRoleCommandDAO.merge(hrc);
+    try {
+      hrc.setStatus(HostRoleStatus.PENDING);
+      hrc.setStartTime(-1L);
+      // Don't change the original start time.
+      hrc.setEndTime(-1L);
+      hrc.setLastAttemptTime(-1L);
+      // This will invalidate the cache, as expected.
+      m_hostRoleCommandDAO.merge(hrc);
+    } catch (Exception e) {
+      LOG.error("Error while updating hostRoleCommand. Entity: {}", hrc, e);
+      throw e;
+    }
   }
 }

Reply via email to