This repository was archived by the owner on Jan 24, 2024. It is now read-only.
Fix some corner cases not handled well for CreateTopics request#592
Merged
jiazhai merged 3 commits intostreamnative:masterfrom Jun 28, 2021
Merged
Conversation
Collaborator
Author
|
FYI @Krishsocgen you can try this patch for your Kafka Connect. |
Collaborator
Author
|
The Kafka Streams tests may fail after this PR, I'll take a look. |
4a4ab98 to
05c962c
Compare
dockerzhang
approved these changes
Jun 27, 2021
jiazhai
approved these changes
Jun 28, 2021
BewareMyPower
added a commit
that referenced
this pull request
Jun 29, 2021
Fixes #591 ### Motivation Kafka Connect use `Admin#createTopics` and check the `TopicExistsException` exception for existed topics. See https://github.com/apache/kafka/blob/ef3cd68c852daf21d8e207fa8e21c8770f4041d7/connect/runtime/src/main/java/org/apache/kafka/connect/util/TopicAdmin.java#L394 for details. However, currently `Admin#createTopics` will return an `UnknownServerException` for any failure when create topics. In addition, the handler for CreateTopics request has other problems. 1. The default partition number (-1) is not handled, which may throw exception from `createPartitionedTopicAsync`. 2. If topic name is invalid, the future won't be completed until timeout. See #361, TimeoutException will be thrown in this case. ### Modifications 1. When the topic to create already exists, return a `TopicExistsException`. 2. Add a `tryComplete` method to complete a future of topic creation that may also complete the future of response. 3. Add related tests. ===== * Fix some bugs for create topic request * Fix KStreamAggregationTest * Catch KoPTopicException instead of RuntimeException
BewareMyPower
added a commit
that referenced
this pull request
Jun 29, 2021
Fixes #591 Kafka Connect use `Admin#createTopics` and check the `TopicExistsException` exception for existed topics. See https://github.com/apache/kafka/blob/ef3cd68c852daf21d8e207fa8e21c8770f4041d7/connect/runtime/src/main/java/org/apache/kafka/connect/util/TopicAdmin.java#L394 for details. However, currently `Admin#createTopics` will return an `UnknownServerException` for any failure when create topics. In addition, the handler for CreateTopics request has other problems. 1. The default partition number (-1) is not handled, which may throw exception from `createPartitionedTopicAsync`. 2. If topic name is invalid, the future won't be completed until timeout. See #361, TimeoutException will be thrown in this case. 1. When the topic to create already exists, return a `TopicExistsException`. 2. Add a `tryComplete` method to complete a future of topic creation that may also complete the future of response. 3. Add related tests. ===== * Fix some bugs for create topic request * Fix KStreamAggregationTest * Catch KoPTopicException instead of RuntimeException
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #591
Motivation
Kafka Connect use
Admin#createTopicsand check theTopicExistsExceptionexception for existed topics. See https://github.com/apache/kafka/blob/ef3cd68c852daf21d8e207fa8e21c8770f4041d7/connect/runtime/src/main/java/org/apache/kafka/connect/util/TopicAdmin.java#L394 for details.However, currently
Admin#createTopicswill return anUnknownServerExceptionfor any failure when create topics. In addition, the handler for CreateTopics request has other problems.createPartitionedTopicAsync.Modifications
TopicExistsException.tryCompletemethod to complete a future of topic creation that may also complete the future of response.