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

   ## What changes were proposed in this pull request?
   
   Fix incorrect locking in `LeaderElection`
   
   `LeaderElection` synchronizes on its `ServerInterface` adapter, while 
incoming vote requests synchronize on the underlying `RaftServerImpl`. These 
different locks allow election initialization and vote handling to persist 
metadata concurrently.
   
   This race was observed in CI:
   
   
https://github.com/apache/ratis/actions/runs/38951714056/job/117144457810?pr=1645
   
   Two threads wrote to the same `raft-meta.tmp` file, causing 
`NoSuchFileException` during rename and shutting down the division. A 
subsequent group removal retry failed with `GroupMismatchException`.
   
   Expose the underlying server monitor through `ServerInterface.getLock()` and 
use it for election initialization, forced election initialization, and 
election result handling.
   
   Add regression coverage using the existing test server implementation to 
verify that:
   - Election initialization and higher-term result handling hold the shared 
lock, for both normal and forced elections.
   - The production adapter returns the underlying `RaftServerImpl` as its lock.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/RATIS-2761
   
   ## How was this patch tested?
   
   unit tests.
   


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