diff --git a/hdfs/CHANGES.txt b/hdfs/CHANGES.txt index 7dba58c0635..ff0ba15b050 100644 --- a/hdfs/CHANGES.txt +++ b/hdfs/CHANGES.txt @@ -951,6 +951,9 @@ Trunk (unreleased changes) HDFS-2196. Make ant build system work with hadoop-common JAR generated by Maven. (Alejandro Abdelnur via tomwhite) + HDFS-2245. Fix a NullPointerException in BlockManager.chooseTarget(..). + (szetszwo) + BREAKDOWN OF HDFS-1073 SUBTASKS HDFS-1521. Persist transaction ID on disk between NN restarts. diff --git a/hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index e552ccdeab1..f60530b4cc4 100644 --- a/hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hdfs/src/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -1221,12 +1221,13 @@ public class BlockManager { final DatanodeDescriptor targets[] = blockplacement.chooseTarget( src, numOfReplicas, client, excludedNodes, blocksize); if (targets.length < minReplication) { - throw new IOException("File " + src + " could only be replicated to " + - targets.length + " nodes, instead of " + - minReplication + ". There are " - + getDatanodeManager().getNetworkTopology().getNumOfLeaves() - + " datanode(s) running but "+excludedNodes.size() + - " node(s) are excluded in this operation."); + throw new IOException("File " + src + " could only be replicated to " + + targets.length + " nodes instead of minReplication (=" + + minReplication + "). There are " + + getDatanodeManager().getNetworkTopology().getNumOfLeaves() + + " datanode(s) running and " + + (excludedNodes == null? "no": excludedNodes.size()) + + " node(s) are excluded in this operation."); } return targets; } diff --git a/hdfs/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java b/hdfs/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java index 6a2792198f4..d2dfd7fc65e 100644 --- a/hdfs/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java +++ b/hdfs/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java @@ -404,6 +404,36 @@ public class TestFileCreation extends junit.framework.TestCase { } } + /** test addBlock(..) when replication