You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "kaijchen (via GitHub)" <gi...@apache.org> on 2023/03/06 09:53:29 UTC

[GitHub] [ratis] kaijchen opened a new pull request, #843: RATIS-1796. [WIP] Add PRE_CANDIDATE and refactor LeaderElection

kaijchen opened a new pull request, #843:
URL: https://github.com/apache/ratis/pull/843

   ## What changes were proposed in this pull request?
   
   > TransferLeadership can be stopped by appendEntries from old leader, see Jira for details
   >
   > 1. Transferee received startLeaderElection (RaftServerImpl#startLeaderElection:1700 -> RaftServerImpl#changeToCandidate:649 -> RoleInfo#startLeaderElection:121 -> start new thread LeaderElection)
   > 2. Transferee received appendEntries (stack trace in the log above), and become follower.
   > 3. LeaderElection thread in step 1 is running, found the CandidateState is already CLOSED by step 2.
   > 
   > The term of transferee is expected to be increased in step 3 (LeaderElection#run:238 -> LeaderElection#askForVotes:304 -> ServerState#initElection:221 -> currentTerm.incrementAndGet).
   > But in this case, step 2 is executed before step 3 when the term hasn't been increased.
   
   Maybe we can introduce a Pre-Candidate state along with the Candidate state.
   And increase the term when a peer becomes Candidate instead of in LeaderElection.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/RATIS-1796
   
   ## How was this patch tested?
   
   100x TestElectionCommandIntegrationWithGrpc#testElectionTransferCommand
   Before: https://github.com/kaijchen/ratis/actions/runs/4341726755
   After: https://github.com/kaijchen/ratis/actions/runs/4341982282
   
   100x LeaderElectionTests
   Before: https://github.com/kaijchen/ratis/actions/runs/4341978875
   After: https://github.com/kaijchen/ratis/actions/runs/4342023911
   


-- 
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] kaijchen closed pull request #843: RATIS-1796. [WIP] Add PRE_CANDIDATE and refactor LeaderElection

Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen closed pull request #843: RATIS-1796. [WIP] Add PRE_CANDIDATE and refactor LeaderElection
URL: https://github.com/apache/ratis/pull/843


-- 
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] kaijchen commented on pull request #843: RATIS-1796. [WIP] Add PRE_CANDIDATE and refactor LeaderElection

Posted by "kaijchen (via GitHub)" <gi...@apache.org>.
kaijchen commented on PR #843:
URL: https://github.com/apache/ratis/pull/843#issuecomment-1456208016

   After a second thought, let's focus on addressing the problem in this Jira, and leave PreCandidate state as TODO for now.
   Closed in favor of #844.


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