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

   When delegated `skip` returns zero, `ChunkedBytesStream.skip` reads through 
its own buffered `read()` method. That can fill the intermediate buffer, after 
which subsequent delegated skips move the source past unread buffered bytes. 
With input bytes 0–9 and a four-byte buffer, a source whose first skip returns 
zero makes `skip(5)` report success while the next read returns 1 instead of 5.
   
   Consume any bytes prefetched by the fallback read before delegating another 
skip. This preserves the existing buffered codec path. The regression tests 
verify the full remaining sequence for skips within the buffer, beyond the 
buffer, and through EOF, plus repeated skips through real LZ4 frames containing 
consecutive empty compressed blocks.
   
   Validation: compiled the actual production classes and the full 
`ChunkedBytesStreamTest` class with `javac --release 11` on JDK 21, then ran 
JUnit Jupiter 5.14.4 and Mockito 5.23.0. The unchanged production code fails 2 
of 56 tests; the fix passes all 56. The three real LZ4 boundary cases also 
pass. File-scoped checks using Kafka's Checkstyle 12.3.1 configuration and 
Spotless 4.10.0 import-order step pass.
   
   The LZ4 checks compile the current decoder and helper sources; a cached 
Kafka clients 3.9.2 jar supplies auxiliary compile-time signatures. They do not 
validate the complete current clients module or record batches. The official 
Gradle tasks, full clients suite, and CI JDKs 17/25 have not been run locally.
   
   This is my original contribution, prepared with AI assistance from OpenAI 
Codex (GPT-6). I have the right to submit it and license it under the project's 
Apache-2.0 license.
   
   Generated-by: OpenAI Codex (GPT-6)
   


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