jolshan commented on code in PR #14067:
URL: https://github.com/apache/kafka/pull/14067#discussion_r1275328506


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/OffsetAndMetadata.java:
##########
@@ -114,12 +116,29 @@ public static OffsetAndMetadata fromRecord(
     ) {
         return new OffsetAndMetadata(
             record.offset(),
-            record.leaderEpoch() == RecordBatch.NO_PARTITION_LEADER_EPOCH ?
-                OptionalInt.empty() : OptionalInt.of(record.leaderEpoch()),
+            ofSentinel(record.leaderEpoch()),
             record.metadata(),
             record.commitTimestamp(),
-            record.expireTimestamp() == OffsetCommitRequest.DEFAULT_TIMESTAMP ?
-                OptionalLong.empty() : 
OptionalLong.of(record.expireTimestamp())
+            ofSentinel(record.expireTimestamp())
+        );
+    }
+
+    /**
+     * @return An OffsetAndMetadata created from an 
OffsetCommitRequestPartition request.
+     */
+    public static OffsetAndMetadata fromRequest(
+        OffsetCommitRequestData.OffsetCommitRequestPartition partition,
+        long currentTimeMs,
+        OptionalLong expireTimestampMs
+    ) {
+        return new OffsetAndMetadata(
+            partition.committedOffset(),
+            ofSentinel(partition.committedLeaderEpoch()),
+            partition.committedMetadata() == null ?
+                OffsetAndMetadata.NO_METADATA : partition.committedMetadata(),
+            partition.commitTimestamp() == 
OffsetCommitRequest.DEFAULT_TIMESTAMP ?

Review Comment:
   I think I was reading the diff wrong again -- I see it correctly now. 



-- 
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