You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ra...@apache.org on 2008/10/29 00:31:34 UTC

svn commit: r708723 - in /hadoop/core/trunk: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

Author: rangadi
Date: Tue Oct 28 16:31:33 2008
New Revision: 708723

URL: http://svn.apache.org/viewvc?rev=708723&view=rev
Log:
HADOOP-4499. DFSClient should invoke checksumOk only once. (Raghu Angadi)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=708723&r1=708722&r2=708723&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Oct 28 16:31:33 2008
@@ -1042,6 +1042,8 @@
     HADOOP-4525. Fix ipc.server.ipcnodelay originally missed in in HADOOP-2232.
     (cdouglas via Clint Morgan)
 
+    HADOOP-4499. DFSClient should invoke checksumOk only once. (Raghu Angadi)
+
 Release 0.18.2 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java?rev=708723&r1=708722&r2=708723&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java Tue Oct 28 16:31:33 2008
@@ -1024,7 +1024,6 @@
     private int bytesPerChecksum;
     private int checksumSize;
     private boolean gotEOS = false;
-    private boolean sentChecksumOk = false;
     
     byte[] skipBuf = null;
     ByteBuffer checksumBytes = null;
@@ -1057,17 +1056,13 @@
         }
       }
       
+      boolean eosBefore = gotEOS;
       int nRead = super.read(buf, off, len);
-      if (nRead >= 0 && gotEOS && 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")));  
-        } else {
-          //checksum is verified and there are no errors.
-          checksumOk(dnSock);
-          sentChecksumOk = true;
-       }
+      
+      // if gotEOS was set in the previous read and checksum is enabled :
+      if (gotEOS && !eosBefore && nRead >= 0 && needChecksum()) {
+        //checksum is verified and there are no errors.
+        checksumOk(dnSock);
       }
       return nRead;
     }