morningman commented on a change in pull request #3881:
URL: https://github.com/apache/incubator-doris/pull/3881#discussion_r440943167
##########
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.debug("read buffer from input stream, buffer size:" +
buf.capacity() + ", read length:" + readLength);
Review comment:
if (logger.isDebugEnable()) {
logger.debug("read buffer from input stream, buffer size: {}, read
length: {}", buf.capacity(), readLength);
}
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]