d-wang-commit opened a new pull request, #1710:
URL: https://github.com/apache/ratis/pull/1710

   ## What changes were proposed in this pull request?
   
   When a follower's log is up to date but its state machine is too far behind, 
`TransferLeadership.start` immediately rejects the transfer with 
`FAILED_APPLIED_INDEX_GAP`. It completes the request's future but leaves the 
request in `pending`. The current leader then continues to report that it is 
stepping down and can reject writes and configuration changes.
   
   Clear `pending` before completing the failed request. The compare-and-set 
clears it only if it still refers to that request.
   
   Generated-by: OpenAI Codex (GPT-6)
   
   ## What is the link to the Apache JIRA
   
   [RATIS-2834](https://issues.apache.org/jira/browse/RATIS-2834)
   
   ## How was this patch tested?
   
   Extended `testRiskyLeadershipTransfer` to wait for log replication while the 
follower's state machine is paused. After the transfer is rejected, the test 
verifies that the original leader accepts a write in the same term.
   
   Before the fix, the write failed with `LeaderSteppingDownException` on 
`babaf87d5`. With the fix, all 29 tests run against `master` passed: the 27 
tests in `TestLeaderElectionWithGrpc` and the regression test with both Netty 
and simulated RPC.
   


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