Kuan Po Tseng created KAFKA-16455: ------------------------------------- Summary: Check partition exists before send reassignments to server in ReassignPartitionsCommand Key: KAFKA-16455 URL: https://issues.apache.org/jira/browse/KAFKA-16455 Project: Kafka Issue Type: Improvement Components: tools Reporter: Kuan Po Tseng Assignee: Kuan Po Tseng
Currently, when executing {{kafka-reassign-partitions.sh}} with the {{--execute}} option, if a partition number specified in the JSON file does not exist, this check occurs only when submitting the reassignments to {{alterPartitionReassignments}} on the server-side. We can perform this check in advance before submitting the reassignments to the server side. For example, suppose we have three brokers with IDs 1001, 1002, and 1003, and a topic named {{first_topic}} with only three partitions. And execute {code:bash} bin/kafka-reassign-partitions.sh --bootstrap-server 192.168.0.128:9092 --reassignment-json-file reassignment.json --execute {code} Where reassignment.json contains {code:json} { "version": 1, "partitions": [ { "topic": "first_topic", "partition": 20, "replicas": [1002, 1001, 1003], "log_dirs": ["any", "any", "any"] } ] } {code} The console outputs {code:java} Current partition replica assignment {"version":1,"partitions":[]} Save this to use as the --reassignment-json-file option during rollback Error reassigning partition(s): first_topic-20: The partition does not exist. {code} Apart from the output {{\{"version":1,"partitions":[]\}}} which doesn't provide much help, the error {{first_topic-20: The partition does not exist.}} is reported back to the tool from the server-side, as mentioned earlier. This check could be moved earlier before sending reassignments to server side -- This message was sent by Atlassian Jira (v8.20.10#820010)