hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r594274 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/DFSClient.java src/java/org/apache/hadoop/fs/FSOutputSummer.java
Date Mon, 12 Nov 2007 19:53:44 GMT
Author: dhruba
Date: Mon Nov 12 11:53:43 2007
New Revision: 594274

URL: http://svn.apache.org/viewvc?rev=594274&view=rev
Log:
HADOOP-2121. Cleanup DFSOutputStream when the stream encountered errors
when Datanodes became full.  (Raghu Angadi via dhruba)


Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSOutputSummer.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=594274&r1=594273&r2=594274&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Nov 12 11:53:43 2007
@@ -88,8 +88,11 @@
     Now invalid options are caught, logged and jobs are failed early. (Lohit
     Vijayarenu via acmurthy)
 
-    HADOOP-2151. FileSyste.globPaths validates the list of Paths that
+    HADOOP-2151. FileSystem.globPaths validates the list of Paths that
     it returns.  (Lohit Vijayarenu via dhruba)
+
+    HADOOP-2121. Cleanup DFSOutputStream when the stream encountered errors
+    when Datanodes became full.  (Raghu Angadi via dhruba)
 
 Release 0.15.1 -
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java?rev=594274&r1=594273&r2=594274&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java Mon Nov 12 11:53:43
2007
@@ -1701,6 +1701,22 @@
       namenode.abandonBlock(block, src.toString());
     }
 
+    private void internalClose() throws IOException {
+      // Clean up any resources that might be held.
+      closed = true;
+      
+      synchronized (pendingCreates) {
+        pendingCreates.remove(src);
+      }
+      
+      if (s != null) {
+        s.close();
+        s = null;
+      }
+      
+      closeBackupStream();
+    }
+    
     /**
      * Closes this output stream and releases any system 
      * resources associated with this stream.
@@ -1712,9 +1728,9 @@
         throw new IOException("Stream closed");
       }
       
-      flushBuffer();
-      
       try {
+        flushBuffer();
+        
         if (filePos == 0 || bytesWrittenToBlock != 0) {
           try {
             endBlock();
@@ -1743,11 +1759,8 @@
             }
           }
         }
-        closed = true;
       } finally {
-        synchronized (pendingCreates) {
-          pendingCreates.remove(src.toString());
-        }
+        internalClose();
       }
     }
   }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSOutputSummer.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSOutputSummer.java?rev=594274&r1=594273&r2=594274&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSOutputSummer.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSOutputSummer.java Mon Nov 12 11:53:43
2007
@@ -119,8 +119,9 @@
    */
   protected synchronized void flushBuffer() throws IOException {
     if(count != 0) {
-      writeChecksumChunk(buf, 0, count);
+      int chunkLen = count;
       count = 0;
+      writeChecksumChunk(buf, 0, chunkLen);
     }
   }
   



Mime
View raw message