apoorvmittal10 commented on code in PR #20246:
URL: https://github.com/apache/kafka/pull/20246#discussion_r2461890674
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1596,9 +1628,45 @@ private ShareAcquiredRecords acquireNewBatchRecords(
}
}
+ private AcquiredRecords filterShareAcquiredRecordsInRecordLimitMode(int
maxFetchRecords, List<AcquiredRecords> acquiredRecords) {
+ // Only acquire one single batch in record limit mode.
+ AcquiredRecords records = acquiredRecords.get(0);
+ InFlightBatch inFlightBatch = cachedState.get(records.firstOffset());
+ long lastOffset = records.firstOffset() + maxFetchRecords - 1;
+ if (inFlightBatch != null) {
+ // Initialize the offset state map if not already initialized.
+ inFlightBatch.maybeInitializeOffsetStateUpdate();
+ List<PersisterBatch> persisterBatches = new ArrayList<>();
+ CompletableFuture<Void> future = new CompletableFuture<>();
+ NavigableMap<Long, InFlightState> offsetStateMap =
inFlightBatch.offsetState();
+ for (Map.Entry<Long, InFlightState> offsetState :
offsetStateMap.tailMap(lastOffset, false).entrySet()) {
+ if (offsetState.getValue().state() == RecordState.ACQUIRED) {
Review Comment:
I am sorry but not aligned with the current approach. I have suggested an
alternative.
--
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]