mjsax commented on code in PR #24003:
URL: https://github.com/apache/kafka/pull/24003#discussion_r4593783257
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/StreamsMembershipManager.java:
##########
@@ -804,21 +804,31 @@ public void
onHeartbeatSuccess(StreamsGroupHeartbeatResponse response) {
}
}
+ /**
+ * Determines whether the group is ready from the statuses of a heartbeat
response.
+ * <p>
+ * {@code ASSIGNMENT_DELAYED} only means that the coordinator deferred
computing a new target assignment, so it
+ * keeps the previous readiness: a member that has not yet been ready
(e.g., during the initial rebalance delay)
+ * stays not ready, while a ready member keeps processing the tasks it
owns.
+ */
private boolean
isGroupReady(List<StreamsGroupHeartbeatResponseData.Status> statuses) {
+ boolean assignmentDelayed = false;
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:
return false;
+ case ASSIGNMENT_DELAYED:
+ assignmentDelayed = true;
+ break;
default:
// continue checking other statuses
}
}
}
- return true;
+ return !assignmentDelayed || targetAssignment.isGroupReady;
Review Comment:
While correct, I find this personally hard to read... What do you think
about changing it to
```
if (assignmentDelayed) {
return targetAssignment.isGroupReady;
} else {
return true;
}
```
Atm it reads like a "double negation" bending my mind...
--
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]