FrankYang0529 opened a new pull request, #19013:
URL: https://github.com/apache/kafka/pull/19013

   The case `TruncationTest.test_offset_truncate` is flaky some time on my 
laptop. I can reproduce the error once every ten attempts. The production code 
is fine, because in both successful and failed cases, I can see log like 
`Truncating partition test_topic-0 with TruncationState(offset=xx, 
completed=true) due to leader epoch and offset EpochEndOffset`. That means 
truncation is really happened.
   
   The tricky part is that in VerifiableConsumer-0 log, I can see consumer 
commit offset at 191. However, when I print `total_records_consumed`, it's only 
83. We got `total_records_consumed` before stopping the consumer, so there is 
time gap that the consumer may keep consuming other data. The fix is to stop 
the consumer before getting `total_records_consumed`. With this fix, I can't 
reproduce the error.
   
   
[failed-TruncationTest-test_offset_truncate.zip](https://github.com/user-attachments/files/18927058/failed-TruncationTest-test_offset_truncate.zip)
   
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


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