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 sz...@apache.org on 2008/10/03 18:42:01 UTC

svn commit: r701439 - in /hadoop/core/branches/branch-0.19: CHANGES.txt src/core/org/apache/hadoop/fs/ChecksumFileSystem.java src/test/org/apache/hadoop/hdfs/TestFSInputChecker.java

Author: szetszwo
Date: Fri Oct  3 09:42:01 2008
New Revision: 701439

URL: http://svn.apache.org/viewvc?rev=701439&view=rev
Log:
HADOOP-4326. ChecksumFileSystem does not override create(...) correctly.  (szetszwo)

Modified:
    hadoop/core/branches/branch-0.19/CHANGES.txt
    hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java
    hadoop/core/branches/branch-0.19/src/test/org/apache/hadoop/hdfs/TestFSInputChecker.java

Modified: hadoop/core/branches/branch-0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/CHANGES.txt?rev=701439&r1=701438&r2=701439&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.19/CHANGES.txt Fri Oct  3 09:42:01 2008
@@ -1635,6 +1635,9 @@
 
     HADOOP-4318. DistCp should use absolute paths for cleanup.  (szetszwo)
 
+    HADOOP-4326. ChecksumFileSystem does not override create(...) correctly.
+    (szetszwo)
+
 Release 0.17.2 - 2008-08-11
 
   BUG FIXES

Modified: hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java?rev=701439&r1=701438&r2=701439&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java (original)
+++ hadoop/core/branches/branch-0.19/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java Fri Oct  3 09:42:01 2008
@@ -25,6 +25,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.StringUtils;
 
@@ -341,28 +342,22 @@
     }
   }
 
-  /**
-   * Opens an FSDataOutputStream at the indicated Path with write-progress
-   * reporting.
-   * @param f the file name to open
-   * @param overwrite if a file with this name already exists, then if true,
-   *   the file will be overwritten, and if false an error will be thrown.
-   * @param bufferSize the size of the buffer to be used.
-   * @param replication required block replication for the file. 
-   */
+  /** {@inheritDoc} */
   @Override
-  public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize,
-                                   short replication, long blockSize, Progressable progress)
-    throws IOException {
+  public FSDataOutputStream create(Path f, FsPermission permission,
+      boolean overwrite, int bufferSize, short replication, long blockSize,
+      Progressable progress) throws IOException {
     Path parent = f.getParent();
     if (parent != null && !mkdirs(parent)) {
       throw new IOException("Mkdirs failed to create " + parent);
     }
-    return new FSDataOutputStream
-            (new ChecksumFSOutputSummer
-                (this, f, overwrite, bufferSize, replication, 
-                 blockSize, progress),
-             null);
+    final FSDataOutputStream out = new FSDataOutputStream(
+        new ChecksumFSOutputSummer(this, f, overwrite, bufferSize, replication,
+            blockSize, progress), null);
+    if (permission != null) {
+      setPermission(f, permission);
+    }
+    return out;
   }
 
   /**

Modified: hadoop/core/branches/branch-0.19/src/test/org/apache/hadoop/hdfs/TestFSInputChecker.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/test/org/apache/hadoop/hdfs/TestFSInputChecker.java?rev=701439&r1=701438&r2=701439&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/src/test/org/apache/hadoop/hdfs/TestFSInputChecker.java (original)
+++ hadoop/core/branches/branch-0.19/src/test/org/apache/hadoop/hdfs/TestFSInputChecker.java Fri Oct  3 09:42:01 2008
@@ -28,6 +28,7 @@
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.LocalFileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.io.IOUtils;
 
 /**
@@ -48,9 +49,9 @@
   /* create a file */
   private void writeFile(FileSystem fileSys, Path name) throws IOException {
     // create and write a file that contains three blocks of data
-    FSDataOutputStream stm = fileSys.create(name, true, 
-                     fileSys.getConf().getInt("io.file.buffer.size", 4096),
-                     NUM_OF_DATANODES, BLOCK_SIZE);
+    FSDataOutputStream stm = fileSys.create(name, new FsPermission((short)0777),
+        true, fileSys.getConf().getInt("io.file.buffer.size", 4096),
+        (short)NUM_OF_DATANODES, BLOCK_SIZE, null);
     stm.write(expected);
     stm.close();
   }