smjn commented on code in PR #19026:
URL: https://github.com/apache/kafka/pull/19026#discussion_r1993628590
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorRecordHelpers.java:
##########
@@ -812,6 +814,44 @@ public static CoordinatorRecord
newShareGroupCurrentAssignmentTombstoneRecord(
);
}
+ /**
+ * Creates a ShareGroupStatePartitionMetadata record.
+ *
+ * @param groupId The share group id.
+ * @param initializedTopics Topics which have been initialized.
+ * @param deletingTopics Topics which are being deleted.
+ * @return The record.
+ */
+ public static CoordinatorRecord newShareGroupStatePartitionMetadataRecord(
+ String groupId,
+ Map<Uuid, Map.Entry<String, Set<Integer>>> initializedTopics,
+ Map<Uuid, String> deletingTopics
+ ) {
+ List<ShareGroupStatePartitionMetadataValue.TopicPartitionsInfo>
initializedTopicPartitionInfo = initializedTopics.entrySet().stream()
+ .map(entry -> new
ShareGroupStatePartitionMetadataValue.TopicPartitionsInfo()
+ .setTopicId(entry.getKey())
+ .setTopicName(entry.getValue().getKey())
+ .setPartitions(entry.getValue().getValue().stream().toList()))
+ .toList();
+
+ List<ShareGroupStatePartitionMetadataValue.TopicInfo>
deletingTopicsInfo = deletingTopics.entrySet().stream()
+ .map(entry -> new ShareGroupStatePartitionMetadataValue.TopicInfo()
+ .setTopicId(entry.getKey())
+ .setTopicName(entry.getValue()))
+ .toList();
+
+ return CoordinatorRecord.record(
+ new ShareGroupStatePartitionMetadataKey()
+ .setGroupId(groupId),
+ new ApiMessageAndVersion(
+ new ShareGroupStatePartitionMetadataValue()
+ .setInitializedTopics(initializedTopicPartitionInfo)
+ .setDeletingTopics(deletingTopicsInfo),
+ (short) 0
+ )
+ );
+ }
+
Review Comment:
Tombstone would be part of delete group/offsets work.
--
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]