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

   In a non-empty log the KRaft leader only notifies the listener of leadership 
when it has read to the leader's epoch start offset. This guarantees that the 
leader epoch has been committed and that the listener has read all committed 
offset/records.
   
   Unfortunately, the KRaft leader doesn't do this when the log is empty. When 
the log is empty the listener is notified immediately when it has become 
leader. This makes the API inconsistent and harder to program against.
   
   This change fixes that by having the KRaft leader wait for the listener's 
nextOffset to be greater than the leader's epoch start offset before calling 
handleLeaderChange.
   
   The RecordsBatchReader implementation is also changed to include control 
records. This makes it possible for the state machine learn about committed 
control records. This additional information can be used to compute the 
committed offset or for counting those bytes when determining when to snapshot 
the partition.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to