JimmyWang6 commented on code in PR #20973:
URL: https://github.com/apache/kafka/pull/20973#discussion_r2565344162


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1827,13 +1827,13 @@ private List<AcquiredRecords> createBatches(
                         sharePartitionMetrics);
                     int delayMs = 
recordLockDurationMsOrDefault(groupConfigManager, groupId, 
defaultRecordLockDurationMs);
                     long lastOffset = acquiredRecords.firstOffset() + 
maxFetchRecords - 1;
-                    acquiredRecords.setLastOffset(lastOffset);
                     inFlightBatch.maybeInitializeOffsetStateUpdate(lastOffset, 
delayMs);
                     updateFindNextFetchOffset(true);
 
                     cachedState.put(acquiredRecords.firstOffset(), 
inFlightBatch);
                     sharePartitionMetrics.recordInFlightBatchMessageCount(
                         acquiredRecords.lastOffset() - 
acquiredRecords.firstOffset() + 1);
+                    acquiredRecords.setLastOffset(lastOffset);
                     return List.of(acquiredRecords);

Review Comment:
   You're right — I did overlook the metrics-related test cases in record limit 
mode. I will add them. Thank you for pointing this out :)



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