You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2021/10/21 04:20:15 UTC

[GitHub] [ratis] JacksonYao287 opened a new pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

JacksonYao287 opened a new pull request #520:
URL: https://github.com/apache/ratis/pull/520


   
   ## What changes were proposed in this pull request?
   
   catch user statemachine notifyInstallSnapshotFromLeader exception
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/RATIS-1417
   
   ## How was this patch tested?
   
   UT
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] JacksonYao287 commented on pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
JacksonYao287 commented on pull request #520:
URL: https://github.com/apache/ratis/pull/520#issuecomment-957229572


   @hanishakoneru @szetszwo PTAL!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] szetszwo merged pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
szetszwo merged pull request #520:
URL: https://github.com/apache/ratis/pull/520


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] JacksonYao287 commented on a change in pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
JacksonYao287 commented on a change in pull request #520:
URL: https://github.com/apache/ratis/pull/520#discussion_r742574768



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -1604,14 +1604,21 @@ private InstallSnapshotReplyProto notifyStateMachineToInstallSnapshot(
                     LOG.debug("{}: StateMachine could not install snapshot as it is not available", this);
                   }
                 }
-              // wait for 10 seconds for statemachine to install snapshot
+              // wait for 1 seconds for statemachine to install snapshot
               }).get(1, TimeUnit.SECONDS);
-        } catch (ExecutionException t) {
+        } catch (InterruptedException | TimeoutException t) {
+          //nothing to do
+        } catch (Exception t) {
+          // there are two cases:
+          //1 `get()` may throw ExecutionException if `whenComplete` throw an exception
+          //2 when generating completeFuture, `statemachine#notifyInstallSnapshotFromLeader`
+          // may throw an uncertain exception, which is determined by the implementation of
+          // user statemachine.
           inProgressInstallSnapshotRequest.compareAndSet(firstAvailableLogIndex, 0);
-          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. ExecutionException: {}",
+          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. Exception: {}",
               getMemberId(), t.getMessage());
           throw new IOException("Failed to install snapshot");

Review comment:
       thanks @szetszwo for the review. i have updated this patch , please take a look




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] szetszwo commented on a change in pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
szetszwo commented on a change in pull request #520:
URL: https://github.com/apache/ratis/pull/520#discussion_r741800646



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -1604,14 +1604,21 @@ private InstallSnapshotReplyProto notifyStateMachineToInstallSnapshot(
                     LOG.debug("{}: StateMachine could not install snapshot as it is not available", this);
                   }
                 }
-              // wait for 10 seconds for statemachine to install snapshot
+              // wait for 1 seconds for statemachine to install snapshot
               }).get(1, TimeUnit.SECONDS);
-        } catch (ExecutionException t) {
+        } catch (InterruptedException | TimeoutException t) {
+          //nothing to do
+        } catch (Exception t) {
+          // there are two cases:
+          //1 `get()` may throw ExecutionException if `whenComplete` throw an exception
+          //2 when generating completeFuture, `statemachine#notifyInstallSnapshotFromLeader`
+          // may throw an uncertain exception, which is determined by the implementation of
+          // user statemachine.
           inProgressInstallSnapshotRequest.compareAndSet(firstAvailableLogIndex, 0);
-          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. ExecutionException: {}",
+          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. Exception: {}",
               getMemberId(), t.getMessage());
           throw new IOException("Failed to install snapshot");

Review comment:
       Let's add the exception t to the IOException.
   ```
             final String err = getMemberId() + ": Failed to notify StateMachine to InstallSnapshot.";
             LOG.warn(err + " " + t);
             throw new IOException(err, t);
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] JacksonYao287 commented on pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
JacksonYao287 commented on pull request #520:
URL: https://github.com/apache/ratis/pull/520#issuecomment-957229572


   @hanishakoneru @szetszwo PTAL!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] szetszwo commented on a change in pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
szetszwo commented on a change in pull request #520:
URL: https://github.com/apache/ratis/pull/520#discussion_r741800646



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -1604,14 +1604,21 @@ private InstallSnapshotReplyProto notifyStateMachineToInstallSnapshot(
                     LOG.debug("{}: StateMachine could not install snapshot as it is not available", this);
                   }
                 }
-              // wait for 10 seconds for statemachine to install snapshot
+              // wait for 1 seconds for statemachine to install snapshot
               }).get(1, TimeUnit.SECONDS);
-        } catch (ExecutionException t) {
+        } catch (InterruptedException | TimeoutException t) {
+          //nothing to do
+        } catch (Exception t) {
+          // there are two cases:
+          //1 `get()` may throw ExecutionException if `whenComplete` throw an exception
+          //2 when generating completeFuture, `statemachine#notifyInstallSnapshotFromLeader`
+          // may throw an uncertain exception, which is determined by the implementation of
+          // user statemachine.
           inProgressInstallSnapshotRequest.compareAndSet(firstAvailableLogIndex, 0);
