divijvaidya opened a new pull request, #12224:
URL: https://github.com/apache/kafka/pull/12224

   1\ As per the interface contract for `RaftClient.scheduleAtomicAppend()` 
[1], it should throw a `NotLeaderException` exception when the provided current 
leader epoch does not match the current epoch. However, the current 
`LocalLogManager`'s implementation of the API returns a LONG_MAX instead of 
throwing an exception. This change fixes the behaviour and makes it consistent 
with the interface contract.
   
   2\ As per the interface contract for `RaftClient.resign(epoch)` [2] if the 
parameter epoch does not match the current epoch, this call will be ignored. 
But in the current `LocalLogManager` implementation the leader epoch might 
change when the thread if waiting to acquire a lock on `shared.tryAppend()` 
(note that tryAppend() is a synchronized method). In such a case, if a 
NotALeaderException is thrown (as per code change in 1\ above), then resign 
should be ignored.
   
   
   
   [1] 
https://github.com/apache/kafka/blob/trunk/raft/src/main/java/org/apache/kafka/raft/RaftClient.java#L145
 
   [2] 
https://github.com/apache/kafka/blob/trunk/raft/src/main/java/org/apache/kafka/raft/RaftClient.java#L208


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