You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by sz...@apache.org on 2011/06/04 00:16:57 UTC

svn commit: r1131264 - in /hadoop/hdfs/trunk: CHANGES.txt src/test/hdfs/org/apache/hadoop/hdfs/TestWriteRead.java

Author: szetszwo
Date: Fri Jun  3 22:16:57 2011
New Revision: 1131264

URL: http://svn.apache.org/viewvc?rev=1131264&view=rev
Log:
HDFS-2029.  In TestWriteRead, check visible length immediately after openning the file and fix code style.  Contributed by John George

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestWriteRead.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1131264&r1=1131263&r2=1131264&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Fri Jun  3 22:16:57 2011
@@ -479,6 +479,9 @@ Trunk (unreleased changes)
     HDFS-1986. Add option to get http/https address from 
     DFSUtil#getInfoServer(). (Tanping via suresh)
 
+    HDFS-2029.  In TestWriteRead, check visible length immediately after
+    openning the file and fix code style.  (John George via szetszwo)
+
   OPTIMIZATIONS
 
     HDFS-1458. Improve checkpoint performance by avoiding unnecessary image

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestWriteRead.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestWriteRead.java?rev=1131264&r1=1131263&r2=1131264&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestWriteRead.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestWriteRead.java Fri Jun  3 22:16:57 2011
@@ -101,12 +101,11 @@ public class TestWriteRead {
   /** Junit Test reading while writing. */
   
   @Test
-  public void TestWriteRead1() throws IOException {
+  public void testWriteReadSeq() throws IOException {
     useFCOption = false; 
     positionReadOption = false;
     String fname = filenameOption;
     
-    positionReadOption = false;   // sequential read
     // need to run long enough to fail: takes 25 to 35 seec on Mac
     int stat = testWriteAndRead(fname, WR_NTIMES, WR_CHUNK_SIZE);
     LOG.info("Summary status from test1: status= " + stat);
@@ -115,7 +114,7 @@ public class TestWriteRead {
 
   /** Junit Test position read while writing. */
   @Test
-  public void TestWriteReadPos() throws IOException {
+  public void testWriteReadPos() throws IOException {
     String fname = filenameOption;
     positionReadOption = true;   // position read
     int stat = testWriteAndRead(fname, WR_NTIMES, WR_CHUNK_SIZE);
@@ -146,6 +145,13 @@ public class TestWriteRead {
 
       long visibleLenFromReadStream = getVisibleFileLength(in);
 
+      if (visibleLenFromReadStream < byteExpected)
+      {
+        throw new IOException(visibleLenFromReadStream
+            + " = visibleLenFromReadStream < bytesExpected= "
+            + byteExpected);
+      }
+
       totalByteRead = readUntilEnd(in, buffer, buffer.length, fname,
           beginPosition, visibleLenFromReadStream, positionReadOption);
       in.close();