Gérald Quintana created KAFKA-3415:
--------------------------------------

             Summary: AdminOperationException when altering Topic with same 
number of partitions
                 Key: KAFKA-3415
                 URL: https://issues.apache.org/jira/browse/KAFKA-3415
             Project: Kafka
          Issue Type: Improvement
          Components: admin
    Affects Versions: 0.9.0.1
            Reporter: Gérald Quintana
            Priority: Minor


To automate topic creation/modification, we sometimes run kafka-topics.sh 
script with the same topic config. It raises an AdminOperationException, in 
short it's idempotent

{code}
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic logfailed
Topic:logfailed PartitionCount:1        ReplicationFactor:1     
Configs:retention.ms=604800000,retention.bytes=209715200
        Topic: logfailed        Partition: 0    Leader: 1       Replicas: 1     
Isr: 1

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic logfailed 
--partitions 1 --config retention.bytes=209715200 --config 
retention.ms=604800000
WARNING: Altering topic configuration from this script has been deprecated and 
may be removed in future releases.
         Going forward, please use kafka-configs.sh for this functionality
Updated config for topic "logfailed".
WARNING: If partitions are increased for a topic that has a key, the partition 
logic or ordering of the messages will be affected
Error while executing topic command : The number of partitions for a topic can 
only be increased
[2016-03-17 12:25:20,458] ERROR kafka.admin.AdminOperationException: The number 
of partitions for a topic can only be increased
        at kafka.admin.AdminUtils$.addPartitions(AdminUtils.scala:119)
        at 
kafka.admin.TopicCommand$$anonfun$alterTopic$1.apply(TopicCommand.scala:139)
        at 
kafka.admin.TopicCommand$$anonfun$alterTopic$1.apply(TopicCommand.scala:116)
        at 
scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
        at kafka.admin.TopicCommand$.alterTopic(TopicCommand.scala:116)
        at kafka.admin.TopicCommand$.main(TopicCommand.scala:62)
        at kafka.admin.TopicCommand.main(TopicCommand.scala)
 (kafka.admin.TopicCommand$)
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to