divijvaidya commented on code in PR #12948:
URL: https://github.com/apache/kafka/pull/12948#discussion_r1237418125
##########
clients/src/main/java/org/apache/kafka/common/utils/ChunkedBytesStream.java:
##########
@@ -291,7 +291,7 @@ public long skip(long toSkip) throws IOException {
// Skip bytes stored in intermediate buffer first
int avail = count - pos;
long bytesSkipped = (avail < remaining) ? avail : remaining;
- pos += bytesSkipped;
+ pos += (int) bytesSkipped;
Review Comment:
I am afraid that won't be possible.
This is because there are two branches where `bytesSkipped` is updated. In
one branch when we call `bytesSkipped = getInIfOpen().skip(remaining)`,
`bytesSkipped` holds a long value since `getInIfOpen().skip(remaining)` returns
a long. In the other branch, when we call `bytesSkipped = (avail < remaining) ?
avail : remaining`, `bytesSkipped` holds an int since this min statement bounds
it to max of avail, which is an int.
I can attempt to do a bunch of refactoring if that will make things clearer
but that shouldn't block this PR.
--
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]