Code review comment: I have tested a case by using ORC format file, it can read enough bytes when `readBufferSize` is larger than 128kb. And in ORC mode, the limitation of 128k is controlled by logic as follows: <pre> file: be/src/exec/orc_scanner.cpp  /**  * Get the natural size for reads.  * @return the number of bytes that should be read at once  */ uint64_t getNaturalReadSize() const override {     return 128 * 1024; } </pre>  See https://github.com/apache/orc/blob/main/c++/src/OrcFile.cc to get more details.  Part of log as follows when modify logic to exceeds 128k <pre> 2021-08-03 09:33:38  [ pool-2-thread-2:25353 ] - [ INFO ]  read buffer from input stream, request.length 99, readBufferSize:1048576, buffer size:99, read length:99 2021-08-03 09:33:38  [ pool-2-thread-2:25364 ] - [ INFO ]  read buffer from input stream, request.length 67876, readBufferSize:1048576, buffer size:67876, read length:67876 2021-08-03 09:33:38  [ pool-2-thread-2:25389 ] - [ INFO ]  read buffer from input stream, request.length 22518, readBufferSize:1048576, buffer size:22518, read length:22518 2021-08-03 09:33:38  [ pool-2-thread-2:25417 ] - [ INFO ]  read buffer from input stream, request.length 279756, readBufferSize:1048576, buffer size:279756, read length:279756 2021-08-03 09:33:38  [ pool-2-thread-2:25434 ] - [ INFO ]  read buffer from input stream, request.length 186, readBufferSize:1048576, buffer size:186, read length:186 </pre>

Code under review:
public ByteBuffer pread(TBrokerFD fd, long offset, long length) {
        FSDataInputStream fsDataInputStream = clientContextManager.getFsDataInputStream(fd);
        synchronized (fsDataInputStream) {
            long currentStreamOffset;
            try {
                currentStreamOffset = fsDataInputStream.getPos();
            } catch (IOException e) {
                logger.error("errors while get file pos from output stream", e);
                throw new BrokerException(TBrokerOperationStatusCode.TARGET_STORAGE_SERVICE_ERROR,
                        "errors while get file pos from output stream");
            }
            if (currentStreamOffset != offset) {
                
                logger.debug("invalid offset, current read offset is "
                        + currentStreamOffset + " is not equal to request offset "
                        + offset + " seek to it");
                try {
                    fsDataInputStream.seek(offset);
                } catch (IOException e) {
                    throw new BrokerException(TBrokerOperationStatusCode.INVALID_INPUT_OFFSET,
                            e, "current read offset {} is not equal to {}, and could not seek to it",
                            currentStreamOffset, offset);
                }
            }
            
            
            
            byte[] buf;
            if (length > readBufferSize) {
                buf = new byte[readBufferSize];
            } else {
                buf = new byte[(int) length];
            }
            try {
                int readLength = readBytesFully(fsDataInputStream, buf);
                if (readLength < 0) {
                    throw new BrokerException(TBrokerOperationStatusCode.END_OF_FILE,
                            "end of file reached");
                }
                if (logger.isDebugEnabled()) {
                    logger.debug("read buffer from input stream, buffer size:" + buf.length + ", read length:" + readLength);
                }
                return ByteBuffer.wrap(buf, 0, readLength);
            } catch (IOException e) {
                logger.error("errors while read data from stream", e);
                throw new BrokerException(TBrokerOperationStatusCode.TARGET_STORAGE_SERVICE_ERROR,
                        e, "errors while write data to output stream");
            }
        }
    }

Line commented on: buf = new byte[readBufferSize];

Revised code:
public ByteBuffer pread(TBrokerFD fd, long offset, long length) {
        FSDataInputStream fsDataInputStream = clientContextManager.getFsDataInputStream(fd);
        synchronized (fsDataInputStream) {
            long currentStreamOffset;
            try {
                currentStreamOffset = fsDataInputStream.getPos();
            } catch (IOException e) {
                logger.error("errors while get file pos from output stream", e);
                throw new BrokerException(TBrokerOperationStatusCode.TARGET_STORAGE_SERVICE_ERROR,
                        "errors while get file pos from output stream");
            }
            if (currentStreamOffset != offset) {
                
                logger.debug("invalid offset, current read offset is "
                        + currentStreamOffset + " is not equal to request offset "
                        + offset + " seek to it");
                try {
                    fsDataInputStream.seek(offset);
                } catch (IOException e) {
                    throw new BrokerException(TBrokerOperationStatusCode.INVALID_INPUT_OFFSET,
                            e, "current read offset {} is not equal to {}, and could not seek to it",
                            currentStreamOffset, offset);
                }
            }
            
            
            
            byte[] buf;
            if (length > readBufferSize) {
                buf = new byte[readBufferSize];
            } else {
                buf = new byte[(int) length];
            }
            try {
                int readLength = readBytesFully(fsDataInputStream, buf);
                if (readLength < 0) {
                    throw new BrokerException(TBrokerOperationStatusCode.END_OF_FILE,
                            "end of file reached");
                }
                if (logger.isDebugEnabled()) {
                    logger.debug("read buffer from input stream, buffer size:" + buf.length + ", read length:" + readLength);
                }
                return ByteBuffer.wrap(buf, 0, readLength);
            } catch (IOException e) {
                logger.error("errors while read data from stream", e);
                throw new BrokerException(TBrokerOperationStatusCode.TARGET_STORAGE_SERVICE_ERROR,
                        e, "errors while write data to output stream");
            }
        }
    }