mirror of https://github.com/apache/kafka.git
This PR adds support for add-controller and remove-controller in the kafka-metadata-quorum.sh command-line tool. It also fixes some minor server-side bugs that blocked the tool from working. In kafka-metadata-quorum.sh, the implementation of remove-controller is fairly straightforward. It just takes some command-line flags and uses them to invoke AdminClient. The add-controller implementation is a bit more complex because we have to look at the new controller's configuration file. The parsing logic for the advertised.listeners and listeners server configurations that we need was previously implemented in the :core module. However, the gradle module where kafka-metadata-quorum.sh lives, :tools, cannot depend on :core. Therefore, I moved listener parsing into SocketServerConfigs.listenerListToEndPoints. This will be a small step forward in our efforts to move Kafka configuration out of :core. I also made some minor changes in kafka-metadata-quorum.sh and Kafka-storage-tool.sh to handle --help without displaying a backtrace on the screen, and give slightly better error messages on stderr. Also, in DynamicVoter.toString, we now enclose the host in brackets if it contains a colon (as IPV6 addresses can). This PR fixes our handling of clusterId in addRaftVoter and removeRaftVoter, in two ways. Firstly, it marks clusterId as nullable in the AddRaftVoterRequest.json and RemoveRaftVoterRequest.json schemas, as it was always intended to be. Secondly, it allows AdminClient to optionally send clusterId, by using AddRaftVoterOptions and RemoveRaftVoterOptions. We now also remember to properly set timeoutMs in AddRaftVoterRequest. This PR adds unit tests for KafkaAdminClient#addRaftVoter and KafkaAdminClient#removeRaftVoter, to make sure they are sending the right things. Finally, I fixed some minor server-side bugs that were blocking the handling of these RPCs. Firstly, ApiKeys.ADD_RAFT_VOTER and ApiKeys.REMOVE_RAFT_VOTER are now marked as forwardable so that forwarding from the broker to the active controller works correctly. Secondly, org.apache.kafka.raft.KafkaNetworkChannel has now been updated to enable API_VERSIONS_REQUEST and API_VERSIONS_RESPONSE. Co-authored-by: Murali Basani muralidhar.basani@aiven.io Reviewers: José Armando García Sancio <jsancio@apache.org>, Alyssa Huang <ahuang@confluent.io> |
||
---|---|---|
.. | ||
src | ||
tools-api/src | ||
.gitignore |