hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r960802 - in /hadoop/mapreduce/trunk: CHANGES.txt src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
Date Tue, 06 Jul 2010 06:19:04 GMT
Author: dhruba
Date: Tue Jul  6 06:19:04 2010
New Revision: 960802

URL: http://svn.apache.org/viewvc?rev=960802&view=rev
Log:
MAPREDUCE-1894. Fixed a bug in DistributedRaidFileSystem.readFully() 
that was causing it to loop infinitely. (Ramkumar Vadali via dhruba)


Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java
    hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=960802&r1=960801&r2=960802&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Tue Jul  6 06:19:04 2010
@@ -143,6 +143,9 @@ Trunk (unreleased changes)
     MAPREDUCE-577. Fixes duplicate records in StreamXmlRecordReader.
     (Ravi Gummadi via amareshwari)
 
+    MAPREDUCE-1894. Fixed a bug in DistributedRaidFileSystem.readFully() 
+    that was causing it to loop infinitely. (Ramkumar Vadali via dhruba)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java?rev=960802&r1=960801&r2=960802&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java
(original)
+++ hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java
Tue Jul  6 06:19:04 2010
@@ -297,6 +297,7 @@ public class DistributedRaidFileSystem e
           try {
             underLyingStream.readFully(pos, b, offset, length);
             nextLocation = 0;
+            return;
           } catch (BlockMissingException e) {
             setAlternateLocations(e, post);
           } catch (ChecksumException e) {
@@ -312,6 +313,7 @@ public class DistributedRaidFileSystem e
           try {
             underLyingStream.readFully(pos, b);
             nextLocation = 0;
+            return;
           } catch (BlockMissingException e) {
             setAlternateLocations(e, post);
           } catch (ChecksumException e) {

Modified: hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java?rev=960802&r1=960801&r2=960802&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
(original)
+++ hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
Tue Jul  6 06:19:04 2010
@@ -200,6 +200,40 @@ public class TestRaidDfs extends TestCas
     }
     LOG.info("Test testPathFilter completed.");
   }
+
+  /**
+   * Test DistributedRaidFileSystem.readFully()
+   */
+  public void testReadFully() throws Exception {
+    mySetup();
+
+    try {
+      Path file = new Path("/user/raid/raidtest/file1");
+      createOldFile(fileSys, file, 1, 7, 8192L);
+
+      // filter all filesystem calls from client
+      Configuration clientConf = new Configuration(conf);
+      clientConf.set("fs.hdfs.impl",
+                      "org.apache.hadoop.hdfs.DistributedRaidFileSystem");
+      clientConf.set("fs.raid.underlyingfs.impl",
+                      "org.apache.hadoop.hdfs.DistributedFileSystem");
+      URI dfsUri = dfs.getFileSystem().getUri();
+      FileSystem.closeAll();
+      FileSystem raidfs = FileSystem.get(dfsUri, clientConf);
+
+      FileStatus stat = raidfs.getFileStatus(file);
+      byte[] filebytes = new byte[(int)stat.getLen()];
+      FSDataInputStream stm = raidfs.open(file);
+      // Test that readFully returns.
+      stm.readFully(filebytes, 0, (int)stat.getLen());
+
+      stm = raidfs.open(file);
+      // Test that readFully returns.
+      stm.readFully(filebytes);
+    } finally {
+      myTearDown();
+    }
+  }
   
   //
   // creates a file and populate it with random data. Returns its crc.



Mime
View raw message