apoorvmittal10 commented on code in PR #18096:
URL: https://github.com/apache/kafka/pull/18096#discussion_r1880214517


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -2125,16 +2128,23 @@ private long startOffsetDuringInitialization(long 
partitionDataStartOffset) thro
         if (partitionDataStartOffset != 
PartitionFactory.UNINITIALIZED_START_OFFSET) {
             return partitionDataStartOffset;
         }
-        GroupConfig.ShareGroupAutoOffsetReset offsetResetStrategy;
+        ShareGroupAutoOffsetResetStrategy offsetResetStrategy;
         if (groupConfigManager.groupConfig(groupId).isPresent()) {
             offsetResetStrategy = 
groupConfigManager.groupConfig(groupId).get().shareAutoOffsetReset();
         } else {
             offsetResetStrategy = GroupConfig.defaultShareAutoOffsetReset();
         }
 
-        if (offsetResetStrategy == 
GroupConfig.ShareGroupAutoOffsetReset.EARLIEST)
+        final long timestamp = offsetResetStrategy.timestamp()
+            .orElseThrow(() -> new 
NoOffsetForPartitionException(topicIdPartition.topicPartition()));

Review Comment:
   This is only needed for BY_DURATION i.e. only in `else` block below. So 
should we move the code there?



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

Reply via email to