junrao commented on code in PR #17739:
URL: https://github.com/apache/kafka/pull/17739#discussion_r1842488735
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1602,8 +1602,6 @@ protected void
updateFetchOffsetMetadata(Optional<LogOffsetMetadata> fetchOffset
protected Optional<LogOffsetMetadata> fetchOffsetMetadata() {
lock.readLock().lock();
try {
- if (findNextFetchOffset.get())
Review Comment:
@apoorvmittal10: Overall, your approach could work.
1. It seems that fetchOffsetMetadata() needs to take in nextFetchOffset too.
This way, if the offset matches, we can avoid the readFromLog call.
2. We want to be a bit careful with the offset matching. In the common case,
the nextFetchOffset is always aligned on batch boundary so it will match
fetchOffsetMetadata.messageOffset. However, a user could initialize an
arbitrary offset in the middle of a batch. In this case, nextFetchOffset won't
match fetchOffsetMetadata.messageOffset since the latter is at the batch
boundary. So, we need to understand the impact of that.
--
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]