|
|
@ -69,14 +69,18 @@ func EnsureAssignmentsToActiveBrokers(activeBrokers cmap.ConcurrentMap[string,*B |
|
|
|
} |
|
|
|
|
|
|
|
// pick the brokers with the least number of partitions
|
|
|
|
if len(addedAssignments) > 0 { |
|
|
|
pickedBrokers := pickBrokers(activeBrokers, int32(len(addedAssignments))) |
|
|
|
for i, assignment := range addedAssignments { |
|
|
|
assignment.LeaderBroker = pickedBrokers[i] |
|
|
|
} |
|
|
|
pickedBrokers = pickBrokers(activeBrokers, int32(len(updatedAssignments))) |
|
|
|
} |
|
|
|
if len(updatedAssignments) == 0 { |
|
|
|
pickedBrokers := pickBrokers(activeBrokers, int32(len(updatedAssignments))) |
|
|
|
for i, assignment := range updatedAssignments { |
|
|
|
assignment.LeaderBroker = pickedBrokers[i] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|
} |