HADOOP-8437. getLocalPathForWrite should throw IOException for invalid paths. Contributed by Brahma Reddy Battula
This commit is contained in:
parent
ecbfd68974
commit
fd026f535c
|
@ -1106,6 +1106,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,10 +304,12 @@ public class LocalDirAllocator {
|
|||
dirDF = dfList.toArray(new DF[dirs.size()]);
|
||||
savedLocalDirs = newLocalDirs;
|
||||
|
||||
if (dirs.size() > 0) {
|
||||
// randomize the first disk picked in the round-robin selection
|
||||
dirNumLastAccessed = dirIndexRandomizer.nextInt(dirs.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Path createPath(String path,
|
||||
boolean checkWrite) throws IOException {
|
||||
|
|
|
@ -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