showuon commented on code in PR #15213:
URL: https://github.com/apache/kafka/pull/15213#discussion_r1474112419


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -1279,7 +1281,6 @@ class UnifiedLog(@volatile var logStartOffset: Long,
 
       if (config.messageFormatVersion.isLessThan(IBP_0_10_0_IV0) &&
         targetTimestamp != ListOffsetsRequest.EARLIEST_TIMESTAMP &&
-        targetTimestamp != ListOffsetsRequest.EARLIEST_LOCAL_TIMESTAMP &&

Review Comment:
   Ah, this is a bug fix, right? 



##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -1300,18 +1301,29 @@ class UnifiedLog(@volatile var logStartOffset: Long,
       } else if (targetTimestamp == 
ListOffsetsRequest.EARLIEST_LOCAL_TIMESTAMP) {
         val curLocalLogStartOffset = localLogStartOffset()
 
-        val earliestLocalLogEpochEntry = leaderEpochCache.asJava.flatMap(cache 
=> {
-          val epoch = cache.epochForOffset(curLocalLogStartOffset)
-          if (epoch.isPresent) cache.epochEntry(epoch.getAsInt) else 
Optional.empty[EpochEntry]()
-        })
-
-        val epochOpt = if (earliestLocalLogEpochEntry.isPresent && 
earliestLocalLogEpochEntry.get().startOffset <= curLocalLogStartOffset)
-          Optional.of[Integer](earliestLocalLogEpochEntry.get().epoch)
-        else Optional.empty[Integer]()
+        var epochResult: Optional[Integer] = 
Optional.of(RecordBatch.NO_PARTITION_LEADER_EPOCH)

Review Comment:
   Why do we change the return for "no leaderEpoch" case from empty to -1? I 
had a check, it seems won't change anything because the default value of 
leaderEpoch in `ListOffsetsPartitionResponse` is -1. Any thought on this change?



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