You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2020/06/17 15:15:45 UTC

[hadoop] branch trunk updated: HADOOP-17020. Improve RawFileSystem Performance (#2063)

This is an automated email from the ASF dual-hosted git repository.

stevel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 2bfb228  HADOOP-17020. Improve RawFileSystem Performance (#2063)
2bfb228 is described below

commit 2bfb22840acc9f96a8bdec1ef82da37d06937da8
Author: Mehakmeet Singh <me...@gmail.com>
AuthorDate: Wed Jun 17 20:45:26 2020 +0530

    HADOOP-17020. Improve RawFileSystem Performance (#2063)
    
    
    Contributed by : Mehakmeet Singh
    
    Co-authored-by: Rajesh Balamohan
    Co-authored-by: Mehakmeet Singh
---
 .../main/java/org/apache/hadoop/fs/RawLocalFileSystem.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
index cf22105..72eeb99 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
@@ -64,6 +64,7 @@ import static org.apache.hadoop.fs.impl.PathCapabilitiesSupport.validatePathCapa
 public class RawLocalFileSystem extends FileSystem {
   static final URI NAME = URI.create("file:///");
   private Path workingDir;
+  private long defaultBlockSize;
   // Temporary workaround for HADOOP-9652.
   private static boolean useDeprecatedFileStatus = true;
 
@@ -100,6 +101,7 @@ public class RawLocalFileSystem extends FileSystem {
   public void initialize(URI uri, Configuration conf) throws IOException {
     super.initialize(uri, conf);
     setConf(conf);
+    defaultBlockSize = getDefaultBlockSize(new Path(uri));
   }
   
   /*******************************************************
@@ -518,7 +520,12 @@ public class RawLocalFileSystem extends FileSystem {
     }
     return new FileStatus[] {
         new DeprecatedRawLocalFileStatus(localf,
-        getDefaultBlockSize(f), this) };
+        defaultBlockSize, this) };
+  }
+
+  @Override
+  public boolean exists(Path f) throws IOException {
+    return pathToFile(f).exists();
   }
   
   protected boolean mkOneDir(File p2f) throws IOException {
@@ -663,7 +670,7 @@ public class RawLocalFileSystem extends FileSystem {
     File path = pathToFile(f);
     if (path.exists()) {
       return new DeprecatedRawLocalFileStatus(pathToFile(f),
-          getDefaultBlockSize(f), this);
+          defaultBlockSize, this);
     } else {
       throw new FileNotFoundException("File " + f + " does not exist");
     }
@@ -1051,7 +1058,7 @@ public class RawLocalFileSystem extends FileSystem {
   private FileStatus getNativeFileLinkStatus(final Path f,
       boolean dereference) throws IOException {
     checkPath(f);
-    Stat stat = new Stat(f, getDefaultBlockSize(f), dereference, this);
+    Stat stat = new Stat(f, defaultBlockSize, dereference, this);
     FileStatus status = stat.getFileStatus();
     return status;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org