[
https://issues.apache.org/jira/browse/KAFKA-20821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Viktor Somogyi-Vass reassigned KAFKA-20821:
-------------------------------------------
Assignee: Viktor Somogyi-Vass
> kafka-delete-records.sh exits 0 even when some partitions fail to delete
> ------------------------------------------------------------------------
>
> Key: KAFKA-20821
> URL: https://issues.apache.org/jira/browse/KAFKA-20821
> Project: Kafka
> Issue Type: Bug
> Components: tools
> Affects Versions: 4.4.0
> Reporter: Viktor Somogyi-Vass
> Assignee: Viktor Somogyi-Vass
> Priority: Minor
>
> DeleteRecordsCommand iterates over the per-partition results of
> {{Admin.deleteRecords()}} and prints an error for any partition whose future
> fails, but it does not propagate that failure. The command still returns exit
> code 0, so operators and scripts that check the exit status are told the
> operation succeeded even though one or more partitions were not deleted.
> *Steps to reproduce:*
> # Run kafka-delete-records.sh with an offset JSON file that includes a
> non-existent topic-partition (or one that otherwise errors).
> # Observe the per-partition error: line in stdout.
> # Check {{$?}} (it should be 0)
> *Expected:* The command should exit non-zero when any partition fails, so
> failures are detectable programmatically.
> *Fix:* Collect the failed partitions while printing their errors and, if any
> occurred, throw AdminCommandFailedException (consistent with the tool's
> existing error handling). mainNoExit already maps a thrown exception to exit
> code 1.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)