-
Notifications
You must be signed in to change notification settings - Fork 15k
KAFKA-10764: Add support for returning topic IDs on create, supplying topic IDs for delete #9684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f983256
Returns topic ID in CreateTopicsResponse
jolshan 8b14ab4
DeleteTopicsRequest allows for specifying topic IDs
jolshan b8c1a0a
Fix some typos, correctly add/remove topic Ids in MockAdminClient, fi…
jolshan bd593cf
Fixes to json files and handling in KafkaApis
jolshan 7f2ebfb
Addressed comments, added handling for older IBPs
jolshan 4489573
Merge branch 'trunk' into KAFKA-10764
jolshan f1a56cc
Added to a simple createtopics request test
jolshan 0dfd4ee
Removed incorrect test and added error message to clarify unsupported…
jolshan f2ef758
Merge branch 'trunk' of github.com:apache/kafka into KAFKA-10764
jolshan 40175b3
Cleanups, added tests for older IBP version
jolshan d4754e2
Addressed comments--moved topic ID in create to ZkAdminManager, updat…
jolshan 46b109d
fix package name
jolshan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
54 changes: 54 additions & 0 deletions
54
clients/src/main/java/org/apache/kafka/clients/admin/DeleteTopicsWithIdsResult.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.kafka.clients.admin; | ||
|
|
||
| import org.apache.kafka.common.KafkaFuture; | ||
| import org.apache.kafka.common.Uuid; | ||
| import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * The result of the {@link Admin#deleteTopicsWithIds(Collection)} call. | ||
| * | ||
| * The API of this class is evolving, see {@link Admin} for details. | ||
| */ | ||
| @InterfaceStability.Evolving | ||
| public class DeleteTopicsWithIdsResult { | ||
| final Map<Uuid, KafkaFuture<Void>> futures; | ||
|
|
||
| DeleteTopicsWithIdsResult(Map<Uuid, KafkaFuture<Void>> futures) { | ||
| this.futures = futures; | ||
| } | ||
|
|
||
| /** | ||
| * Return a map from topic IDs to futures which can be used to check the status of | ||
| * individual deletions. | ||
| */ | ||
| public Map<Uuid, KafkaFuture<Void>> values() { | ||
| return futures; | ||
| } | ||
|
|
||
| /** | ||
| * Return a future which succeeds only if all the topic deletions succeed. | ||
| */ | ||
| public KafkaFuture<Void> all() { | ||
| return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture[0])); | ||
| } | ||
| } |
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
27 changes: 27 additions & 0 deletions
27
clients/src/main/java/org/apache/kafka/common/errors/UnknownTopicIdException.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.kafka.common.errors; | ||
|
|
||
| public class UnknownTopicIdException extends InvalidMetadataException { | ||
|
|
||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| public UnknownTopicIdException(String message) { | ||
| super(message); | ||
| } | ||
|
|
||
| } |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed all these comments say "If broker version doesn't support replication factor in the response..." should each actually say whatever the method is returning (numPartitions, topicId, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the create result, we wouldn't see UnsupportedVersionException for topicId() just because topic ids are not enabled, would we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could either do that or just return Uuid.ZERO_UUID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning
Uuid.ZERO_UUIDshould be fine. The comment just seems odd, I am not sure why we have it that way in the other methods.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was odd too.