wojiaodoubao commented on PR #943:
URL: https://github.com/apache/ratis/pull/943#issuecomment-1774307566

   Hi @Brokenice0415, thanks your detailed explanation! If I understand 
correctly, 'setConfiguration before staring new peers' is right for most cases. 
There might be a small corner case as I'll descried below. Please help review 
whether it exists, thanks. I'll try to simulate it later.
   
   1. If a peer not in C_old is asking for votes from leader, leader will crash 
the peer. 
   2. After we call 'setConfiguration', leader will start a new LogAppender 
thread, keep call appendEntries to the new peer.
   3. If the new peer gets appendEntries, it will accept the leader as its 
leader.
   
   There is a race condition between 'leader appendEntries to peer 3' and 'peer 
3 asks for vote from leader'. So the corner case is:
   1. Originally we have a cluster with peer 0, 1, 2. Peer 0 is leader.
   4. SetConfiguration to peer 0, update conf from {0, 1, 2} to  {0, 1, 2, 3}.
   5. Peer 0 starts a new LogAppender thread responsible for peer 3.
   6. A network partition happens.
   7. Start peer 3.
   8. Network partition recovers.
   9. A race condition between 'leader appendEntries to peer 3' and 'peer 3 
asks for vote from leader' happens. If 'asks for vote' gets first, peer 3 will 
shutdown.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to