Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16455

Check partition exists before send reassignments to server in ReassignPartitionsCommand

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.8.0
    • tools
    • None

    Description

      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 

      bin/kafka-reassign-partitions.sh 
        --bootstrap-server 192.168.0.128:9092 
        --reassignment-json-file reassignment.json 
        --execute
      

      Where reassignment.json contains

      {
        "version": 1,
        "partitions": [
          {
            "topic": "first_topic",
            "partition": 20,
            "replicas": [1002, 1001, 1003],
            "log_dirs": ["any", "any", "any"]
          }
        ]
      }
      

      The console outputs

      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.
      

      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

      Attachments

        Issue Links

          Activity

            People

              brandboat Kuan Po Tseng
              brandboat Kuan Po Tseng
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: