hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r537939 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/ChecksumFileSystem.java
Date Mon, 14 May 2007 18:26:49 GMT
Author: cutting
Date: Mon May 14 11:26:48 2007
New Revision: 537939

URL: http://svn.apache.org/viewvc?view=rev&rev=537939
Log:
HADOOP-1345.  Fix HDFS to correctly retry another replica when a checksum error is encountered.
 Contributed by Hairong.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=537939&r1=537938&r2=537939
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon May 14 11:26:48 2007
@@ -389,6 +389,9 @@
 111. HADOOP-1350.  Fix shuffle performance problem caused by forcing
      chunked encoding of map outputs.  (Devaraj Das via cutting)
 
+112. HADOOP-1345.  Fix HDFS to correctly retry another replica when a
+     checksum error is encountered.  (Hairong Kuang via cutting)
+
 
 Release 0.12.3 - 2007-04-06
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java?view=diff&rev=537939&r1=537938&r2=537939
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java Mon May 14 11:26:48
2007
@@ -134,13 +134,17 @@
       }
     }
 
+    private long getChecksumFilePos( long dataPos ) {
+      return HEADER_LENGTH + 4*(dataPos/bytesPerSum);
+    }
+    
     public void seek(long desired) throws IOException {
       // seek to a checksum boundary
       long checksumBoundary = desired/bytesPerSum*bytesPerSum;
       if (checksumBoundary != getPos()) {
         datas.seek(checksumBoundary);
         if (sums != null) {
-          sums.seek(HEADER_LENGTH + 4*(checksumBoundary/bytesPerSum));
+          sums.seek(getChecksumFilePos(checksumBoundary));
         }
       }
       
@@ -226,13 +230,11 @@
               throw ce;
             }
             
-            sums.seek(oldSumsPos);
-            datas.seek(oldPos);
-            
             if (seekToNewSource(oldPos)) {
               // Since at least one of the sources is different, 
               // the read might succeed, so we'll retry.
               retry = true;
+              seek(oldPos); //make sure Checksum sum's value gets restored
             } else {
               // Neither the data stream nor the checksum stream are being read
               // from different sources, meaning we'll still get a checksum error 
@@ -320,7 +322,7 @@
     @Override
     public boolean seekToNewSource(long targetPos) throws IOException {
       boolean newDataSource = datas.seekToNewSource(targetPos);
-      return sums.seekToNewSource(targetPos/bytesPerSum) || newDataSource;
+      return sums.seekToNewSource(getChecksumFilePos(targetPos)) || newDataSource;
     }
 
   }



Mime
View raw message