sodonnel commented on code in PR #10415:
URL: https://github.com/apache/ozone/pull/10415#discussion_r3358644506
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/StreamBlockInputStream.java:
##########
@@ -208,8 +214,11 @@ public synchronized void seek(long pos) throws IOException
{
if (pos == position) {
return;
}
- LOG.debug("{}: seek {} -> {}", this, position, pos);
- closeStream();
+ LOG.debug("{}: seek {} -> {}", getName(streamingReader), position, pos);
+ if (streamingReader != null && readBuffer != null) {
+ streamingReader.offerToQueue(readBuffer.getProto());
Review Comment:
OK, I think I understand better now.
In this code we check if the seek is < 0, or > blocklength or == pos.
Otherwise we offer the current buffer back to the queue.
Should we also check if the position is within the bounds of the current
buffer?
Eg we are at position 1 so we have a 1MB buffer, 32MB of pre-read on the
queue.
We seek to position 100. This, I think, would trigger putting the current
buffer onto THE BACK of the queue.
Then we would read and discard all the 32MB pre-read, before hitting the
buffer we already had?
I think we can check if `pos > position && pos <= position +
buffer.remaining()` and if so, just set buffer.position accordingly?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]