Przeglądaj źródła

HADOOP-1068. Improve error message for clusters with 0 datanodes. Contributed by Dhruba Borthakur.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@522192 13f79535-47bb-0310-9956-ffa450edef68
Thomas White 18 lat temu
rodzic
commit
6c48102cdf
2 zmienionych plików z 16 dodań i 4 usunięć
  1. 3 0
      CHANGES.txt
  2. 13 4
      src/java/org/apache/hadoop/dfs/FSNamesystem.java

+ 3 - 0
CHANGES.txt

@@ -31,6 +31,9 @@ Trunk (unreleased changes)
     records to not allocate a new BinaryOutputArchive or
     records to not allocate a new BinaryOutputArchive or
     BinaryInputArchive per call.  (Milind Bhandarkar via cutting)
     BinaryInputArchive per call.  (Milind Bhandarkar via cutting)
 
 
+10. HADOOP-1068.  Improve error message for clusters with 0 datanodes.
+    (Dhruba Borthakur via tomwhite)
+
 
 
 Release 0.12.2 - 2007-23-17
 Release 0.12.2 - 2007-23-17
 
 

+ 13 - 4
src/java/org/apache/hadoop/dfs/FSNamesystem.java

@@ -724,10 +724,19 @@ class FSNamesystem implements FSConstants {
         DatanodeDescriptor targets[] = replicator.chooseTarget(replication,
         DatanodeDescriptor targets[] = replicator.chooseTarget(replication,
             getDatanodeByHost(clientMachine.toString()), null, blockSize);
             getDatanodeByHost(clientMachine.toString()), null, blockSize);
         if (targets.length < this.minReplication) {
         if (targets.length < this.minReplication) {
-            throw new IOException("failed to create file "+src
-                    +" on client " + clientMachine
-                    +" because target-length is " + targets.length 
-                    +", below MIN_REPLICATION (" + minReplication+ ")");
+            if (clusterMap.getNumOfLeaves() == 0) {
+              throw new IOException("Failed to create file "+src
+                    + " on client " + clientMachine
+                    + " because this cluster has no datanodes.");
+            }
+            throw new IOException("Failed to create file "+src
+                    + " on client " + clientMachine
+                    + " because there were not enough datanodes available. "
+                    + "Found " + targets.length
+                    + " datanodes but MIN_REPLICATION for the cluster is "
+                    + "configured to be "
+                    + this.minReplication
+                    + ".");
        }
        }
 
 
         // Reserve space for this pending file
         // Reserve space for this pending file