Review Board 1.7.22


Move AddPartitions into TopicCommand in trunk

Review Request #14554 - Created Oct. 9, 2013 and updated

Sriram Subramanian
KAFKA-1052
Reviewers
kafka
kafka
Move AddPartitions into TopicCommand

 
Total:
2
Open:
0
Resolved:
2
Dropped:
0
Status:
From:
Description From Last Updated Status
Posted (Oct. 9, 2013, 5:23 p.m.)
Got the following error when running the tool.

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --partitions 3 --topic test
partitions can only be added when topic has no key
Exception in thread "main" java.lang.NullPointerException
	at kafka.admin.AdminUtils$.getManualReplicaAssignment(AdminUtils.scala:122)
	at kafka.admin.AdminUtils$.addPartitions(AdminUtils.scala:106)
	at kafka.admin.TopicCommand$.alterTopic(TopicCommand.scala:91)
	at kafka.admin.TopicCommand$.main(TopicCommand.scala:50)
	at kafka.admin.TopicCommand.main(TopicCommand.scala)
  1. my bad. Had the change but had not commited it and the tool did not pick it up.
Technically, one can still increase # partitions even if messages have keys. The user just needs to be aware of the impact, i.e., messages with the same key may move to a different partition.
Ditto for the comment above.
Posted (Oct. 9, 2013, 5:31 p.m.)

   

  
I think keyed-messages and none-key messages can be sent to a topic at the same time, and we cannot control that client behavior. SO I suggest changing this to "WARNING: sending keyed-messages to topics whose partitions are expanded may not reserve the order anymore"
Why need to increment the added # partitions by 1 here?
  1. The addPartitions input is the total number of partitions now.