A log end offset (LEO) marks the end of the messages received on a Kafka partition log or replica log. Each partition replica maintains its own LEO, allowing Kafka to track how far replication has progressed. section 8.4.1
LEO is central to in-sync replica management. A follower must retrieve messages through the leader’s LEO within the permitted lag time; otherwise, the leader removes it from the partition’s ISR. A replica that stops responding to heartbeats can also be removed immediately. section 8.4.1
LEO participates in replication as follows:
- When a leader or follower receives a message, it advances its corresponding LEO. section 8.4.2
- A follower includes its current LEO in fetch requests, telling the leader which messages it has received and which remain missing. section 8.4.2
- The leader compares replica positions to determine whether followers have caught up and should remain in the ISR. section 8.4.1 section 8.4.2
LEO differs from the High Watermark (HWM). LEO shows how far an individual log has received messages; HWM marks the position replicated by all current ISRs. Consumers can read only through the HWM, so LEO may be ahead while newly received messages remain unavailable for consumption. section 8.4.2
Leader and follower fetch cycle
A partition leader receives a message and advances its LEO. During the next follower fetch, the leader sees that the follower’s LEO is behind and sends the missing message. After a later fetch confirms that the follower has caught up, the replicated position can contribute to the HWM. section 8.4.2
Figure 8.6 This shows the follower’s LCO before and after the fetch request (Current Position). The HWM indicates the latest offset committed by all ISRs. Because the follower is behind, its LCO is lower than the HWM. The LEO is a bit ahead of the HWM, as new messages are arriving.
Compare a follower’s position with the HWM and the leader’s slightly ahead LEO to see how replication lag and newly arriving messages coexist. section 8.4.2
