You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/06/16 03:12:27 UTC
[GitHub] [incubator-doris] yiguolei commented on a change in pull request #3881: [BUG]Fix broker read buffer size from input stream
yiguolei commented on a change in pull request #3881:
URL: https://github.com/apache/incubator-doris/pull/3881#discussion_r440560907
##########
File path: fs_brokers/apache_hdfs_broker/src/main/java/org/apache/doris/broker/hdfs/FileSystemManager.java
##########
@@ -550,19 +550,20 @@ public ByteBuffer pread(TBrokerFD fd, long offset, long length) {
currentStreamOffset, offset);
}
}
- byte[] buf;
+ ByteBuffer buf;
if (length > readBufferSize) {
- buf = new byte[readBufferSize];
+ buf = ByteBuffer.allocate(readBufferSize);
} else {
- buf = new byte[(int) length];
+ buf = ByteBuffer.allocate((int) length);
}
try {
- int readLength = fsDataInputStream.read(buf);
+ int readLength = readByteBufferFully(fsDataInputStream, buf);
if (readLength < 0) {
throw new BrokerException(TBrokerOperationStatusCode.END_OF_FILE,
"end of file reached");
}
- return ByteBuffer.wrap(buf, 0, readLength);
+ logger.info("read length:" + length + ", readBufferSize:" + readBufferSize + ", return length:" + readLength);
Review comment:
Maybe too many logs here.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org