squah-confluent commented on code in PR #24108:
URL: https://github.com/apache/kafka/pull/24108#discussion_r4519266174
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -8789,27 +8789,39 @@ private CoordinatorResult<HeartbeatResponseData,
CoordinatorRecord> classicGroup
String groupId = request.groupId();
String memberId = request.memberId();
String instanceId = request.groupInstanceId();
+ List<CoordinatorRecord> records = new ArrayList<>();
ConsumerGroupMember member = validateConsumerGroupMember(group,
memberId, instanceId);
throwIfMemberDoesNotUseClassicProtocol(member);
throwIfGenerationIdUnmatched(memberId, member.memberEpoch(),
request.generationId());
scheduleConsumerGroupSessionTimeout(groupId, memberId,
member.classicProtocolSessionTimeout().get());
+ // Update the target assignment if the group epoch is larger than the
target assignment epoch.
+ // The delta between the existing and the new target assignment is
persisted to the partition.
+ UpdateTargetAssignmentResult<Assignment> updateTargetAssignmentResult
= maybeUpdateTargetAssignment(
+ group,
+ group.groupEpoch(),
+ member,
+ member,
+ group.subscriptionType(),
+ records
+ );
+
Errors error = Errors.NONE;
// The member should rejoin if any of the following conditions is met.
// 1) The target assignment epoch is bumped so the member needs to
rejoin to catch up.
// 2) The member needs to revoke some partitions and rejoin to
reconcile with the new epoch.
// 3) The member's partitions pending assignment are free, so it can
rejoin to get the complete assignment.
- if (member.memberEpoch() < group.assignmentEpoch() ||
+ if (member.memberEpoch() <
updateTargetAssignmentResult.targetAssignmentEpoch() ||
Review Comment:
Updated it
```diff
- * Handle a classic group HeartbeatRequest to a consumer group. A
response with
- * REBALANCE_IN_PROGRESS is returned if 1) the member epoch is smaller
than the
- * group epoch, 2) the member is in UNREVOKED_PARTITIONS, or 3) the
member is in
- * UNRELEASED_PARTITIONS and all its partitions pending assignment are
free.
+ * Handle a classic group HeartbeatRequest to a consumer group. The
target
+ * assignment is updated first if the target assignment lags behind the
group
+ * epoch. A response with REBALANCE_IN_PROGRESS is returned if 1) the
member
+ * epoch is smaller than the target assignment epoch, 2) the member is
in
+ * UNREVOKED_PARTITIONS, or 3) the member is in UNRELEASED_PARTITIONS
and all
+ * its partitions pending assignment are free.
```
--
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]