I have tried to use the Sarama Go library to update the partitions in kafka, Can anybody suggest whether this library support this feature?
func UpdateTopic_part(topicDetails *TopicInfo, con kafka.ClusterAdmin) {
fmt.Println("update Partitions")
topicAssignment := make([][]int32, 0, 2)
err := con.AlterPartitionReassignments(topicDetails.Topic_name, topicAssignment)
if err != nil {
log.Error(err)
}
}
You want CreatePartitions
if you want to "update partitions" (note: partitions cannot be reduced in Kafka) of an existing topic.
AlterPartitionReassignments
is primarily to be used for moving existing partitions around, the same as kafka-reassign-partitions.sh
. That 2d array is a list of brokerIds, each to a list of partitions that each broker would store.