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


##########
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:
   Just for my understanding, if we have no timestamp/default in the request we 
use the current time, but in the record we just set the sentinel/empty?



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