adixitconfluent commented on code in PR #20837:
URL: https://github.com/apache/kafka/pull/20837#discussion_r2508994497
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -834,7 +840,8 @@ public ShareAcquiredRecords acquire(
boolean fullMatch = checkForFullMatch(inFlightBatch,
firstBatch.baseOffset(), lastOffsetToAcquire);
int numRecordsRemaining = maxRecordsToAcquire - acquiredCount;
boolean recordLimitSubsetMatch = isRecordLimitMode &&
checkForRecordLimitSubsetMatch(inFlightBatch, maxRecordsToAcquire,
acquiredCount);
- if (!fullMatch || inFlightBatch.offsetState() != null ||
recordLimitSubsetMatch) {
+ boolean deliveryCountExceed =
checkForDeliveryCount(inFlightBatch);
Review Comment:
maybe rename `checkForDeliveryCount` to `checkForBadRecordsDeliveryCount`
##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -858,7 +865,14 @@ public ShareAcquiredRecords acquire(
// In record_limit mode, we need to ensure that we do not
acquire more than
// maxRecordsToAcquire. Hence, pass the remaining number
of records that can
// be acquired.
- int acquiredSubsetCount =
acquireSubsetBatchRecords(memberId, isRecordLimitMode, numRecordsRemaining,
firstBatch.baseOffset(), lastOffsetToAcquire, inFlightBatch, result);
+ int acquiredSubsetCount =
acquireSubsetBatchRecords(memberId, isRecordLimitMode, numRecordsRemaining,
firstBatch.baseOffset(), lastOffsetToAcquire, acquiredCount, inFlightBatch,
result);
+ // If a bad record is present, return immediately and set
`maxRecordsToAcquire = -1`
+ // to prevent acquiring any new records afterwards.
+ if (acquiredSubsetCount < 0) {
+ maxRecordsToAcquire = -1;
+ acquiredCount += acquiredSubsetCount ==
Integer.MIN_VALUE ? 0 : -1 * acquiredSubsetCount;
Review Comment:
This is a little confusing to me. Maybe take an example and explain what are
we trying to achieve here
--
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]