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


##########
core/src/main/java/kafka/server/share/DelayedShareFetch.java:
##########
@@ -591,19 +567,29 @@ private void 
maybeUpdateFetchOffsetMetadata(LinkedHashMap<TopicIdPartition, Long
                                                 
LinkedHashMap<TopicIdPartition, LogReadResult> readResponseData) {
         for (Map.Entry<TopicIdPartition, LogReadResult> entry : 
readResponseData.entrySet()) {
             TopicIdPartition topicIdPartition = entry.getKey();
-            SharePartition sharePartition = 
sharePartitions.get(topicIdPartition);
             LogReadResult logReadResult = entry.getValue();
             if (logReadResult.error().code() != Errors.NONE.code()) {
                 log.debug("Log read result {} errored out for topic partition 
{}",
                     logReadResult, topicIdPartition);
                 continue;
             }
-            sharePartition.updateFetchOffsetMetadata(
-                topicPartitionData.get(topicIdPartition),
+            updateFetchOffsetMetadataCache(topicIdPartition, 
topicPartitionData.get(topicIdPartition),
                 logReadResult.info().fetchOffsetMetadata);
         }
     }
 
+    private Optional<LogOffsetMetadata> fetchOffsetMetadata(TopicIdPartition 
topicIdPartition, long fetchOffset) {
+        CachedFetchOffsetMetadata cached = 
fetchOffsetMetadataCache.get(topicIdPartition);
+        if (cached == null || cached.offset() != fetchOffset || 
cached.offsetMetadata() == null)

Review Comment:
   I do not find any non-null check in the FetchDataInfo hence kept it.



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