Kafka 4060 remove zk client dependency in kafka streams followup re-branched from trunk#2389
Conversation
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
| } else { | ||
| throw new StreamsException("Inconsistent response received from broker " + brokerId + | ||
| ", expected correlation id " + clientRequest.correlationId() + ", but received " + | ||
| throw new StreamsException("Inconsistent response received from the broker, expected correlation id " + clientRequest.correlationId() + ", but received " + |
There was a problem hiding this comment.
Out of curiosity, why do we remove the broker id from the message?
There was a problem hiding this comment.
The broker id is not available and I didn't want to call getBrokerId.
There was a problem hiding this comment.
ClientRequest.destination is the broker id.
|
This PR removes the delete topic, and throws an exception is the number of partitions has changed. However, the number of partitions always changes in some cases, due to the topic auto-create issue. As I understand it, with this PR an app will fail. How do we address that? @hjafarpour @guozhangwang |
dguy
left a comment
There was a problem hiding this comment.
Left some comments. Also, AFAICT StreamsKafkaClient doesn't have any tests - this should be fixed
| if (existingTopicNamesPartitions.get(topic.name()) != null) { | ||
| if (existingTopicNamesPartitions.get(topic.name()) != topicsPartitionsMap.get(topic)) { | ||
| deleteTopics.put(topic, topicsPartitionsMap.get(topic)); | ||
| throw new StreamsException("Internal topic with invalid partitons. Use 'kafka.tools.StreamsResetter' tool to clean up invalid topics before proceesing."); |
There was a problem hiding this comment.
typo: - proceesing -> processing
| final ClientResponse clientResponse = sendRequest(clientRequest); | ||
|
|
||
| if (!(clientResponse.responseBody() instanceof CreateTopicsResponse)) { | ||
| throw new StreamsException("Inconsistent response type for internal topic creation request. Expected CreateTopicsResponse but received " + clientResponse.responseBody().getClass().getName()); |
There was a problem hiding this comment.
This probably needs to check clientResponse.hasResponse() otherwise it could throw NullPointerException
| final ClientRequest clientRequest = kafkaClient.newClientRequest(getBrokerId(), new MetadataRequest.Builder(Arrays.asList(topic)), Time.SYSTEM.milliseconds(), true, null); | ||
| final ClientResponse clientResponse = sendRequest(clientRequest); | ||
| if (!(clientResponse.responseBody() instanceof MetadataResponse)) { | ||
| throw new StreamsException("Inconsistent response type for internal topic metadata request. Expected MetadataResponse but received " + clientResponse.responseBody().getClass().getName()); |
There was a problem hiding this comment.
Same as above: need to check clientResponse.hasResponse()
| public Collection<MetadataResponse.TopicMetadata> fetchTopicsMetadata() { | ||
|
|
||
| final ClientRequest clientRequest = kafkaClient.newClientRequest(getBrokerId(), new MetadataRequest.Builder(null), Time.SYSTEM.milliseconds(), true, null); | ||
| final ClientResponse clientResponse = sendRequest(clientRequest); |
|
Ok, that seems to be in a different PR: #2379. Got it, thanks. |
| * partitions delete them and create new ones with correct number of partitons along with the non existing topics. | ||
| * Prepares a given internal topic. | ||
| * If the topic does not exist creates a new topic. | ||
| * If the topic with the correct number of partitions exists ignores it. |
|
@hjafarpour Could you address the above comments? |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
…e already exist with unexpected number of partitions Re-branched the trunk and applied the changes to the new branch to simplify commit log. Author: Hojjat Jafarpour <hojjat@Hojjat-Jafarpours-MBP.local> Reviewers: Ismael Juma, Damian Guy, Eno Thereska, Guozhang Wang Closes #2389 from hjafarpour/KAFKA-4060-Remove-ZkClient-dependency-in-Kafka-Streams-followup-from-trunk Address Ismael's comments upon merging (cherry picked from commit 8e2cbae) Signed-off-by: Guozhang Wang <wangguoz@gmail.com>
|
Addressed @ijuma 's comments upon merging to trunk and 0.10.2. |
…e already exist with unexpected number of partitions Re-branched the trunk and applied the changes to the new branch to simplify commit log. Author: Hojjat Jafarpour <hojjat@Hojjat-Jafarpours-MBP.local> Reviewers: Ismael Juma, Damian Guy, Eno Thereska, Guozhang Wang Closes apache#2389 from hjafarpour/KAFKA-4060-Remove-ZkClient-dependency-in-Kafka-Streams-followup-from-trunk Address Ismael's comments upon merging
Re-branched the trunk and applied the changes to the new branch to simplify commit log.