Преглед изворни кода

HADOOP-8430. Backport new FileSystem methods introduced by HADOOP-8014. Contributed by Eli Collins

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.1@1346172 13f79535-47bb-0310-9956-ffa450edef68
Eli Collins пре 13 година
родитељ
комит
8471be721d
2 измењених фајлова са 29 додато и 2 уклоњено
  1. 2 0
      CHANGES.txt
  2. 27 2
      src/core/org/apache/hadoop/fs/FileSystem.java

+ 2 - 0
CHANGES.txt

@@ -101,6 +101,8 @@ Release 1.1.0 - unreleased
     HADOOP-6995. Allow wildcards to be used in ProxyUsers configurations 
     (todd via tucu)
 
+    HADOOP-8430. Backport new FileSystem methods introduced by HADOOP-8014. (eli)
+
   BUG FIXES
 
     MAPREDUCE-4087. [Gridmix] GenerateDistCacheData job of Gridmix can

+ 27 - 2
src/core/org/apache/hadoop/fs/FileSystem.java

@@ -1275,18 +1275,43 @@ public abstract class FileSystem extends Configured implements Closeable {
     return getFileStatus(f).getBlockSize();
   }
     
-  /** Return the number of bytes that large input files should be optimally
-   * be split into to minimize i/o time. */
+  /**
+   * Return the number of bytes that large input files should be optimally
+   * be split into to minimize i/o time.
+   * @deprecated use {@link #getDefaultBlockSize(Path)} instead
+   */
+  @Deprecated
   public long getDefaultBlockSize() {
     // default to 32MB: large enough to minimize the impact of seeks
     return getConf().getLong("fs.local.block.size", 32 * 1024 * 1024);
   }
+
+  /**
+   * Return the number of bytes that large input files should be optimally
+   * be split into to minimize i/o time.
+   * @param f path of file
+   * @return the default block size for the path's filesystem
+   */
+  public long getDefaultBlockSize(Path f) {
+    return getDefaultBlockSize();
+  }
     
   /**
    * Get the default replication.
+   * @deprecated use {@link #getDefaultReplication(Path)} instead
    */
+  @Deprecated
   public short getDefaultReplication() { return 1; }
 
+  /**
+   * Get the default replication.
+   * @param path of the file
+   * @return default replication for the path's filesystem 
+   */
+  public short getDefaultReplication(Path path) {
+    return getDefaultReplication();
+  }
+
   /**
    * Return a file status object that represents the path.
    * @param f The path we want information from