diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 54b63a4db78..5770248dd2e 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -178,6 +178,9 @@ Release 2.4.0 - UNRELEASED TestFileContextResolveAfs and TestStat in branch-2 (Mit Desai via Colin Patrick McCabe) + HADOOP-8753. LocalDirAllocator throws "ArithmeticException: / by zero" when + there is no available space on configured local dir. (Benoy Antony via hitesh) + Release 2.3.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java index e5a1da23728..7748ac5b54e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java @@ -362,6 +362,10 @@ public class LocalDirAllocator { totalAvailable += availableOnDisk[i]; } + if (totalAvailable == 0){ + throw new DiskErrorException("No space available in any of the local directories."); + } + // Keep rolling the wheel till we get a valid path Random r = new java.util.Random(); while (numDirsSearched < numDirs && returnPath == null) {