YARN-9018. Add functionality to AuxiliaryLocalPathHandler to return all locations to read for a given path. Contributed by Kuhu Shukla (kshukla)

This commit is contained in:
Eric E Payne 2020-01-09 17:18:44 +00:00
parent a40dc9ee31
commit 93233a7d6e
4 changed files with 25 additions and 0 deletions

View File

@ -173,6 +173,14 @@ public Path getLocalPathForWrite(String path, long size)
throws IOException {
return new Path(ABS_LOG_DIR.getAbsolutePath());
}
@Override
public Iterable<Path> getAllLocalPathsForRead(String path)
throws IOException {
ArrayList<Path> paths = new ArrayList<>();
paths.add(new Path(ABS_LOG_DIR.getAbsolutePath()));
return paths;
}
}
private static class MockShuffleHandler2 extends

View File

@ -55,4 +55,12 @@ public interface AuxiliaryLocalPathHandler {
* @throws IOException if the path creations fails
*/
Path getLocalPathForWrite(String path, long size) throws IOException;
/**
* Get all paths from the local FS for reading for a given Auxiliary Service.
* @param path the requested path
* @return the complete path list to the file on a local disk as an Iterable
* @throws IOException if the file read encounters a problem
*/
Iterable<Path> getAllLocalPathsForRead(String path) throws IOException;
}

View File

@ -644,6 +644,10 @@ public Path getLocalPathForRead(String pathStr) throws IOException {
return getPathToRead(pathStr, getLocalDirsForRead());
}
public Iterable<Path> getAllLocalPathsForRead(String pathStr) throws IOException {
return localDirsAllocator.getAllLocalPathsToRead(pathStr, getConfig());
}
public Path getLogPathForWrite(String pathStr, boolean checkWrite)
throws IOException {
return logDirsAllocator.getLocalPathForWrite(pathStr,

View File

@ -1650,6 +1650,11 @@ public Path getLocalPathForWrite(String path, long size)
throws IOException {
return dirhandlerService.getLocalPathForWrite(path, size, false);
}
@Override
public Iterable<Path> getAllLocalPathsForRead(String path) throws IOException {
return dirhandlerService.getAllLocalPathsForRead(path);
}
}
@SuppressWarnings("unchecked")