You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/04/27 08:19:25 UTC

[GitHub] [incubator-ratis] runzhiwang opened a new pull request #68: RATIS-885. Fix Failed UT because error use of attemptRepeatedly to check boolean condition

runzhiwang opened a new pull request #68:
URL: https://github.com/apache/incubator-ratis/pull/68


   **What's the problem ?**
   ![image](https://user-images.githubusercontent.com/51938049/80349974-a440a180-88a2-11ea-966b-6509665b4049.png)
   
   **What's the reason ?**
   I think the author of following code want to try 10 seconds until `followerState.getLastAppliedIndex() >= leaderLastIndex`, but actually `JavaUtils.attemptRepeatedly` will not retry unless the statement throw exception as the image shows.
   ```
       // make sure the restarted follower can catchup
       final ServerState followerState = cluster.getRaftServerImpl(followerId).getState();
       JavaUtils.attemptRepeatedly(() -> followerState.getLastAppliedIndex() >= leaderLastIndex,
           10, ONE_SECOND, "follower catchup", LOG);
   ```
   
   ![image](https://user-images.githubusercontent.com/51938049/80350070-c4706080-88a2-11ea-8758-f6681e21af7e.png)
   
   **How to fix ?**
   I fix all the error use of JavaUtils.attemptRepeatedly to check boolean condition.
   


----------------------------------------------------------------
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.

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