You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2020/06/23 18:53:10 UTC

[asterixdb] 02/05: [NO ISSUE][MISC] IRetryPolicy requires non-null throwable

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

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit b0acb8bab6f5957f89bd560c143ea5dcf6bfe972
Author: Michael Blow <mi...@couchbase.com>
AuthorDate: Sun Jun 21 18:35:52 2020 -0400

    [NO ISSUE][MISC] IRetryPolicy requires non-null throwable
    
    Change-Id: I4835266435fc31f5973f4312e6ddcbdb85d1e839
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/6923
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Michael Blow <mb...@apache.org>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
---
 .../src/main/java/org/apache/asterix/app/active/RecoveryTask.java   | 6 +++---
 .../src/main/java/org/apache/hyracks/util/IRetryPolicy.java         | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java
index a1989fc..c795147 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java
@@ -106,8 +106,8 @@ public class RecoveryTask {
 
     protected Void doRecover(IRetryPolicy policy) throws AlgebricksException, InterruptedException {
         LOGGER.log(level, "Actual Recovery task has started");
-        Exception failure = null;
-        while (policy.retry(failure)) {
+        Exception failure;
+        do {
             synchronized (listener) {
                 while (!cancelRecovery && clusterStateManager.getState() != ClusterState.ACTIVE) {
                     listener.wait();
@@ -139,7 +139,7 @@ public class RecoveryTask {
             } finally {
                 releaseRecoveryLocks(metadataProvider);
             }
-        }
+        } while (policy.retry(failure));
         // Recovery task is essntially over now either through failure or through cancellation(stop)
         synchronized (listener) {
             listener.notifyAll();
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java
index 29469d5..0d18a2b 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java
@@ -22,7 +22,7 @@ package org.apache.hyracks.util;
 public interface IRetryPolicy {
     /**
      * @param failure
-     *            the cause of the failure
+     *            the cause of the failure (this cannot be null)
      * @return true if one more attempt should be done
      */
     boolean retry(Throwable failure);