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) { if (failedLocations.size() > maxVolumeFailuresTolerated) {
throw new IOException( throw new DiskErrorException("Too many failed volumes - "
"Too many failed volumes: " + failedLocations.size() + + "current valid volumes: " + goodLocations.size()
". The configuration allows for a maximum of " + + ", volumes configured: " + dataDirs.size()
maxVolumeFailuresTolerated + " failed volumes."); + ", volumes failed: " + failedLocations.size()
+ ", volume failures tolerated: " + maxVolumeFailuresTolerated);
} }
if (goodLocations.size() == 0) { if (goodLocations.size() == 0) {
throw new IOException("All directories in " throw new DiskErrorException("All directories in "
+ DFS_DATANODE_DATA_DIR_KEY + " are invalid: " + DFS_DATANODE_DATA_DIR_KEY + " are invalid: "
+ failedLocations); + failedLocations);
} }

View File

@ -109,7 +109,9 @@ public class TestStorageLocationChecker {
conf.setInt(DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, 1); conf.setInt(DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, 1);
thrown.expect(IOException.class); 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 = StorageLocationChecker checker =
new StorageLocationChecker(conf, new FakeTimer()); new StorageLocationChecker(conf, new FakeTimer());
checker.check(conf, locations); checker.check(conf, locations);