Jakub Scholz created KAFKA-5940:
-----------------------------------

             Summary: kafka-delete-records.sh doesn't give any feedback when 
the JSON offset configuration file is invalid
                 Key: KAFKA-5940
                 URL: https://issues.apache.org/jira/browse/KAFKA-5940
             Project: Kafka
          Issue Type: Improvement
          Components: tools
            Reporter: Jakub Scholz
            Assignee: Jakub Scholz


When deleting records using {{bin/kafka-delete-records.sh}}, the user has to 
pass a JSON file with the list of topics/partitions and the offset to which the 
records should be deleted. However, currently when such file is invalid the 
utility doesn't print any visible error:

{code}
$ bin/kafka-delete-records.sh --bootstrap-server localhost:9092 
--offset-json-file offset.json
Executing records delete operation
Records delete operation completed:
$
{code}

Instead, I would suggest that it throws an exception to make it clear that the 
problem is the invalid JSON file:
{code}
$ bin/kafka-delete-records.sh --bootstrap-server localhost:9092 
--offset-json-file offset.json
Exception in thread "main" kafka.common.AdminCommandFailedException: Offset 
json file doesn't contain valid JSON data.
        at 
kafka.admin.DeleteRecordsCommand$.parseOffsetJsonStringWithoutDedup(DeleteRecordsCommand.scala:54)
        at 
kafka.admin.DeleteRecordsCommand$.execute(DeleteRecordsCommand.scala:62)
        at kafka.admin.DeleteRecordsCommand$.main(DeleteRecordsCommand.scala:37)
        at kafka.admin.DeleteRecordsCommand.main(DeleteRecordsCommand.scala)
$
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to