From 9639f37ee21427303e877e8aeb486e0d71982e0f Mon Sep 17 00:00:00 2001 From: Harsh J Date: Sun, 27 Jan 2013 17:42:25 +0000 Subject: [PATCH] HDFS-4259. Improve pipeline DN replacement failure message. Contributed by Harsh J. (harsh) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1439126 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../apache/hadoop/hdfs/DFSOutputStream.java | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index b9d908ab0e6..ee6b4040d49 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -497,6 +497,8 @@ Release 2.0.3-alpha - Unreleased HDFS-4403. DFSClient can infer checksum type when not provided by reading first byte (todd) + HDFS-4259. Improve pipeline DN replacement failure message (harsh) + OPTIMIZATIONS HDFS-3429. DataNode reads checksums even if client does not need them (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java index 7245f8ac909..3232b1234a6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java @@ -785,13 +785,18 @@ public class DFSOutputStream extends FSOutputSummer implements Syncable { private int findNewDatanode(final DatanodeInfo[] original ) throws IOException { if (nodes.length != original.length + 1) { - throw new IOException("Failed to add a datanode. " - + "User may turn off this feature by setting " - + DFSConfigKeys.DFS_CLIENT_WRITE_REPLACE_DATANODE_ON_FAILURE_POLICY_KEY - + " in configuration, where the current policy is " - + dfsClient.dtpReplaceDatanodeOnFailure - + ". (Nodes: current=" + Arrays.asList(nodes) - + ", original=" + Arrays.asList(original) + ")"); + throw new IOException( + new StringBuilder() + .append("Failed to replace a bad datanode on the existing pipeline ") + .append("due to no more good datanodes being available to try. ") + .append("(Nodes: current=").append(Arrays.asList(nodes)) + .append(", original=").append(Arrays.asList(original)).append("). ") + .append("The current failed datanode replacement policy is ") + .append(dfsClient.dtpReplaceDatanodeOnFailure).append(", and ") + .append("a client may configure this via '") + .append(DFSConfigKeys.DFS_CLIENT_WRITE_REPLACE_DATANODE_ON_FAILURE_POLICY_KEY) + .append("' in its configuration.") + .toString()); } for(int i = 0; i < nodes.length; i++) { int j = 0;