HADOOP-8437. getLocalPathForWrite should throw IOException for invalid paths. Contributed by Brahma Reddy Battula
(cherry picked from commit fd026f535c
)
This commit is contained in:
parent
db145e0c9a
commit
07f9405692
|
@ -601,6 +601,9 @@ Release 2.8.0 - UNRELEASED
|
|||
HADOOP-10296. Incorrect null check in SwiftRestClient#buildException().
|
||||
(Rahul Palamuttam and Kanaka Kumar Avvaru via aajisaka)
|
||||
|
||||
HADOOP-8437. getLocalPathForWrite should throw IOException for invalid
|
||||
paths. (Brahma Reddy Battula via zxu)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()
|
||||
|
|
|
@ -304,8 +304,10 @@ public class LocalDirAllocator {
|
|||
dirDF = dfList.toArray(new DF[dirs.size()]);
|
||||
savedLocalDirs = newLocalDirs;
|
||||
|
||||
// randomize the first disk picked in the round-robin selection
|
||||
dirNumLastAccessed = dirIndexRandomizer.nextInt(dirs.size());
|
||||
if (dirs.size() > 0) {
|
||||
// randomize the first disk picked in the round-robin selection
|
||||
dirNumLastAccessed = dirIndexRandomizer.nextInt(dirs.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -458,4 +458,21 @@ public class TestLocalDirAllocator {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to check the LocalDirAllocation for the invalid path HADOOP-8437
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(timeout = 30000)
|
||||
public void testGetLocalPathForWriteForInvalidPaths() throws Exception {
|
||||
conf.set(CONTEXT, " ");
|
||||
try {
|
||||
dirAllocator.getLocalPathForWrite("/test", conf);
|
||||
fail("not throwing the exception");
|
||||
} catch (IOException e) {
|
||||
assertEquals("Incorrect exception message",
|
||||
"No space available in any of the local directories.", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue