Unable to Update partitions in kafka using Sarama Library

Viewed 19

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)
    }
}
1 Answers

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.

Related