You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Jun Rao (JIRA)" <ji...@apache.org> on 2015/06/13 00:52:01 UTC

[jira] [Updated] (KAFKA-2214) kafka-reassign-partitions.sh --verify should return non-zero exit codes when reassignment is not completed yet

     [ https://issues.apache.org/jira/browse/KAFKA-2214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jun Rao updated KAFKA-2214:
---------------------------
    Reviewer: Neha Narkhede

> kafka-reassign-partitions.sh --verify should return non-zero exit codes when reassignment is not completed yet
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-2214
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2214
>             Project: Kafka
>          Issue Type: Improvement
>          Components: admin
>    Affects Versions: 0.8.1.1, 0.8.2.0
>            Reporter: Michael Noll
>            Assignee: Manikumar Reddy
>            Priority: Minor
>         Attachments: KAFKA-2214.patch
>
>
> h4. Background
> The admin script {{kafka-reassign-partitions.sh}} should integrate better with automation tools such as Ansible, which rely on scripts adhering to Unix best practices such as appropriate exit codes on success/failure.
> h4. Current behavior (incorrect)
> When reassignments are still in progress {{kafka-reassign-partitions.sh}} prints {{ERROR}} messages but returns an exit code of zero, which indicates success.  This behavior makes it a bit cumbersome to integrate the script into automation tools such as Ansible.
> {code}
> $ kafka-reassign-partitions.sh --zookeeper zookeeper1:2181 --reassignment-json-file partitions-to-move.json --verify
> Status of partition reassignment:
> ERROR: Assigned replicas (316,324,311) don't match the list of replicas for reassignment (316,324) for partition [mytopic,2]
> Reassignment of partition [mytopic,0] completed successfully
> Reassignment of partition [myothertopic,1] completed successfully
> Reassignment of partition [myothertopic,3] completed successfully
> ...
> $ echo $?
> 0
> # But preferably the exit code in the presence of ERRORs should be, say, 1.
> {code}
> h3. How to improve
> I'd suggest that, using the above as the running example, if there are any {{ERROR}} entries in the output (i.e. if there are any assignments remaining that don't match the desired assignments), then the {{kafka-reassign-partitions.sh}}  should return a non-zero exit code.
> h3. Notes
> In Kafka 0.8.2 the output is a bit different: The ERROR messages are now phrased differently.
> Before:
> {code}
> ERROR: Assigned replicas (316,324,311) don't match the list of replicas for reassignment (316,324) for partition [mytopic,2]
> {code}
> Now:
> {code}
> Reassignment of partition [mytopic,2] is still in progress
> {code}



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