clolov commented on code in PR #15060:
URL: https://github.com/apache/kafka/pull/15060#discussion_r1435781798


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -1289,15 +1289,21 @@ public FetchDataInfo read(RemoteStorageFetchInfo 
remoteStorageFetchInfo) throws
         }
 
         RemoteLogSegmentMetadata remoteLogSegmentMetadata = 
rlsMetadataOptional.get();
-        int startPos = lookupPositionForOffset(remoteLogSegmentMetadata, 
offset);
         InputStream remoteSegInputStream = null;
         try {
-            // Search forward for the position of the last offset that is 
greater than or equal to the target offset
-            remoteSegInputStream = 
remoteLogStorageManager.fetchLogSegment(remoteLogSegmentMetadata, startPos);
-            RemoteLogInputStream remoteLogInputStream = new 
RemoteLogInputStream(remoteSegInputStream);
-
-            RecordBatch firstBatch = findFirstBatch(remoteLogInputStream, 
offset);
-
+            int startPos = 0;
+            RecordBatch firstBatch = null;
+            while (firstBatch == null && rlsMetadataOptional.isPresent()) {

Review Comment:
   Huh, interesting, I shall circle back to this, maybe I am not as familiar 
with compaction as I thought I was. To be honest, I was expecting that the 
segments 0 and 6 will be merged into one by compaction - I was under the 
impression that it doesn't leave empty segments.



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