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

svn commit: r232896 - /lucene/nutch/branches/mapred/src/java/org/apache/nutch/io/MapFile.java

Author: cutting
Date: Mon Aug 15 15:08:53 2005
New Revision: 232896

URL: http://svn.apache.org/viewcvs?rev=232896&view=rev
Log:
Make things a bit more fault tolerant.

Modified:
    lucene/nutch/branches/mapred/src/java/org/apache/nutch/io/MapFile.java

Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/io/MapFile.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/io/MapFile.java?rev=232896&r1=232895&r2=232896&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/io/MapFile.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/io/MapFile.java Mon Aug 15 15:08:53 2005
@@ -99,9 +99,6 @@
       this.lastKey = comparator.newKey();
 
       File dir = new File(dirName);
-      if (nfs.exists(dir)) {
-          throw new IOException("already exists: " + dir);
-      }
       nfs.mkdirs(dir);
 
       File dataFile = new File(dir, DATA_FILE_NAME);
@@ -130,8 +127,8 @@
       index.close();
     }
 
-    /** Append a key/value pair to the map.  The key must be strictly greater
-     * than the previous key added to the map. */
+    /** Append a key/value pair to the map.  The key must be greater or equal
+     * to the previous key added to the map. */
     public synchronized void append(WritableComparable key, Writable val)
       throws IOException {
 
@@ -148,7 +145,7 @@
 
     private void checkKey(WritableComparable key) throws IOException {
       // check that keys are well-ordered
-      if (size != 0 && comparator.compare(lastKey, key) >= 0)
+      if (size != 0 && comparator.compare(lastKey, key) > 0)
         throw new IOException("key out of order: "+key+" after "+lastKey);
           
       // update lastKey with a copy of key by writing and reading