Shekharrajak commented on PR #23468:
URL: https://github.com/apache/kafka/pull/23468#issuecomment-5700590242

   Thanks for checking @apoorvmittal10 . 
   Not claiming a throughput improvement. The concrete benefit is that the old 
path calls `nextFetchOffset()` inside `canAcquireRecords()` and again after 
eligibility succeeds. 
   
   When an AVAILABLE record is found, findNextFetchOffset remains true, so both 
calls scan cachedState and acquire the write lock; only the “no AVAILABLE 
record” case clears the flag and makes the second call cheap for CPU 
usage/cost. 
   
   ```
   canAcquireRecords() ->  cachedState scan 1
       nextFetchOffset()  -> cachedState scan 2
   ```
   
   With `nextFetchOffsetIfAcquirable` only 1 cacheState entry scan. The tests 
validate the single-call behavior.


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