HDFS-7419. Improve error messages for DataNode hot swap drive feature (Lei Xu via Colin P. Mccabe)

This commit is contained in:
Colin Patrick Mccabe 2014-11-24 10:51:18 -08:00
parent daacbc18d7
commit f636f9d943
3 changed files with 9 additions and 7 deletions

View File

@ -128,7 +128,7 @@ public abstract class ReconfigurableBase
try {
this.parent.reconfigurePropertyImpl(change.prop, change.newVal);
} catch (ReconfigurationException e) {
errorMessage = e.toString();
errorMessage = e.getCause().getMessage();
}
results.put(change, Optional.fromNullable(errorMessage));
}

View File

@ -389,7 +389,8 @@ public class TestReconfiguration {
.reconfigurePropertyImpl(eq("name1"), anyString());
doNothing().when(dummy)
.reconfigurePropertyImpl(eq("name2"), anyString());
doThrow(new ReconfigurationException("NAME3", "NEW3", "OLD3"))
doThrow(new ReconfigurationException("NAME3", "NEW3", "OLD3",
new IOException("io exception")))
.when(dummy).reconfigurePropertyImpl(eq("name3"), anyString());
dummy.startReconfigurationTask();
@ -406,7 +407,7 @@ public class TestReconfiguration {
assertThat(result.getValue().get(),
containsString("Property name2 is not reconfigurable"));
} else if (change.prop.equals("name3")) {
assertThat(result.getValue().get(), containsString("NAME3"));
assertThat(result.getValue().get(), containsString("io exception"));
} else {
fail("Unknown property: " + change.prop);
}

View File

@ -446,7 +446,7 @@ public class DataNode extends ReconfigurableBase
try {
LOG.info("Reconfiguring " + property + " to " + newVal);
this.refreshVolumes(newVal);
} catch (Exception e) {
} catch (IOException e) {
throw new ReconfigurationException(property, newVal,
getConf().get(property), e);
}
@ -581,14 +581,15 @@ public class DataNode extends ReconfigurableBase
IOException ioe = ioExceptionFuture.get();
if (ioe != null) {
errorMessageBuilder.append(String.format("FAILED TO ADD: %s: %s\n",
volume.toString(), ioe.getMessage()));
volume, ioe.getMessage()));
LOG.error("Failed to add volume: " + volume, ioe);
} else {
effectiveVolumes.add(volume.toString());
LOG.info("Successfully added volume: " + volume);
}
LOG.info("Storage directory is loaded: " + volume.toString());
} catch (Exception e) {
errorMessageBuilder.append(String.format("FAILED to ADD: %s: %s\n",
volume.toString(), e.getMessage()));
volume, e.getMessage()));
}
}
}