فهرست منبع

HADOOP-4499. DFSClient should invoke checksumOk only once. (Raghu Angadi)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.18@711715 13f79535-47bb-0310-9956-ffa450edef68
Raghu Angadi 16 سال پیش
والد
کامیت
b0ff7ff912
2فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 6 0
      CHANGES.txt
  2. 6 3
      src/hdfs/org/apache/hadoop/dfs/DFSClient.java

+ 6 - 0
CHANGES.txt

@@ -1,5 +1,11 @@
 Hadoop Change Log
 
+Release 0.18.3 - Unreleased
+
+  BUG FIXES
+
+    HADOOP-4499. DFSClient should invoke checksumOk only once. (Raghu Angadi)
+
 Release 0.18.2 - 2008-11-03
 
   BUG FIXES

+ 6 - 3
src/hdfs/org/apache/hadoop/dfs/DFSClient.java

@@ -823,7 +823,7 @@ class DFSClient implements FSConstants {
     private int bytesPerChecksum;
     private int checksumSize;
     private boolean gotEOS = false;
-    private boolean sentChecksumOk = false;
+    private boolean sentChecksumOk = false; //temp : to be removed in 0.20.0
     
     byte[] skipBuf = null;
     ByteBuffer checksumBytes = null;
@@ -856,12 +856,15 @@ class DFSClient implements FSConstants {
         }
       }
       
+      boolean eosBefore = gotEOS;
       int nRead = super.read(buf, off, len);
-      if (nRead >= 0 && gotEOS && needChecksum()) {
+      
+      // if gotEOS was set in the previous read and checksum is enabled :
+      if (gotEOS && !eosBefore && nRead >= 0 && needChecksum()) {
         if (sentChecksumOk) {
            // this should not happen; log the error for the debugging purpose
            LOG.info(StringUtils.stringifyException(new IOException(
-             "Checksum ok was sent and should not be sent again")));  
+             "Checksum ok was sent and should not be sent again"))); 
         } else {
           //checksum is verified and there are no errors.
           checksumOk(dnSock);