You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by lu...@apache.org on 2026/01/19 15:11:44 UTC

(kafka) 01/02: MINOR: Streams group should not be reported as failed solely due to an internal topic deletion error. (#21320)

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

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

commit fba663af775ce758f3f987b994edebf0b184ae42
Author: Alieh Saeedi <10...@users.noreply.github.com>
AuthorDate: Mon Jan 19 09:44:03 2026 +0100

    MINOR:  Streams group should not be reported as failed solely due to an internal topic deletion error. (#21320)
    
    When deleting a streams group, if the deletion of internal topics fails
    due to `UnknownTopicOrPartitionException`, we currently return an error.
    While this isn’t technically incorrect, it would be preferable to return
    exit code 0 here, since the group itself was successfully deleted and no
    internal topics remain (either because they were never created or
    because they were deleted manually).
    
    Reviewers: Lucas Brutschy <lb...@confluent.io>, Matthias J. Sax
     <ma...@confluent.io>
---
 .../java/org/apache/kafka/tools/streams/StreamsGroupCommand.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java b/tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java
index f76a81b9c19..11d52f63dc7 100644
--- a/tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java
+++ b/tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java
@@ -749,9 +749,14 @@ public class StreamsGroupCommand {
             if (!internalTopicsToBeDeleted.keySet().isEmpty()) {
                 printInternalTopicErrors(internalTopicsDeletionFailures, success.keySet(), internalTopicsToBeDeleted.keySet());
             }
-            // for testing purpose: return all failures, including internal topics deletion failures
+            // for testing purpose: return all failures,
+            // however we don’t want the operation to fail just because internal topics were not found to be deleted.
+            internalTopicsDeletionFailures.forEach((group, error) -> {
+                if (!(error instanceof UnknownTopicOrPartitionException)) {
+                    failed.put(group, error);
+                }
+            });
             failed.putAll(success);
-            failed.putAll(internalTopicsDeletionFailures);
             return failed;
         }