Browse Source

HADOOP-2955. Fix TestCrcCorruption test failures caused by HADOOP-2758 (rangadi)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@635978 13f79535-47bb-0310-9956-ffa450edef68
Raghu Angadi 17 years ago
parent
commit
ea24af74a2
2 changed files with 12 additions and 0 deletions
  1. 3 0
      CHANGES.txt
  2. 9 0
      src/java/org/apache/hadoop/dfs/DataNode.java

+ 3 - 0
CHANGES.txt

@@ -170,6 +170,9 @@ Trunk (unreleased changes)
     HADOOP-2971. select multiple times if it returns early in 
     SocketIOWithTimeout. (rangadi)
 
+    HADOOP-2955. Fix TestCrcCorruption test failures caused by HADOOP-2758
+    (rangadi)
+
 Release 0.16.1 - 2008-03-13
 
   INCOMPATIBLE CHANGES

+ 9 - 0
src/java/org/apache/hadoop/dfs/DataNode.java

@@ -1587,7 +1587,16 @@ public class DataNode implements FSConstants, Runnable {
               16 * 1024);
         }
 
+        /* If bytesPerChecksum is very large, then the metadata file
+         * is mostly corrupted. For now just truncate bytesPerchecksum to
+         * blockLength.
+         */        
         bytesPerChecksum = checksum.getBytesPerChecksum();
+        if (bytesPerChecksum > 10*1024*1024 && bytesPerChecksum > blockLength){
+          checksum = DataChecksum.newDataChecksum(checksum.getChecksumType(),
+                                     Math.max((int)blockLength, 10*1024*1024));
+          bytesPerChecksum = checksum.getBytesPerChecksum();        
+        }
         checksumSize = checksum.getChecksumSize();
 
         if (length < 0) {