Pārlūkot izejas kodu

HDFS-6047 TestPread NPE inside in DFSInputStream hedgedFetchBlockByteRange (stack)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1574206 13f79535-47bb-0310-9956-ffa450edef68
Michael Stack 11 gadi atpakaļ
vecāks
revīzija
9c18ac13c0

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -281,6 +281,9 @@ Release 2.4.0 - UNRELEASED
     HDFS-6053. Fix TestDecommissioningStatus and TestDecommission in branch-2.
     (jing9)
 
+    HDFS-6047 TestPread NPE inside in DFSInputStream hedgedFetchBlockByteRange
+    (stack)
+
   BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
 
     HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)

+ 5 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java

@@ -1177,8 +1177,11 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead,
           // exception already handled in the call method. getFirstToComplete
           // will remove the failing future from the list. nothing more to do.
         }
-        // We got here if exception.  Ignore this node on next go around.
-        ignored.add(chosenNode.info);
+        // We got here if exception.  Ignore this node on next go around IFF
+        // we found a chosenNode to hedge read against.
+        if (chosenNode != null && chosenNode.info != null) {
+          ignored.add(chosenNode.info);
+        }
       }
       // executed if we get an error from a data node
       block = getBlockAt(block.getStartOffset(), false);