cndaimin commented on code in PR #4104:
URL: https://github.com/apache/hadoop/pull/4104#discussion_r857234796


##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedInputStream.java:
##########
@@ -250,9 +255,16 @@ boolean createBlockReader(LocatedBlock block, long 
offsetInBlock,
         if (dnInfo == null) {
           break;
         }
+        if (readTo < 0 || readTo > block.getBlockSize()) {
+          readTo = block.getBlockSize();
+        }
         reader = getBlockReader(block, offsetInBlock,
-            block.getBlockSize() - offsetInBlock,
+            readTo - offsetInBlock,
             dnInfo.addr, dnInfo.storageType, dnInfo.info);
+        if (blockReaderListener != null) {

Review Comment:
   > It is for test here, right? Can we use fault injector here? Refer to 
DFSClientFaultInjector
   
   Yes, `DFSClientFaultInjector` is better here. Thanks, updated.



-- 
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]

Reply via email to