HDFS-12877. Add open(PathHandle) with default buffersize
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0780fdb1 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0780fdb1 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0780fdb1 Branch: refs/heads/HDFS-7240 Commit: 0780fdb1ebdddd19744fbbca7fb05f8fe4bf4d28 Parents: a409425 Author: Chris Douglas <[email protected]> Authored: Thu Nov 30 15:13:16 2017 -0800 Committer: Chris Douglas <[email protected]> Committed: Thu Nov 30 15:13:16 2017 -0800 ---------------------------------------------------------------------- .../main/java/org/apache/hadoop/fs/FileSystem.java | 15 +++++++++++++++ .../org/apache/hadoop/fs/TestFilterFileSystem.java | 1 + .../java/org/apache/hadoop/fs/TestHarFileSystem.java | 1 + 3 files changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/0780fdb1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java index be0ec87..a364921 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java @@ -957,6 +957,21 @@ public abstract class FileSystem extends Configured implements Closeable { * resource directly and verify that the resource referenced * satisfies constraints specified at its construciton. * @param fd PathHandle object returned by the FS authority. + * @throws IOException IO failure + * @throws UnsupportedOperationException If {@link #open(PathHandle, int)} + * not overridden by subclass + */ + public FSDataInputStream open(PathHandle fd) throws IOException { + return open(fd, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, + IO_FILE_BUFFER_SIZE_DEFAULT)); + } + + /** + * Open an FSDataInputStream matching the PathHandle instance. The + * implementation may encode metadata in PathHandle to address the + * resource directly and verify that the resource referenced + * satisfies constraints specified at its construciton. + * @param fd PathHandle object returned by the FS authority. * @param bufferSize the size of the buffer to use * @throws IOException IO failure * @throws UnsupportedOperationException If not overridden by subclass http://git-wip-us.apache.org/repos/asf/hadoop/blob/0780fdb1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java index 4cbb8ab..0e9a612 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java @@ -79,6 +79,7 @@ public class TestFilterFileSystem { public boolean mkdirs(Path f); public FSDataInputStream open(Path f); + public FSDataInputStream open(PathHandle f); public FSDataOutputStream create(Path f); public FSDataOutputStream create(Path f, boolean overwrite); public FSDataOutputStream create(Path f, Progressable progress); http://git-wip-us.apache.org/repos/asf/hadoop/blob/0780fdb1/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java index a1aa4de..1b69693 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java @@ -80,6 +80,7 @@ public class TestHarFileSystem { public boolean mkdirs(Path f); public FSDataInputStream open(Path f); + public FSDataInputStream open(PathHandle f); public FSDataOutputStream create(Path f); public FSDataOutputStream create(Path f, boolean overwrite); public FSDataOutputStream create(Path f, Progressable progress); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
