[
https://issues.apache.org/jira/browse/HDFS-17914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081060#comment-18081060
]
ASF GitHub Bot commented on HDFS-17914:
---------------------------------------
Hexiaoqiao commented on code in PR #8463:
URL: https://github.com/apache/hadoop/pull/8463#discussion_r3245949619
##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java:
##########
@@ -1230,7 +1230,9 @@ void actualGetFromOneDataNode(final DNAddrPair datanode,
final long startInBlk,
long beginReadMS = Time.monotonicNow();
int nread = 0;
int ret;
- while (true) {
+ // Stop once the slice is filled; an extra read with remaining()==0
+ // can trigger wasted slow-lane I/O in SCR.
+ while (tmp.hasRemaining()) {
Review Comment:
Great catch. Make sense to me.
Just wonder how you hit this corner case, and why `tmp.hasRemaining==0` here?
> Prevent DFSInputStream from issuing 0-byte reads
> ------------------------------------------------
>
> Key: HDFS-17914
> URL: https://issues.apache.org/jira/browse/HDFS-17914
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs-client
> Reporter: Rui Li
> Priority: Major
> Labels: pull-request-available
>
> Currently, {{DFSInputStream#actualGetFromOneDataNode}} can issue an extra
> {{BlockReader#read}} after the buffer is completely filled. This extra read
> can cause a wasted slow-lane read into the bounce buffer for
> {{{}BlockReaderLocal{}}}.
> A possible fix is to terminate the loop once the requested slice is filled.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]