HDFS-7419. Improve error messages for DataNode hot swap drive feature (Lei Xu via Colin P. Mccabe)
(cherry picked from commit f636f9d943
)
This commit is contained in:
parent
946df98dce
commit
4435ac9af5
|
@ -128,7 +128,7 @@ public abstract class ReconfigurableBase
|
||||||
try {
|
try {
|
||||||
this.parent.reconfigurePropertyImpl(change.prop, change.newVal);
|
this.parent.reconfigurePropertyImpl(change.prop, change.newVal);
|
||||||
} catch (ReconfigurationException e) {
|
} catch (ReconfigurationException e) {
|
||||||
errorMessage = e.toString();
|
errorMessage = e.getCause().getMessage();
|
||||||
}
|
}
|
||||||
results.put(change, Optional.fromNullable(errorMessage));
|
results.put(change, Optional.fromNullable(errorMessage));
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,7 +389,8 @@ public class TestReconfiguration {
|
||||||
.reconfigurePropertyImpl(eq("name1"), anyString());
|
.reconfigurePropertyImpl(eq("name1"), anyString());
|
||||||
doNothing().when(dummy)
|
doNothing().when(dummy)
|
||||||
.reconfigurePropertyImpl(eq("name2"), anyString());
|
.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());
|
.when(dummy).reconfigurePropertyImpl(eq("name3"), anyString());
|
||||||
|
|
||||||
dummy.startReconfigurationTask();
|
dummy.startReconfigurationTask();
|
||||||
|
@ -406,7 +407,7 @@ public class TestReconfiguration {
|
||||||
assertThat(result.getValue().get(),
|
assertThat(result.getValue().get(),
|
||||||
containsString("Property name2 is not reconfigurable"));
|
containsString("Property name2 is not reconfigurable"));
|
||||||
} else if (change.prop.equals("name3")) {
|
} else if (change.prop.equals("name3")) {
|
||||||
assertThat(result.getValue().get(), containsString("NAME3"));
|
assertThat(result.getValue().get(), containsString("io exception"));
|
||||||
} else {
|
} else {
|
||||||
fail("Unknown property: " + change.prop);
|
fail("Unknown property: " + change.prop);
|
||||||
}
|
}
|
||||||
|
|
|
@ -449,7 +449,7 @@ public class DataNode extends ReconfigurableBase
|
||||||
try {
|
try {
|
||||||
LOG.info("Reconfiguring " + property + " to " + newVal);
|
LOG.info("Reconfiguring " + property + " to " + newVal);
|
||||||
this.refreshVolumes(newVal);
|
this.refreshVolumes(newVal);
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
throw new ReconfigurationException(property, newVal,
|
throw new ReconfigurationException(property, newVal,
|
||||||
getConf().get(property), e);
|
getConf().get(property), e);
|
||||||
}
|
}
|
||||||
|
@ -584,14 +584,15 @@ public class DataNode extends ReconfigurableBase
|
||||||
IOException ioe = ioExceptionFuture.get();
|
IOException ioe = ioExceptionFuture.get();
|
||||||
if (ioe != null) {
|
if (ioe != null) {
|
||||||
errorMessageBuilder.append(String.format("FAILED TO ADD: %s: %s\n",
|
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 {
|
} else {
|
||||||
effectiveVolumes.add(volume.toString());
|
effectiveVolumes.add(volume.toString());
|
||||||
|
LOG.info("Successfully added volume: " + volume);
|
||||||
}
|
}
|
||||||
LOG.info("Storage directory is loaded: " + volume.toString());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
errorMessageBuilder.append(String.format("FAILED to ADD: %s: %s\n",
|
errorMessageBuilder.append(String.format("FAILED to ADD: %s: %s\n",
|
||||||
volume.toString(), e.getMessage()));
|
volume, e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue