junrao commented on code in PR #17539:
URL: https://github.com/apache/kafka/pull/17539#discussion_r1818144589
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1525,6 +1537,24 @@ private Optional<Throwable> acknowledgeCompleteBatch(
return Optional.empty();
}
+ protected void updateLatestFetchOffsetMetadata(LogOffsetMetadata
fetchOffsetMetadata) {
+ lock.writeLock().lock();
+ try {
+ latestFetchOffsetMetadata = fetchOffsetMetadata;
Review Comment:
While this alternative approach is more efficient, it's probably also more
complicated. So, it's also ok to just take the current approach to start with.
In the current approach, (1) if any call moves `endOffset`, we reset the
`latestFetchOffsetMetadata` to Optional.empty(). In `tryComplete`, if
`latestFetchOffsetMetadata` is empty, we call `readFromLog` and update
`latestFetchOffsetMetadata`.
--
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]