hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r1301291 - in /hadoop/common/branches/branch-1: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java src/test/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java
Date Fri, 16 Mar 2012 00:08:25 GMT
Author: szetszwo
Date: Fri Mar 16 00:08:24 2012
New Revision: 1301291

URL: http://svn.apache.org/viewvc?rev=1301291&view=rev
Log:
HDFS-3101. Cannot read empty file using WebHDFS.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1301291&r1=1301290&r2=1301291&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Fri Mar 16 00:08:24 2012
@@ -159,9 +159,6 @@ Release 1.1.0 - unreleased
 
     MAPREDUCE-4001. Improve MAPREDUCE-3789's fix logic by looking at job's slot demands instead.
(harsh)
 
-    HDFS-3075. Backport HADOOP-4885: Try to restore failed name-node storage
-    directories at checkpoint time.  (Brandon Li via szetszwo)
-
     MAPREDUCE-2835. Make per-job counter limits configurable. (tomwhite)
 
 Release 1.0.2 - unreleased
@@ -207,6 +204,11 @@ Release 1.0.2 - unreleased
 
     HDFS-2702. A single failed name dir can cause the NN to exit. (eli)
 
+    HDFS-3075. Backport HADOOP-4885: Try to restore failed name-node storage
+    directories at checkpoint time.  (Brandon Li via szetszwo)
+
+    HDFS-3101. Cannot read empty file using WebHDFS.  (szetszwo)
+
 Release 1.0.1 - 2012.02.14
 
   NEW FEATURES

Modified: hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java?rev=1301291&r1=1301290&r2=1301291&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
(original)
+++ hadoop/common/branches/branch-1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
Fri Mar 16 00:08:24 2012
@@ -137,9 +137,11 @@ public class NamenodeWebHdfsMethods {
         throw new FileNotFoundException("File " + path + " not found.");
       }
       final long len = status.getLen();
-      if (op == GetOpParam.Op.OPEN && (openOffset < 0L || openOffset >= len))
{
-        throw new IOException("Offset=" + openOffset + " out of the range [0, "
-          + len + "); " + op + ", path=" + path);
+      if (op == GetOpParam.Op.OPEN) {
+        if (openOffset < 0L || (openOffset >= len && len > 0)) {
+          throw new IOException("Offset=" + openOffset
+              + " out of the range [0, " + len + "); " + op + ", path=" + path);
+        }
       }
 
       if (len > 0) {

Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java?rev=1301291&r1=1301290&r2=1301291&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/web/TestWebHdfsFileSystemContract.java
Fri Mar 16 00:08:24 2012
@@ -198,7 +198,21 @@ public class TestWebHdfsFileSystemContra
   }
 
   public void testSeek() throws IOException {
-    final Path p = new Path("/test/testSeek");
+    final Path dir = new Path("/test/testSeek");
+    assertTrue(fs.mkdirs(dir));
+
+    { //test zero file size
+      final Path zero = new Path(dir, "zero");
+      fs.create(zero).close();
+      
+      int count = 0;
+      final FSDataInputStream in = fs.open(zero);
+      for(; in.read() != -1; count++);
+      in.close();
+      assertEquals(0, count);
+    }
+
+    final Path p = new Path(dir, "file");
     createFile(p);
 
     final int one_third = data.length/3;
@@ -269,7 +283,6 @@ public class TestWebHdfsFileSystemContra
       final FSDataInputStream in = fs.open(root);
       in.read();
       fail();
-      fail();
     } catch(IOException e) {
       WebHdfsFileSystem.LOG.info("This is expected.", e);
     }



Mime
View raw message