Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend: add leader epoch to partition api response #1484

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions backend/pkg/console/topic_partitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ type TopicPartitionMetadata struct {

// Leader is the broker leader for this partition. This will be -1 on leader / listener error.
Leader int32 `json:"leader"`

// LeaderEpoch, proposed in KIP-320 and introduced in Kafka 2.1.0 is the
// epoch of the broker leader.
//
// This field has a default of -1.
LeaderEpoch int32 `json:"leaderEpoch"`
}

// TopicPartitionMarks contains information about the offsets for a partition.
Expand Down Expand Up @@ -178,6 +184,7 @@ func (s *Service) GetTopicDetails(ctx context.Context, topicNames []string) ([]T
OfflineReplicas: partition.OfflineReplicas,
InSyncReplicas: partition.InSyncReplicas,
Leader: partition.Leader,
LeaderEpoch: partition.LeaderEpoch,
},
TopicPartitionMarks: &TopicPartitionMarks{
PartitionID: partitionMarks.PartitionID,
Expand Down Expand Up @@ -247,6 +254,7 @@ func (s *Service) getTopicPartitionMetadata(ctx context.Context, topicNames []st
metadata.InSyncReplicas = partition.ISR
metadata.Replicas = partition.Replicas
metadata.Leader = partition.Leader
metadata.LeaderEpoch = partition.LeaderEpoch
metadata.OfflineReplicas = partition.OfflineReplicas
partitionInfo[i] = TopicPartitionDetails{
&metadata,
Expand Down
Loading