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
This commit is contained in:
Harsh J 2013-01-27 17:42:25 +00:00
parent 86f6dfb338
commit 9639f37ee2
2 changed files with 14 additions and 7 deletions

View File

@ -497,6 +497,8 @@ Release 2.0.3-alpha - Unreleased
HDFS-4403. DFSClient can infer checksum type when not provided by reading HDFS-4403. DFSClient can infer checksum type when not provided by reading
first byte (todd) first byte (todd)
HDFS-4259. Improve pipeline DN replacement failure message (harsh)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-3429. DataNode reads checksums even if client does not need them (todd) HDFS-3429. DataNode reads checksums even if client does not need them (todd)

View File

@ -785,13 +785,18 @@ private void setHflush() {
private int findNewDatanode(final DatanodeInfo[] original private int findNewDatanode(final DatanodeInfo[] original
) throws IOException { ) throws IOException {
if (nodes.length != original.length + 1) { if (nodes.length != original.length + 1) {
throw new IOException("Failed to add a datanode. " throw new IOException(
+ "User may turn off this feature by setting " new StringBuilder()
+ DFSConfigKeys.DFS_CLIENT_WRITE_REPLACE_DATANODE_ON_FAILURE_POLICY_KEY .append("Failed to replace a bad datanode on the existing pipeline ")
+ " in configuration, where the current policy is " .append("due to no more good datanodes being available to try. ")
+ dfsClient.dtpReplaceDatanodeOnFailure .append("(Nodes: current=").append(Arrays.asList(nodes))
+ ". (Nodes: current=" + Arrays.asList(nodes) .append(", original=").append(Arrays.asList(original)).append("). ")
+ ", original=" + Arrays.asList(original) + ")"); .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++) { for(int i = 0; i < nodes.length; i++) {
int j = 0; int j = 0;