chia7712 commented on code in PR #20837:
URL: https://github.com/apache/kafka/pull/20837#discussion_r2649176366


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1885,7 +1914,29 @@ private int acquireSubsetBatchRecords(
                     continue;
                 }
 
-                InFlightState updateResult =  
offsetState.getValue().tryUpdateState(RecordState.ACQUIRED, 
DeliveryCountOps.INCREASE,
+                int recordDeliveryCount = 
offsetState.getValue().deliveryCount();
+                // If the record is on last delivery attempt then isolate that 
record to be delivered alone.
+                // If the respective record is corrupt then it prevents 
increasing delivery count of multiple
+                // records in a single response batch. Condition below checks 
if the current record has reached
+                // the delivery limit and already have some records to return 
in response then skip processing
+                // the current record, which shall be delivered alone in next 
fetch.
+                if (maxDeliveryCount > 2 && recordDeliveryCount == 
maxDeliveryCount - 1 && acquiredCount > 0) {
+                    break;

Review Comment:
   > Adding a WARN log will make it clear to users that this is an intentional 
behavior, which will help prevent any potential alarm.
   
   agreed. Would you mind handling it with a minor patch?
   
   >  I think it's a good idea to introduce a configuration flag to enable or 
disable this back-off mechanism.
   
   It might be better to add a configuration to adjust the throttling factor. 
If it is set to a negative value, we disable the throttle. WDYT?



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