You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by mc...@apache.org on 2005/08/02 07:01:16 UTC

svn commit: r226950 - in /lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs: FSDirectory.java NDFSClient.java

Author: mc
Date: Mon Aug  1 22:01:12 2005
New Revision: 226950

URL: http://svn.apache.org/viewcvs?rev=226950&view=rev
Log:

  Fix 2 bugs:

  1) Zero-length NDFSOutputStream bug that was introduced as part 
of a buffer-fix last night.  Now we test to see if we're closing down
the stream.  If so, it's OK to send a zero.  Otherwise, not.

  2) File namespace deletions were broken, reporting success but
not actually performing the file delete.  This was introduced as
part of the namespace-handler rewrite earlier today.  (I'm so tired,
I just wrote "a couple of days ago" by mistake.)


Modified:
    lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/FSDirectory.java
    lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java

Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/FSDirectory.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/FSDirectory.java?rev=226950&r1=226949&r2=226950&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/FSDirectory.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/FSDirectory.java Mon Aug  1 22:01:12 2005
@@ -130,7 +130,7 @@
             if (targetNode == null) {
                 return null;
             } else {
-                targetNode.parent.children.remove(target);
+                targetNode.parent.children.remove(new File(target).getName());
                 return targetNode;
             }
         }

Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java?rev=226950&r1=226949&r2=226950&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/ndfs/NDFSClient.java Mon Aug  1 22:01:12 2005
@@ -512,6 +512,7 @@
         private int pos = 0;
 
         private UTF8 src;
+        boolean closingDown = false;
         private boolean overwrite;
         private boolean blockStreamWorking;
         private DataOutputStream blockStream;
@@ -695,7 +696,8 @@
         private synchronized void flushData(int maxPos) throws IOException {
             int workingPos = Math.min(pos, maxPos);
             
-            if (workingPos > 0) {
+            if (workingPos > 0 || 
+                (workingPos == 0 && closingDown)) {
                 //
                 // To the blockStream, write length, then bytes
                 //
@@ -820,6 +822,7 @@
                 throw new IOException("Stream closed");
             }
 
+            closingDown = true;
             flush();
             endBlock();
 
@@ -848,6 +851,7 @@
                 }
             }
             closed = true;
+            closingDown = false;
         }
     }
 }