-          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. ExecutionException: {}",
+          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. Exception: {}",
               getMemberId(), t.getMessage());
           throw new IOException("Failed to install snapshot");

Review comment:
       Let's add the exception t to the IOException.
   ```
             final String err = getMemberId() + ": Failed to notify StateMachine to InstallSnapshot.";
             LOG.warn(err + " " + t);
             throw new IOException(err, t);
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] szetszwo merged pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
szetszwo merged pull request #520:
URL: https://github.com/apache/ratis/pull/520


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] szetszwo commented on a change in pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
szetszwo commented on a change in pull request #520:
URL: https://github.com/apache/ratis/pull/520#discussion_r741800646



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -1604,14 +1604,21 @@ private InstallSnapshotReplyProto notifyStateMachineToInstallSnapshot(
                     LOG.debug("{}: StateMachine could not install snapshot as it is not available", this);
                   }
                 }
-              // wait for 10 seconds for statemachine to install snapshot
+              // wait for 1 seconds for statemachine to install snapshot
               }).get(1, TimeUnit.SECONDS);
-        } catch (ExecutionException t) {
+        } catch (InterruptedException | TimeoutException t) {
+          //nothing to do
+        } catch (Exception t) {
+          // there are two cases:
+          //1 `get()` may throw ExecutionException if `whenComplete` throw an exception
+          //2 when generating completeFuture, `statemachine#notifyInstallSnapshotFromLeader`
+          // may throw an uncertain exception, which is determined by the implementation of
+          // user statemachine.
           inProgressInstallSnapshotRequest.compareAndSet(firstAvailableLogIndex, 0);
-          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. ExecutionException: {}",
+          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. Exception: {}",
               getMemberId(), t.getMessage());
           throw new IOException("Failed to install snapshot");

Review comment:
       Let's add the exception t to the IOException.
   ```
             final String err = getMemberId() + ": Failed to notify StateMachine to InstallSnapshot.";
             LOG.warn(err + " " + t);
             throw new IOException(err, t);
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] JacksonYao287 commented on pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
JacksonYao287 commented on pull request #520:
URL: https://github.com/apache/ratis/pull/520#issuecomment-957229572


   @hanishakoneru @szetszwo PTAL!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] szetszwo commented on a change in pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
szetszwo commented on a change in pull request #520:
URL: https://github.com/apache/ratis/pull/520#discussion_r741800646



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -1604,14 +1604,21 @@ private InstallSnapshotReplyProto notifyStateMachineToInstallSnapshot(
                     LOG.debug("{}: StateMachine could not install snapshot as it is not available", this);
                   }
                 }
-              // wait for 10 seconds for statemachine to install snapshot
+              // wait for 1 seconds for statemachine to install snapshot
               }).get(1, TimeUnit.SECONDS);
-        } catch (ExecutionException t) {
+        } catch (InterruptedException | TimeoutException t) {
+          //nothing to do
+        } catch (Exception t) {
+          // there are two cases:
+          //1 `get()` may throw ExecutionException if `whenComplete` throw an exception
+          //2 when generating completeFuture, `statemachine#notifyInstallSnapshotFromLeader`
+          // may throw an uncertain exception, which is determined by the implementation of
+          // user statemachine.
           inProgressInstallSnapshotRequest.compareAndSet(firstAvailableLogIndex, 0);
-          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. ExecutionException: {}",
+          LOG.warn("{}: Failed to notify StateMachine to InstallSnapshot. Exception: {}",
               getMemberId(), t.getMessage());
           throw new IOException("Failed to install snapshot");

Review comment:
       Let's add the exception t to the IOException.
   ```
             final String err = getMemberId() + ": Failed to notify StateMachine to InstallSnapshot.";
             LOG.warn(err + " " + t);
             throw new IOException(err, t);
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ratis] szetszwo merged pull request #520: RATIS-1417. catch user statemachine notifyInstallSnapshotFromLeader exception

Posted by GitBox <gi...@apache.org>.
szetszwo merged pull request #520:
URL: https://github.com/apache/ratis/pull/520


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org