dajac commented on code in PR #14408:
URL: https://github.com/apache/kafka/pull/14408#discussion_r1332069169


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ConsumerGroup.java:
##########
@@ -592,6 +607,45 @@ public void validateOffsetFetch(
         validateMemberEpoch(memberEpoch, member.memberEpoch());
     }
 
+    /**
+     * Validates the OffsetDelete request.
+     */
+    @Override
+    public void validateOffsetDelete() throws GroupIdNotFoundException {
+        if (state() == ConsumerGroupState.DEAD) {
+            throw new GroupIdNotFoundException(String.format("Group %s is in 
dead state.", groupId));
+        }
+    }
+
+    /**
+     * Validates the GroupDelete request.
+     */
+    @Override
+    public void validateGroupDelete() throws ApiException {
+        if (state() == ConsumerGroupState.DEAD) {
+            throw new GroupIdNotFoundException(String.format("Group %s is in 
dead state.", groupId));
+        } else if (state() == ConsumerGroupState.STABLE
+            || state() == ConsumerGroupState.ASSIGNING
+            || state() == ConsumerGroupState.RECONCILING) {
+            throw Errors.NON_EMPTY_GROUP.exception();
+        }
+
+        // We avoid writing the tombstone when the generationId is 0, since 
this group is only using
+        // Kafka for offset storage.
+        if (groupEpoch() <= 0) {
+            throw Errors.UNKNOWN_SERVER_ERROR.exception();
+        }
+    }
+
+    /**
+     * Creates a GroupMetadata tombstone.
+     *
+     * @return The record.
+     */
+    public Record createMetadataTombstoneRecord() {
+        return 
RecordHelpers.newConsumerGroupMetadataTombstoneRecord(groupId());

Review Comment:
   I think that we need to generate the above records here.
   * newTargetAssignmentEpochTombstoneRecord
   * newGroupSubscriptionMetadataTombstoneRecord
   * newGroupEpochTombstoneRecord



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to