Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is a role of leader epoch checkpoint in log segment of Kafka partition?

Tags:

apache-kafka

what is a role of leader epoch checkpoint in log segment of Kafka partition?

folder capture image

like image 900
Aman Avatar asked May 15 '18 05:05

Aman


People also ask

What is leader epoch checkpoint?

This is only available for the active segment (log file). leader-epoch-checkpoint - It refers to the number of leaders previously assigned by the controller. The replicas use the leader epoch as a means of verifying the current leader. The leader-epoch-checkpoint file contains two columns: epochs and offsets.

What is leader partition in Kafka?

The partition leader is a Kafka Broker. Partition Leader. This is clearly mentioned in Kafka Docs: Each partition has one server which acts as the "leader" and zero or more servers which act as "followers".

What is log segment in Kafka?

log file is an actual segment containing records up to a specific offset. The name of the file defines the starting offset of the records in that log. The . index file contains an index that maps a logical offset (in effect the record's id) to the byte offset of the record within the . log file.

What happens when a leader broker of a partition fails in Kafka?

The leader handles all the read and writes operations of data for the partitions. The leader and its followers are determined by the zookeeper(discussed later). If the broker holding the leader for the partition fails to serve the data due to any failure, one of its respective ISR replicas will takeover the leadership.


1 Answers

In Kafka, a leader epoch refers to the number of leaders previously assigned by the controller. Every time a leader fails, the controller selects the new leader, increments the current "leader epoch" by 1, and shares the leader epoch with all replicas. The replicas use the leader epoch as a means of verifying the current leader. If a leader fails and returns, when it tries to contact other replicas, it will send what it believes is the current leader epoch. The replicas will ignore the messages sent with outdated leader epochs.

The leader-epoch-checkpoint file contains two columns: epochs and offsets, as shown here. Each row is a checkpoint for the latest recorded leader epoch and the leader's latest offset upon becoming leader. Both replicas and leaders contain this file. Its role is for checking what range of offsets pertain to which epoch.

like image 61
Jor Avatar answered Jun 11 '23 20:06

Jor