You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2021/04/15 15:03:41 UTC

[kafka] branch trunk updated: MINOR: Update default for field in DeleteTopicsRequest

This is an automated email from the ASF dual-hosted git repository.

dajac pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 07fb69c  MINOR: Update default for field in DeleteTopicsRequest
07fb69c is described below

commit 07fb69c16cf2ce1aa2d45b5c7e0dd04a11e42d96
Author: Justine Olshan <jo...@confluent.io>
AuthorDate: Thu Apr 15 08:01:26 2021 -0700

    MINOR: Update default for field in DeleteTopicsRequest
    
    When using DeleteTopicsRequest with topic IDs, the topic name field should be null. Before, the code was programmatically assigning null, but it will be easier and less error prone to simply set that as the default.
    
    Tested using the previously created `DeleteTopicsRequestTest.java` file.
    
    Reviewers: David Jacot <dj...@confluent.io>
---
 .../java/org/apache/kafka/common/requests/DeleteTopicsRequest.java  | 6 ------
 clients/src/main/resources/common/message/DeleteTopicsRequest.json  | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/clients/src/main/java/org/apache/kafka/common/requests/DeleteTopicsRequest.java b/clients/src/main/java/org/apache/kafka/common/requests/DeleteTopicsRequest.java
index dbcc207..1322630 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/DeleteTopicsRequest.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/DeleteTopicsRequest.java
@@ -44,12 +44,6 @@ public class DeleteTopicsRequest extends AbstractRequest {
         public DeleteTopicsRequest build(short version) {
             if (version >= 6 && !data.topicNames().isEmpty()) {
                 data.setTopics(groupByTopic(data.topicNames()));
-            } else if (version >= 6) {
-                for (DeleteTopicState topic : data.topics()) {
-                    if (topic.name() != null && topic.name().equals("")) {
-                        topic.setName(null);
-                    }
-                }
             }
             return new DeleteTopicsRequest(data, version);
         }
diff --git a/clients/src/main/resources/common/message/DeleteTopicsRequest.json b/clients/src/main/resources/common/message/DeleteTopicsRequest.json
index 2e020e980..19bdc8a 100644
--- a/clients/src/main/resources/common/message/DeleteTopicsRequest.json
+++ b/clients/src/main/resources/common/message/DeleteTopicsRequest.json
@@ -31,7 +31,7 @@
   "fields": [
     { "name": "Topics", "type": "[]DeleteTopicState", "versions": "6+", "about": "The name or topic ID of the topic",
       "fields": [
-        {"name": "Name", "type": "string", "versions": "6+", "nullableVersions": "6+", "entityType": "topicName", "about": "The topic name"},
+        {"name": "Name", "type": "string", "versions": "6+", "nullableVersions": "6+", "default": "null", "entityType": "topicName", "about": "The topic name"},
         {"name": "TopicId", "type": "uuid", "versions": "6+", "about": "The unique topic ID"}
     ]},
     { "name": "TopicNames", "type": "[]string", "versions": "0-5", "entityType": "topicName", "ignorable": true,