HDFS-11369. Change exception message in StorageLocationChecker.

This commit is contained in:
Arpit Agarwal 2017-01-26 09:12:38 -08:00
parent b806201f0a
commit deb3ef4587
2 changed files with 9 additions and 6 deletions

View File

@ -213,14 +213,15 @@ public class StorageLocationChecker {
}
if (failedLocations.size() > maxVolumeFailuresTolerated) {
throw new IOException(
"Too many failed volumes: " + failedLocations.size() +
". The configuration allows for a maximum of " +
maxVolumeFailuresTolerated + " failed volumes.");
throw new DiskErrorException("Too many failed volumes - "
+ "current valid volumes: " + goodLocations.size()
+ ", volumes configured: " + dataDirs.size()
+ ", volumes failed: " + failedLocations.size()
+ ", volume failures tolerated: " + maxVolumeFailuresTolerated);
}
if (goodLocations.size() == 0) {
throw new IOException("All directories in "
throw new DiskErrorException("All directories in "
+ DFS_DATANODE_DATA_DIR_KEY + " are invalid: "
+ failedLocations);
}

View File

@ -109,7 +109,9 @@ public class TestStorageLocationChecker {
conf.setInt(DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, 1);
thrown.expect(IOException.class);
thrown.expectMessage("Too many failed volumes");
thrown.expectMessage("Too many failed volumes - current valid volumes: 1,"
+ " volumes configured: 3, volumes failed: 2, volume failures"
+ " tolerated: 1");
StorageLocationChecker checker =
new StorageLocationChecker(conf, new FakeTimer());
checker.check(conf, locations);