lucasbru commented on code in PR #21110:
URL: https://github.com/apache/kafka/pull/21110#discussion_r2603978967


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java:
##########
@@ -699,17 +710,42 @@ public void 
onHeartbeatSuccess(StreamsGroupHeartbeatResponse response) {
             processAssignmentReceived(
                 toTasksAssignment(activeTasks),
                 toTasksAssignment(standbyTasks),
-                toTasksAssignment(warmupTasks)
+                toTasksAssignment(warmupTasks),
+                isGroupReady
             );
-        } else {
-            if (responseData.activeTasks() != null ||
-                responseData.standbyTasks() != null ||
-                responseData.warmupTasks() != null) {
+        } else if (responseData.activeTasks() != null ||
+            responseData.standbyTasks() != null ||
+            responseData.warmupTasks() != null) {
+
+            throw new IllegalStateException("Invalid response data, task 
collections must be all null or all non-null: "
+                + responseData);
+        } else if (isGroupReady != targetAssignment.isGroupReady) {
+            // If the client did not provide a new assignment, but the group 
is now ready, update the target
+            // assignment and reconcile it.
+            processAssignmentReceived(
+                targetAssignment.activeTasks,
+                targetAssignment.standbyTasks,
+                targetAssignment.warmupTasks,
+                isGroupReady
+            );
+        }
+    }
 
-                throw new IllegalStateException("Invalid response data, task 
collections must be all null or all non-null: "
-                    + responseData);
+    private boolean 
isGroupReady(List<StreamsGroupHeartbeatResponseData.Status> statuses) {
+        if (statuses != null) {
+            for (final StreamsGroupHeartbeatResponseData.Status status : 
statuses) {
+                switch 
(StreamsGroupHeartbeatResponse.Status.fromCode(status.statusCode())) {
+                    case MISSING_SOURCE_TOPICS:
+                    case MISSING_INTERNAL_TOPICS:
+                    case INCORRECTLY_PARTITIONED_TOPICS:
+                    case ASSIGNMENT_DELAYED:

Review Comment:
   Yes, MISSING_SOURCE_TOPC and INCORRECTLY_PARTITION_TOPICS are treated 
fatally in StreamThread. For `MISSING_SOURCE_TOPIC` we give some time for the 
source topic to appear. `MISSING_INTERNAL_TOPIC` is a transient error indeed. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to