You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Xinyu Tan (Jira)" <ji...@apache.org> on 2024/01/29 03:47:00 UTC

[jira] [Created] (RATIS-2019) Fixed abnormal exit of StateMachineUpdater

Xinyu Tan created RATIS-2019:
--------------------------------

             Summary: Fixed abnormal exit of StateMachineUpdater
                 Key: RATIS-2019
                 URL: https://issues.apache.org/jira/browse/RATIS-2019
             Project: Ratis
          Issue Type: Bug
            Reporter: Xinyu Tan
            Assignee: Xinyu Tan
             Fix For: 3.0.1
         Attachments: image-2024-01-29-11-36-17-263.png

In some scenarios where Ratis is restarted, we find that there is a certain probability of an error at startup.

!image-2024-01-29-11-36-17-263.png!

 

 

By looking through the code, I found [here|https://github.com/apache/ratis/blob/master/ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderStateImpl.java#L429] is a problem with the code

StateMachineUpdater will call this line when applying any member change log from previous term if the Leader exists, but the startupEntry for the current term may not have been initialized yet, so the assertion will throw an error.

We should only fire this assertion if the log matches the current term.

In addition, I found that the current implementation triggers notifyLeaderReady several times in the member change log of the current term, which is not consistent with the semantics of this interface, because the Leader is always in the ready state



--
This message was sent by Atlassian Jira
(v8.20.10#820010)