smjn commented on code in PR #22479:
URL: https://github.com/apache/kafka/pull/22479#discussion_r3367019403


##########
server/src/main/java/org/apache/kafka/server/share/dlq/ShareGroupDLQStateManager.java:
##########
@@ -653,6 +684,69 @@ private void handleProduceResponse(ClientResponse 
response) {
                     requestErrorResponse(clientResponseError.exception());
             }
         }
+
+        private void maybeFetchRecordData() {
+            if (cacheHelper.isShareGroupDlqCopyRecordEnabled(param.groupId())) 
{
+                if (!originalRecordData.isEmpty()) {
+                    return;
+                }
+
+                long startTime = time.hiResClockMs();
+                TopicIdPartition tp = param.topicIdPartition();
+
+                FetchParams fetchParams = new FetchParams(
+                    FetchRequest.CONSUMER_REPLICA_ID,           // -1, reading 
as a consumer
+                    -1,                                         // replicaEpoch
+                    0L,                                         // maxWaitMs - 
don't block
+                    1,                                          // minBytes
+                    maxFetchBytes,                              // maxBytes
+                    FetchIsolation.HIGH_WATERMARK,              // committed 
only
+                    Optional.empty()                            // 
clientMetadata
+                );
+
+                long nextOffset = param.firstOffset();
+                long endOffset = param.lastOffset();
+                int recordCount = (int) (param.lastOffset() - 
param.firstOffset() + 1);
+
+                List<Record> records = new ArrayList<>(recordCount);
+                LinkedHashMap<TopicIdPartition, Long> offsets = new 
LinkedHashMap<>();
+                LinkedHashMap<TopicIdPartition, Integer> maxBytesMap = new 
LinkedHashMap<>();
+                maxBytesMap.put(tp, maxFetchBytes);
+
+                while (nextOffset <= endOffset) {

Review Comment:
   Hi,
   We already have a guard against that - if no data arrives `for (RecordBatch 
batch : res.info().records.batches())` never executes and the check
   ```
   if (!done) break; // no more records available (reached HWM/LEO)
   ```
   will break the while loop.



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