bbejeck commented on code in PR #17919:
URL: https://github.com/apache/kafka/pull/17919#discussion_r1857225839


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/PartitionGroup.java:
##########
@@ -250,10 +250,11 @@ StampedRecord nextRecord(final RecordInfo info, final 
long wallClockTime) {
 
         if (queue != null) {
             // get the first record from this queue.
+            final int oldSize = queue.size();
             record = queue.poll(wallClockTime);
 
             if (record != null) {
-                --totalBuffered;
+                totalBuffered -= oldSize - queue.size();

Review Comment:
   I'm a little confused - since we only subtract if `poll` returns a valid 
record, doesn't this always result in subtracting one from `totalBuffered`?
   
   I think I get it now, under the covers `poll` may skip records due to 
deserialization errors so we need to account for this in the `totalBuffered` 
variable. 



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to