Skip to content

Commit

Permalink
fix: ensure each broker is preferred leader for a partition
Browse files Browse the repository at this point in the history
The end-to-end monitoring service already includes a process to validate
that each broker is the preferred leader for at least one partition, but
this validation was not run for brokers that were not the preferred
leader for any partitions.

For example, this would mean an additional partition would never be
created after the initial creation of the management topic in the case
of another broker being added to the cluster.

This fix could be a breaking change for users without the required
permissions to create partitions or alter partition assignments if they
have inadvertently relied on this feature not working as documented.
  • Loading branch information
nickgooding authored and weeco committed Nov 3, 2024
1 parent 7bed85e commit 5d646d0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions e2e/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func (s *Service) calculatePartitionReassignments(meta *kmsg.MetadataResponse) (
// We want to ensure that each brokerID leads at least one partition permanently. Hence let's iterate over brokers.
preferredLeaderPartitionsBrokerID := make(map[int32][]kmsg.MetadataResponseTopicPartition)
for _, broker := range brokerByID {
preferredLeaderPartitionsBrokerID[broker.NodeID] = make([]kmsg.MetadataResponseTopicPartition, 0)
for _, partition := range topicMeta.Partitions {
// PreferredLeader = BrokerID of the brokerID that is the desired leader. Regardless who the current leader is
preferredLeader := partition.Replicas[0]
Expand Down

0 comments on commit 5d646d0

Please sign in to comment.