hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r635650 [1/2] - in /hadoop/core/trunk: ./ src/examples/org/apache/hadoop/examples/ src/examples/org/apache/hadoop/examples/dancing/ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/filecache/ src/java/org/apache/hadoop/fs/ src/jav...
Date Mon, 10 Mar 2008 18:54:21 GMT
Author: dhruba
Date: Mon Mar 10 11:53:58 2008
New Revision: 635650

URL: http://svn.apache.org/viewvc?rev=635650&view=rev
Log:
HADOOP-771. FileSystem.delete() takes an explicit parameter that
specifies whether a recursive delete is intended.
(Mahadev Konar via dhruba)


Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Grep.java
    hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java
    hadoop/core/trunk/src/examples/org/apache/hadoop/examples/SleepJob.java
    hadoop/core/trunk/src/examples/org/apache/hadoop/examples/dancing/DistributedPentomino.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSDirectory.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java
    hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileUtil.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/Trash.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/io/MapFile.java
    hadoop/core/trunk/src/java/org/apache/hadoop/io/SequenceFile.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapOutputLocation.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapTask.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/PhasedFileSystem.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ReduceTask.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/Task.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
    hadoop/core/trunk/src/java/org/apache/hadoop/util/CopyFiles.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/BenchmarkThroughput.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DFSTestUtil.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBench.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBenchWithoutMR.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNThroughputBenchmark.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestCheckpoint.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSMkdirs.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDecommission.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSInputChecker.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSOutputSummer.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileCorruption.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileLimit.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestLocalDFS.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestModTime.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestPread.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSeekBug.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSmallBlock.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/DFSCIOTest.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/DistributedFSCheck.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestDFSIO.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystemPermission.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/s3/S3FileSystemBaseTest.java
    hadoop/core/trunk/src/test/org/apache/hadoop/io/TestSequenceFile.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/BigMapOutput.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MRBench.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MRCaching.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/NotificationTestCase.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/PiEstimator.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/SortValidator.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestCollect.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestComparators.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestEmptyJobWithDFS.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestFieldSelection.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMapOutputType.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMapRed.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRClasspath.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRLocalFS.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRTaskTempDir.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMultiFileInputFormat.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestRackAwareTaskPlacement.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileAsBinaryInputFormat.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileAsTextInputFormat.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileInputFilter.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSequenceFileInputFormat.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSpecialCharactersInOutputPath.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestTextInputFormat.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/ThreadedMapBenchmark.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/jobcontrol/JobControlTestUtils.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/join/TestDatamerge.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/lib/aggregate/TestAggregates.java
    hadoop/core/trunk/src/test/org/apache/hadoop/record/TestRecordMR.java
    hadoop/core/trunk/src/test/org/apache/hadoop/record/TestRecordWritable.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Mon Mar 10 11:53:58 2008
@@ -26,6 +26,10 @@
     HADOOP-1986.  Add support for a general serialization mechanism for
     Map Reduce. (tomwhite)
 
+    HADOOP-771. FileSystem.delete() takes an explicit parameter that
+    specifies whether a recursive delete is intended.
+    (Mahadev Konar via dhruba)
+
   NEW FEATURES
 
     HADOOP-1398.  Add HBase in-memory block cache.  (tomwhite)

Modified: hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Grep.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Grep.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Grep.java (original)
+++ hadoop/core/trunk/src/examples/org/apache/hadoop/examples/Grep.java Mon Mar 10 11:53:58 2008
@@ -84,7 +84,7 @@
       JobClient.runJob(sortJob);
     }
     finally {
-      FileSystem.get(grepJob).delete(tempDir);
+      FileSystem.get(grepJob).delete(tempDir, true);
     }
     return 0;
   }

Modified: hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java (original)
+++ hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java Mon Mar 10 11:53:58 2008
@@ -183,7 +183,7 @@
     Path inDir = new Path(tmpDir, "in");
     Path outDir = new Path(tmpDir, "out");
     FileSystem fileSys = FileSystem.get(jobConf);
-    fileSys.delete(tmpDir);
+    fileSys.delete(tmpDir, true);
     if (!fileSys.mkdirs(inDir)) {
       throw new IOException("Mkdirs failed to create " + inDir.toString());
     }
@@ -219,7 +219,7 @@
       reader.close();
       estimate = (numInside.get()*4.0)/(numMaps*numPoints);
     } finally {
-      fileSys.delete(tmpDir);
+      fileSys.delete(tmpDir, true);
     }
     
     return estimate;

Modified: hadoop/core/trunk/src/examples/org/apache/hadoop/examples/SleepJob.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/examples/org/apache/hadoop/examples/SleepJob.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/examples/org/apache/hadoop/examples/SleepJob.java (original)
+++ hadoop/core/trunk/src/examples/org/apache/hadoop/examples/SleepJob.java Mon Mar 10 11:53:58 2008
@@ -155,7 +155,7 @@
       JobClient.runJob(job);
     } 
     finally {
-      fs.delete(tempPath);
+      fs.delete(tempPath, true);
     }
     return 0;
   }

Modified: hadoop/core/trunk/src/examples/org/apache/hadoop/examples/dancing/DistributedPentomino.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/examples/org/apache/hadoop/examples/dancing/DistributedPentomino.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/examples/org/apache/hadoop/examples/dancing/DistributedPentomino.java (original)
+++ hadoop/core/trunk/src/examples/org/apache/hadoop/examples/dancing/DistributedPentomino.java Mon Mar 10 11:53:58 2008
@@ -199,7 +199,7 @@
       
       JobClient.runJob(conf);
       } finally {
-      fileSys.delete(input);
+      fileSys.delete(input, true);
     }
     return 0;
   }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java Mon Mar 10 11:53:58 2008
@@ -1452,7 +1452,7 @@
     } finally {
       IOUtils.closeStream(out); 
       try {
-        fs.delete(BALANCER_ID_PATH);
+        fs.delete(BALANCER_ID_PATH, true);
       } catch(IOException ignored) {
       }
       System.out.println("Balancing took " + 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/ClientProtocol.java Mon Mar 10 11:53:58 2008
@@ -37,8 +37,9 @@
    * (Only the latest change is reflected.
    * The log of historical changes can be retrieved from the svn).
    * 25 : added {@link #getContentSummary(String path)}
+   * 26 : added delete(src, boolean) for recursive deletes on the namenode
    */
-  public static final long versionID = 25L;
+  public static final long versionID = 26L;
   
   ///////////////////////////////////////
   // File contents
@@ -236,6 +237,19 @@
    */
   public boolean delete(String src) throws IOException;
 
+  /**
+   * Delete the given file or directory from the file system.
+   * <p>
+   * same as delete but provides a way to avoid accidentally 
+   * deleting non empty directories programmatically. 
+   * @param src existing name
+   * @param recursive if true deletes a non empty directory recursively,
+   * else throws an exception.
+   * @return true only if the existing file or directory was actually removed 
+   * from the file system. 
+   */
+  public boolean delete(String src, boolean recursive) throws IOException;
+  
   /**
    * Check whether the given file exists.
    */

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java Mon Mar 10 11:53:58 2008
@@ -438,11 +438,22 @@
    * Delete file or directory.
    * See {@link ClientProtocol#delete(String)}. 
    */
+  @Deprecated
   public boolean delete(String src) throws IOException {
     checkOpen();
-    return namenode.delete(src);
+    return namenode.delete(src, true);
   }
 
+  /**
+   * delete file or directory.
+   * delete contents of the directory if non empty and recursive 
+   * set to true
+   */
+  public boolean delete(String src, boolean recursive) throws IOException {
+    checkOpen();
+    return namenode.delete(src, recursive);
+  }
+  
   /**
    */
   public boolean exists(String src) throws IOException {

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DistributedFileSystem.java Mon Mar 10 11:53:58 2008
@@ -166,10 +166,19 @@
   /**
    * Get rid of Path f, whether a true file or dir.
    */
+  @Deprecated
   public boolean delete(Path f) throws IOException {
     return dfs.delete(getPathName(f));
   }
-
+  
+  /**
+   * requires a boolean check to delete a non 
+   * empty directory recursively.
+   */
+  public boolean delete(Path f, boolean recursive) throws IOException {
+   return dfs.delete(getPathName(f), recursive);
+  }
+  
   public boolean exists(Path f) throws IOException {
     return dfs.exists(getPathName(f));
   }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSDirectory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSDirectory.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSDirectory.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSDirectory.java Mon Mar 10 11:53:58 2008
@@ -453,7 +453,22 @@
     }
     return deletedNode;
   }
-
+  
+  /** Return if a directory is empty or not **/
+  public boolean isDirEmpty(String src) {
+	boolean dirNotEmpty = true;
+    if (!isDir(src)) {
+      return true;
+    }
+    synchronized(rootDir) {
+      INode targetNode = rootDir.getNode(src);
+      if (((INodeDirectory)targetNode).getChildren().size() != 0) {
+        dirNotEmpty = false;
+      }
+    }
+    return dirNotEmpty;
+  }
+  
   /**
    */
   INode unprotectedDelete(String src, long modificationTime, 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Mon Mar 10 11:53:58 2008
@@ -1458,12 +1458,24 @@
    * Remove the indicated filename from the namespace.  This may
    * invalidate some blocks that make up the file.
    */
+  @Deprecated
   public boolean delete(String src) throws IOException {
-    boolean status = deleteInternal(src, true, true);
-    getEditLog().logSync();
-    return status;
+    return delete(src, true);
   }
 
+  /**
+   * Remove the indicated filename from namespace. If the filename 
+   * is a directory (non empty) and recursive is set to false then throw exception.
+   */
+    public boolean delete(String src, boolean recursive) throws IOException {
+      if (isDir(src) && (!recursive) && (!dir.isDirEmpty(src))) {
+        throw new IOException(src + " is non empty");
+      }
+      boolean status = deleteInternal(src, true, true);
+      getEditLog().logSync();
+      return status;
+    }
+    
   /**
    * An internal delete function that does not enforce safe mode
    */

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/HftpFileSystem.java Mon Mar 10 11:53:58 2008
@@ -255,10 +255,19 @@
   }
 
   @Override
+  /*
+   * @deprecated Use delete(path, boolean)
+   */
+  @Deprecated
   public boolean delete(Path f) throws IOException {
     throw new IOException("Not supported");
   }
-
+  
+  @Override 
+  public boolean delete(Path f, boolean recursive) throws IOException {
+    throw new IOException("Not supported");
+  }
+  
   @Override
   public boolean mkdirs(Path f, FsPermission permission) throws IOException {
     throw new IOException("Not supported");

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java Mon Mar 10 11:53:58 2008
@@ -385,11 +385,16 @@
 
   /**
    */
+  @Deprecated
   public boolean delete(String src) throws IOException {
     stateChangeLog.debug("*DIR* NameNode.delete: " + src);
     return namesystem.delete(src);
   }
 
+  public boolean delete(String src, boolean recursive) throws IOException {
+    stateChangeLog.debug("*DIR* Namenode.delete:  " + src);
+    return namesystem.delete(src, recursive);
+  }
   /**
    */
   public boolean exists(String src) throws IOException {

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java Mon Mar 10 11:53:58 2008
@@ -323,7 +323,7 @@
       }
       if (fos != null) fos.close();
       LOG.warn("\n - moved corrupted file " + file.getPath() + " to /lost+found");
-      dfs.delete(file.getPath().toString());
+      dfs.delete(file.getPath().toString(), true);
     }  catch (Exception e) {
       e.printStackTrace();
       LOG.warn(errmsg + ": " + e.getMessage());

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java Mon Mar 10 11:53:58 2008
@@ -239,7 +239,7 @@
         synchronized (lcacheStatus) {
           if (lcacheStatus.refcount == 0) {
             // delete this cache entry
-            FileSystem.getLocal(conf).delete(lcacheStatus.localLoadPath);
+            FileSystem.getLocal(conf).delete(lcacheStatus.localLoadPath, true);
             it.remove();
           }
         }
@@ -314,7 +314,7 @@
                               + " is in use and cannot be refreshed");
       
       FileSystem localFs = FileSystem.getLocal(conf);
-      localFs.delete(cacheStatus.localLoadPath);
+      localFs.delete(cacheStatus.localLoadPath, true);
       Path parchive = new Path(cacheStatus.localLoadPath,
                                new Path(cacheStatus.localLoadPath.getName()));
       
@@ -779,7 +779,7 @@
       FileSystem localFs = FileSystem.getLocal(conf);
       for (Map.Entry<String,CacheStatus> f: cachedArchives.entrySet()) {
         try {
-          localFs.delete(f.getValue().localLoadPath);
+          localFs.delete(f.getValue().localLoadPath, true);
         } catch (IOException ie) {
           LOG.debug("Error cleaning up cache", ie);
         }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/ChecksumFileSystem.java Mon Mar 10 11:53:58 2008
@@ -413,14 +413,14 @@
    */
   public boolean delete(Path f) throws IOException {
     if (fs.isDirectory(f)) {
-      return fs.delete(f);
+      return fs.delete(f, true);
     } else {
       Path checkFile = getChecksumFile(f);
       if (fs.exists(checkFile)) {
-        fs.delete(checkFile);
+        fs.delete(checkFile, true);
       }
 
-      return fs.delete(f);
+      return fs.delete(f, true);
     }
   }
 
@@ -508,7 +508,7 @@
       }
       dst = getChecksumFile(dst);
       if (localFs.exists(dst)) { //remove old local checksum file
-        localFs.delete(dst);
+        localFs.delete(dst, true);
       }
       Path checksumFile = getChecksumFile(src);
       if (copyCrc && fs.exists(checksumFile)) { //copy checksum file

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Mon Mar 10 11:53:58 2008
@@ -531,9 +531,21 @@
    */
   public abstract boolean rename(Path src, Path dst) throws IOException;
     
-  /** Delete a file */
+  /** Delete a file. */
+  /** @deprecated Use delete(Path, boolean) instead */ @Deprecated 
   public abstract boolean delete(Path f) throws IOException;
-    
+  
+  /** Delete a file.
+   *
+   * @param f the path to delete.
+   * @param recursive if path is a directory and set to 
+   * true, the directory is deleted else throws an exception. In
+   * case of a file the recursive can be set to either true or false. 
+   * @return  true if delete is successful else false. 
+   * @throws IOException
+   */
+  public abstract boolean delete(Path f, boolean recursive) throws IOException;
+  
   /** Check if exists.
    * @param f source file
    */

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileUtil.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileUtil.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileUtil.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileUtil.java Mon Mar 10 11:53:58 2008
@@ -93,13 +93,13 @@
     if (paths != null) {
       for (Path p : paths) {
         if (fs.isFile(p))  {
-          fs.delete(p);
+          fs.delete(p, true);
         } else {
           fullyDelete(fs, p);
         }
       }
     }
-    fs.delete(dir);
+    fs.delete(dir, true);
   }
 
   //
@@ -159,7 +159,7 @@
       throw new IOException(src.toString() + ": No such file or directory");
     }
     if (deleteSource) {
-      return srcFS.delete(src);
+      return srcFS.delete(src, true);
     } else {
       return true;
     }
@@ -199,7 +199,7 @@
     
 
     if (deleteSource) {
-      return srcFS.delete(srcDir);
+      return srcFS.delete(srcDir, true);
     } else {
       return true;
     }
@@ -256,7 +256,7 @@
                             ": No such file or directory");
     }
     if (deleteSource) {
-      return srcFS.delete(src);
+      return srcFS.delete(src, true);
     } else {
       return true;
     }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FilterFileSystem.java Mon Mar 10 11:53:58 2008
@@ -135,9 +135,14 @@
     return fs.rename(src, dst);
   }
   
-  /** Delete a file */
+  /** Delete a file */@Deprecated
   public boolean delete(Path f) throws IOException {
     return fs.delete(f);
+  }
+  
+  /** Delete a file */
+  public boolean delete(Path f, boolean recursive) throws IOException {
+    return fs.delete(f, recursive);
   }
   
   /** Check if exists.

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java Mon Mar 10 11:53:58 2008
@@ -1047,7 +1047,7 @@
       System.out.println("Moved to trash: " + src);
       return;
     }
-    if (srcFs.delete(src)) {
+    if (srcFs.delete(src, true)) {
       System.out.println("Deleted " + src);
     } else {
       if (!srcFs.exists(src)) {

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/InMemoryFileSystem.java Mon Mar 10 11:53:58 2008
@@ -245,8 +245,13 @@
         return true;
       }
     }
-
+    
+    @Deprecated
     public boolean delete(Path f) throws IOException {
+      return delete(f, true);
+    }
+    
+    public boolean delete(Path f, boolean recursive) throws IOException {
       synchronized (this) {
         FileAttributes fAttr = pathToFileAttribs.remove(getPath(f));
         if (fAttr != null) {

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java Mon Mar 10 11:53:58 2008
@@ -211,11 +211,20 @@
     return FileUtil.copy(this, src, this, dst, true, getConf());
   }
   
+  @Deprecated
   public boolean delete(Path p) throws IOException {
+    return delete(p, true);
+  }
+  
+  public boolean delete(Path p, boolean recursive) throws IOException {
     File f = pathToFile(p);
     if (f.isFile()) {
       return f.delete();
-    } else return FileUtil.fullyDelete(f);
+    } else if ((!recursive) && f.isDirectory() && 
+        (f.listFiles().length != 0)) {
+      throw new IOException("Directory " + f.toString() + " is not empty");
+    }
+    return FileUtil.fullyDelete(f);
   }
   
   public boolean exists(Path f) throws IOException {

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/Trash.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/Trash.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/Trash.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/Trash.java Mon Mar 10 11:53:58 2008
@@ -161,7 +161,7 @@
       }
 
       if ((now - interval) > time) {
-        if (fs.delete(path)) {
+        if (fs.delete(path, true)) {
           LOG.info("Deleted trash checkpoint: "+dir);
         } else {
           LOG.warn("Couldn't delete checkpoint: "+dir+" Ignoring.");

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/kfs/KosmosFileSystem.java Mon Mar 10 11:53:58 2008
@@ -294,22 +294,31 @@
     }
 
     // recursively delete the directory and its contents
-    public boolean delete(Path path) throws IOException {
-	Path absolute = makeAbsolute(path);
-        String srep = absolute.toUri().getPath();
-
-        if (kfsImpl.isFile(srep))
-            return kfsImpl.remove(srep) == 0;
+    public boolean delete(Path path, boolean recursive) throws IOException {
+      Path absolute = makeAbsolute(path);
+      String srep = absolute.toUri().getPath();
+      if (kfsImpl.isFile(srep))
+        return kfsImpl.remove(srep) == 0;
 
-        Path[] dirEntries = listPaths(absolute);
-        if (dirEntries != null) {
-            for (int i = 0; i < dirEntries.length; i++) {
-                delete(new Path(absolute, dirEntries[i]));
-            }
+      Path[] dirEntries = listPaths(absolute);
+      if ((!recursive) && (dirEntries != null) && 
+            (dirEntries.length != 0)) {
+        throw new IOException("Directory " + path.toString() + 
+        " is not empty.");
+      }
+      if (dirEntries != null) {
+        for (int i = 0; i < dirEntries.length; i++) {
+          delete(new Path(absolute, dirEntries[i]), recursive);
         }
-        return kfsImpl.rmdir(srep) == 0;
+      }
+      return kfsImpl.rmdir(srep) == 0;
     }
-
+    
+    @Deprecated
+    public boolean delete(Path path) throws IOException {
+      return delete(path, true);
+    }
+    
     @Deprecated
     public long getLength(Path path) throws IOException {
 	Path absolute = makeAbsolute(path);

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/s3/S3FileSystem.java Mon Mar 10 11:53:58 2008
@@ -265,31 +265,40 @@
     return true;
   }
 
+  public boolean delete(Path path, boolean recursive) throws IOException {
+   Path absolutePath = makeAbsolute(path);
+   INode inode = store.retrieveINode(absolutePath);
+   if (inode == null) {
+     return false;
+   }
+   if (inode.isFile()) {
+     store.deleteINode(absolutePath);
+     for (Block block: inode.getBlocks()) {
+       store.deleteBlock(block);
+     }
+   } else {
+     Path[] contents = listPaths(absolutePath);
+     if (contents == null) {
+       return false;
+     }
+     if ((contents.length !=0) && (!recursive)) {
+       throw new IOException("Directory " + path.toString() 
+           + " is not empty.");
+     }
+     for (Path p:contents) {
+       if (!delete(p, recursive)) {
+         return false;
+       }
+     }
+     store.deleteINode(absolutePath);
+   }
+   return true;
+  }
+  
   @Override
+  @Deprecated
   public boolean delete(Path path) throws IOException {
-    Path absolutePath = makeAbsolute(path);
-    INode inode = store.retrieveINode(absolutePath);
-    if (inode == null) {
-      return false;
-    }
-    if (inode.isFile()) {
-      store.deleteINode(absolutePath);
-      for (Block block : inode.getBlocks()) {
-        store.deleteBlock(block);
-      }
-    } else {
-      Path[] contents = listPaths(absolutePath);
-      if (contents == null) {
-        return false;
-      }
-      for (Path p : contents) {
-        if (!delete(p)) {
-          return false;
-        }
-      }
-      store.deleteINode(absolutePath);
-    }
-    return true;
+    return delete(path, true);
   }
 
   /**

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/io/MapFile.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/io/MapFile.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/io/MapFile.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/io/MapFile.java Mon Mar 10 11:53:58 2008
@@ -561,9 +561,9 @@
     Path data = new Path(dir, DATA_FILE_NAME);
     Path index = new Path(dir, INDEX_FILE_NAME);
 
-    fs.delete(data);
-    fs.delete(index);
-    fs.delete(dir);
+    fs.delete(data, true);
+    fs.delete(index, true);
+    fs.delete(dir, true);
   }
 
   /**

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/io/SequenceFile.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/io/SequenceFile.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/io/SequenceFile.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/io/SequenceFile.java Mon Mar 10 11:53:58 2008
@@ -2340,7 +2340,7 @@
             if (recordLength == -1) {
               in.close();
               if (deleteInput) {
-                fs.delete(inFiles[currentFile]);
+                fs.delete(inFiles[currentFile], true);
               }
               currentFile += 1;
               atEof = currentFile >= inFiles.length;
@@ -3034,7 +3034,7 @@
       public void cleanup() throws IOException {
         close();
         if (!preserveInput) {
-          fs.delete(segmentPathName);
+          fs.delete(segmentPathName, true);
         }
       }
     } // SequenceFile.Sorter.SegmentDescriptor
@@ -3092,7 +3092,7 @@
                                                     segmentLength, segmentName, this));
         }
         fsIndexIn.close();
-        fs.delete(indexIn);
+        fs.delete(indexIn, true);
         numSegmentsContained = segments.size();
         this.inName = inName;
       }
@@ -3103,7 +3103,7 @@
       public void cleanup() throws IOException {
         numSegmentsCleanedUp++;
         if (numSegmentsCleanedUp == numSegmentsContained) {
-          fs.delete(inName);
+          fs.delete(inName, true);
         }
       }
     } //SequenceFile.Sorter.SegmentContainer

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/CompletedJobStatusStore.java Mon Mar 10 11:53:58 2008
@@ -105,7 +105,7 @@
         try {
           FileStatus status = fs.getFileStatus(jobInfo);
           if ((currentTime - status.getModificationTime()) > retainTime) {
-            fs.delete(jobInfo);
+            fs.delete(jobInfo, true);
           }
         }
         catch (IOException ie) {
@@ -153,7 +153,7 @@
         LOG.warn("Could not store [" + jobId + "] job info : " +
                  ex.getMessage(), ex);
         try {
-          fs.delete(jobStatusFile);
+          fs.delete(jobStatusFile, true);
         }
         catch (IOException ex1) {
           //ignore

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java Mon Mar 10 11:53:58 2008
@@ -485,7 +485,7 @@
     Path submitJobDir = new Path(job.getSystemDir(), jobId);
     FileSystem fs = getFs();
     LOG.debug("default FileSystem: " + fs.getUri());
-    fs.delete(submitJobDir);    
+    fs.delete(submitJobDir, true);    
     FileSystem.mkdirs(fs, submitJobDir, new FsPermission(SYSTEM_DIR_PERMISSION));
     Path submitJobFile = new Path(submitJobDir, "job.xml");
     Path submitJarFile = new Path(submitJobDir, "job.jar");

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java Mon Mar 10 11:53:58 2008
@@ -1255,23 +1255,23 @@
     try {
       // Definitely remove the local-disk copy of the job file
       if (localJobFile != null) {
-        localFs.delete(localJobFile);
+        localFs.delete(localJobFile, true);
         localJobFile = null;
       }
       if (localJarFile != null) {
-        localFs.delete(localJarFile);
+        localFs.delete(localJarFile, true);
         localJarFile = null;
       }
 
       // JobClient always creates a new directory with job files
       // so we remove that directory to cleanup
       FileSystem fs = FileSystem.get(conf);
-      fs.delete(new Path(profile.getJobFile()).getParent());
+      fs.delete(new Path(profile.getJobFile()).getParent(), true);
         
       // Delete temp dfs dirs created if any, like in case of 
       // speculative exn of reduces.  
       Path tempDir = new Path(conf.getSystemDir(), jobId); 
-      fs.delete(tempDir); 
+      fs.delete(tempDir, true); 
 
       // delete the temporary directory in output directory
       Path outputPath = conf.getOutputPath();

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Mon Mar 10 11:53:58 2008
@@ -703,7 +703,7 @@
         }
         // clean up the system dir, which will only work if hdfs is out of 
         // safe mode
-        fs.delete(systemDir);
+        fs.delete(systemDir, true);
         if (FileSystem.mkdirs(fs, systemDir, 
             new FsPermission(JobClient.SYSTEM_DIR_PERMISSION))) {
           break;

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java Mon Mar 10 11:53:58 2008
@@ -226,8 +226,8 @@
 
       } finally {
         try {
-          fs.delete(file.getParent());  // delete submit dir
-          localFs.delete(localFile);              // delete local copy
+          fs.delete(file.getParent(), true);  // delete submit dir
+          localFs.delete(localFile, true);              // delete local copy
         } catch (IOException e) {
           LOG.warn("Error cleaning up "+id+": "+e);
         }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapOutputLocation.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapOutputLocation.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapOutputLocation.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapOutputLocation.java Mon Mar 10 11:53:58 2008
@@ -160,7 +160,7 @@
     } finally {
       if (!good) {
         try {
-          fileSys.delete(localFilename);
+          fileSys.delete(localFilename, true);
           totalBytes = 0;
         } catch (Throwable th) {
           // IGNORED because we are cleaning up
@@ -264,7 +264,7 @@
     } finally {
       if (!good) {
         try {
-          fileSys.delete(localFilename);
+          fileSys.delete(localFilename, true);
           totalBytes = 0;
         } catch (Throwable th) {
           // IGNORED because we are cleaning up

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapTask.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapTask.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapTask.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/MapTask.java Mon Mar 10 11:53:58 2008
@@ -671,8 +671,8 @@
         finalIndexOut.close();
         //cleanup
         for(int i = 0; i < numSpills; i++) {
-          localFs.delete(filename[i]);
-          localFs.delete(indexFileName[i]);
+          localFs.delete(filename[i], true);
+          localFs.delete(indexFileName[i], true);
         }
       }
     }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/PhasedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/PhasedFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/PhasedFileSystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/PhasedFileSystem.java Mon Mar 10 11:53:58 2008
@@ -104,7 +104,7 @@
           // ignore if already closed
         }
         if (fs.exists(fInfo.getTempPath())){
-          fs.delete(fInfo.getTempPath());
+          fs.delete(fInfo.getTempPath(), true);
         }
         finalNameToFileInfo.remove(finalFile); 
       }
@@ -166,23 +166,23 @@
         }
         
         if (fs.exists(fPath) && fInfo.isOverwrite()){
-          fs.delete(fPath); 
+          fs.delete(fPath, true); 
         }
         
         try {
           if (!fs.rename(fInfo.getTempPath(), fPath)){
             // delete the temp file if rename failed
-            fs.delete(fInfo.getTempPath());
+            fs.delete(fInfo.getTempPath(), true);
           }
         }catch(IOException ioe){
           // rename failed, log error and delete temp files
           LOG.error("PhasedFileSystem failed to commit file : " + fPath 
                     + " error : " + ioe.getMessage()); 
-          fs.delete(fInfo.getTempPath());
+          fs.delete(fInfo.getTempPath(), true);
         }
       }else{
         // delete temp file
-        fs.delete(fInfo.getTempPath());
+        fs.delete(fInfo.getTempPath(), true);
       }
       // done with the file
       if (removeFromMap){
@@ -224,7 +224,7 @@
       }catch(IOException ioe){
         // ignore if already closed
       }
-      fs.delete(fInfo.getTempPath()); 
+      fs.delete(fInfo.getTempPath(), true); 
       if (removeFromMap){
         finalNameToFileInfo.remove(p);
       }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ReduceTask.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ReduceTask.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ReduceTask.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/ReduceTask.java Mon Mar 10 11:53:58 2008
@@ -791,7 +791,7 @@
         if (!neededOutputs.contains(loc.getMapId())) {
           if (tmpFilename != null) {
             FileSystem fs = tmpFilename.getFileSystem(conf);
-            fs.delete(tmpFilename);
+            fs.delete(tmpFilename, true);
           }
           return CopyResult.OBSOLETE;
         }
@@ -805,7 +805,7 @@
         // lock the ReduceTask while we do the rename
         synchronized (ReduceTask.this) {
           if (!neededOutputs.contains(loc.getMapId())) {
-            fs.delete(tmpFilename);
+            fs.delete(tmpFilename, true);
             return CopyResult.OBSOLETE;
           }
           
@@ -816,7 +816,7 @@
           // if we can't rename the file, something is broken (and IOException
           // will be thrown). 
           if (!fs.rename(tmpFilename, filename)) {
-            fs.delete(tmpFilename);
+            fs.delete(tmpFilename, true);
             bytes = -1;
             throw new IOException("failure to rename map output " + 
                                   tmpFilename);
@@ -1340,7 +1340,7 @@
               //make sure that we delete the ondisk file that we created earlier
               //when we invoked cloneFileAttributes
               writer.close();
-              localFileSys.delete(inMemClosedFiles[0]);
+              localFileSys.delete(inMemClosedFiles[0], true);
               throw new IOException (StringUtils.stringifyException(e));
             }
             sorter.writeFile(rIter, writer);
@@ -1599,7 +1599,7 @@
               //make sure that we delete the ondisk file that we created 
               //earlier when we invoked cloneFileAttributes
               writer.close();
-              localFileSys.delete(outputPath);
+              localFileSys.delete(outputPath, true);
               throw new IOException (StringUtils.stringifyException(e));
             }
             sorter.writeFile(rIter, writer);

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/Task.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/Task.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/Task.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/Task.java Mon Mar 10 11:53:58 2008
@@ -439,7 +439,7 @@
         moveTaskOutputs(fs, jobOutputPath, taskOutputPath);
 
         // Delete the temporary task-specific output directory
-        if (!fs.delete(taskOutputPath)) {
+        if (!fs.delete(taskOutputPath, true)) {
           LOG.info("Failed to delete the temporary output directory of task: " + 
                   getTaskId() + " - " + taskOutputPath);
         }
@@ -463,7 +463,7 @@
     if (fs.isFile(taskOutput)) {
       Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput);
       if (!fs.rename(taskOutput, finalOutputPath)) {
-        if (!fs.delete(finalOutputPath)) {
+        if (!fs.delete(finalOutputPath, true)) {
           throw new IOException("Failed to delete earlier output of task: " + 
                   getTaskId());
         }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java Mon Mar 10 11:53:58 2008
@@ -171,7 +171,7 @@
         }
         Path localTaskFile = new Path(t.getJobFile());
         FileSystem localFs = FileSystem.getLocal(conf);
-        localFs.delete(localTaskFile);
+        localFs.delete(localTaskFile, true);
         OutputStream out = localFs.create(localTaskFile);
         try {
           conf.write(out);

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Mon Mar 10 11:53:58 2008
@@ -656,7 +656,7 @@
         // we should clean up and then try again
         Path jobDir = localJobFile.getParent();
         if (localFs.exists(jobDir)){
-          localFs.delete(jobDir);
+          localFs.delete(jobDir, true);
           boolean b = localFs.mkdirs(jobDir);
           if (!b)
             throw new IOException("Not able to create job directory "

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/util/CopyFiles.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/util/CopyFiles.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/util/CopyFiles.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/util/CopyFiles.java Mon Mar 10 11:53:58 2008
@@ -350,7 +350,7 @@
     private void rename(FileSystem fs, Path tmp, Path dst) throws IOException {
       try {
         if (fs.exists(dst)) {
-          fs.delete(dst);
+          fs.delete(dst, true);
         }
         fs.rename(tmp, dst);
       }
@@ -413,7 +413,7 @@
         try {
           for (int i = 0; i < 3; ++i) {
             try {
-              if (destFileSys.delete(dstpath))
+              if (destFileSys.delete(dstpath, true))
                 break;
             } catch (Throwable ex) {
               // ignore, we are just cleaning up

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/BenchmarkThroughput.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/BenchmarkThroughput.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/BenchmarkThroughput.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/BenchmarkThroughput.java Mon Mar 10 11:53:58 2008
@@ -152,7 +152,7 @@
     } finally {
       try {
         if (f != null) {
-          fs.delete(f);
+          fs.delete(f, true);
         }
       } catch (IOException ie) {
         // IGNORE
@@ -216,7 +216,7 @@
       if (cluster != null) {
         cluster.shutdown();
         // clean up minidfs junk
-        rawLocal.delete(new Path(localDir, "dfs"));
+        rawLocal.delete(new Path(localDir, "dfs"), true);
       }
     }
     return 0;

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java Mon Mar 10 11:53:58 2008
@@ -336,7 +336,7 @@
         li = testfilesList.listIterator();
         while (li.hasNext()) {
           testFileName = (UTF8) li.next();
-          assertTrue(dfsClient.delete(testFileName.toString()));
+          assertTrue(dfsClient.delete(testFileName.toString(), true));
         }
 
         //

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java Mon Mar 10 11:53:58 2008
@@ -175,7 +175,7 @@
     
       // delete the file
       try {
-        dfsClient.delete("/data/yy");
+        dfsClient.delete("/data/yy", true);
         assertDelete("/data/yy", false);
       } catch(IOException ioe) {
         ioe.printStackTrace();
@@ -191,7 +191,7 @@
       }
 
       try {
-        dfsClient.delete("/data/xx");
+        dfsClient.delete("/data/xx", true);
         assertDelete("/data/xx", true);
       } catch(IOException ioe) {
     	ioe.printStackTrace();

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DFSTestUtil.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DFSTestUtil.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DFSTestUtil.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DFSTestUtil.java Mon Mar 10 11:53:58 2008
@@ -211,7 +211,7 @@
   /** delete directory and everything underneath it.*/
   void cleanup(FileSystem fs, String topdir) throws IOException {
     Path root = new Path(topdir);
-    fs.delete(root);
+    fs.delete(root, true);
     files = null;
   }
   

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBench.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBench.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBench.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBench.java Mon Mar 10 11:53:58 2008
@@ -123,10 +123,10 @@
     // Delete the data directory only if it is the create/write operation
     if (operation.equals(OP_CREATE_WRITE)) {
       LOG.info("Deleting data directory");
-      tempFS.delete(new Path(baseDir, DATA_DIR_NAME));
+      tempFS.delete(new Path(baseDir, DATA_DIR_NAME), true);
     }
-    tempFS.delete(new Path(baseDir, CONTROL_DIR_NAME));
-    tempFS.delete(new Path(baseDir, OUTPUT_DIR_NAME));
+    tempFS.delete(new Path(baseDir, CONTROL_DIR_NAME), true);
+    tempFS.delete(new Path(baseDir, OUTPUT_DIR_NAME), true);
   }
   
   /**
@@ -871,7 +871,7 @@
           try {
             // Set up timer for measuring AL
             startTimeAL = System.currentTimeMillis();
-            filesystem.delete(filePath);
+            filesystem.delete(filePath, true);
             totalTimeAL1 += (System.currentTimeMillis() - startTimeAL);
             
             successfulOp = true;

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBenchWithoutMR.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBenchWithoutMR.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBenchWithoutMR.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNBenchWithoutMR.java Mon Mar 10 11:53:58 2008
@@ -208,7 +208,7 @@
       int singleFileExceptions = 0;
       do { // delete file until is succeeds
         try {
-          boolean result = fileSys.delete(new Path(taskDir, "A" + index));
+          boolean result = fileSys.delete(new Path(taskDir, "A" + index), true);
           success = true;
         } catch (IOException ioe) { 
           success=false; 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNThroughputBenchmark.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNThroughputBenchmark.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNThroughputBenchmark.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/NNThroughputBenchmark.java Mon Mar 10 11:53:58 2008
@@ -211,7 +211,7 @@
 
     void cleanUp() throws IOException {
       nameNode.setSafeMode(FSConstants.SafeModeAction.SAFEMODE_LEAVE);
-      nameNode.delete(getBaseDir());
+      nameNode.delete(getBaseDir(), true);
     }
 
     int getNumOpsExecuted() {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestCheckpoint.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestCheckpoint.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestCheckpoint.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestCheckpoint.java Mon Mar 10 11:53:58 2008
@@ -61,7 +61,7 @@
   private void cleanupFile(FileSystem fileSys, Path name)
     throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSMkdirs.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSMkdirs.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSMkdirs.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSMkdirs.java Mon Mar 10 11:53:58 2008
@@ -66,7 +66,7 @@
       }
       assertFalse(exist);
       assertFalse(fileSys.exists(myIllegalPath));
-      fileSys.delete(myFile);
+      fileSys.delete(myFile, true);
     	
     } finally {
       fileSys.close();

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSPermission.java Mon Mar 10 11:53:58 2008
@@ -207,7 +207,7 @@
     } finally {
       // delete the file
       if (delete) {
-        fs.delete(name);
+        fs.delete(name, true);
       }
     }
   }
@@ -278,7 +278,7 @@
 
     // delete the file/directory
     login(SUPERUSER);
-    fs.delete(FILE_DIR_PATH);
+    fs.delete(FILE_DIR_PATH, true);
   }
 
   /* Return the group owner of the file/directory */
@@ -596,7 +596,7 @@
     void call() throws IOException {
       create(opType, path);
       if (cleanup) {
-        fs.delete(path);
+        fs.delete(path, true);
       }
     }
   }
@@ -849,7 +849,7 @@
 
     @Override
     void call() throws IOException {
-      fs.delete(path);
+      fs.delete(path, true);
     }
   }
 
@@ -954,7 +954,7 @@
       checkNoPermissionDeny(e);
     }
     try {
-      fs.delete(NON_EXISTENT_FILE);
+      fs.delete(NON_EXISTENT_FILE, true);
     } catch (IOException e) {
       checkNoPermissionDeny(e);
     }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java Mon Mar 10 11:53:58 2008
@@ -108,7 +108,33 @@
       cluster.shutdown();
     }
   }
-
+  
+  public void testRecrusiveRm() throws IOException {
+	  Configuration conf = new Configuration();
+	  MiniDFSCluster cluster = new MiniDFSCluster(conf, 2, true, null);
+	  FileSystem fs = cluster.getFileSystem();
+	  assertTrue("Not a HDFS: " + fs.getUri(), 
+			  fs instanceof DistributedFileSystem);
+	  try {
+      fs.mkdirs(new Path(new Path("parent"), "child"));
+      try {
+        fs.delete(new Path("parent"), false);
+        assert(false); // should never reach here.
+      } catch(IOException e) {
+         //should have thrown an exception
+      }
+      try {
+        fs.delete(new Path("parent"), true);
+      } catch(IOException e) {
+        assert(false);
+      }
+    } finally {  
+      try { fs.close();}catch(IOException e){};
+      cluster.shutdown();
+    }
+  }
+    
+  
   public void testPut() throws IOException {
     Configuration conf = new Configuration();
     MiniDFSCluster cluster = new MiniDFSCluster(conf, 2, true, null);
@@ -372,8 +398,8 @@
       ret = ToolRunner.run(shell, argv);
       assertTrue(" cat is working ", (ret == 0));
       //check chown
-      dstFs.delete(new Path("/furi"));
-      dstFs.delete(new Path("/hadoopdir"));
+      dstFs.delete(new Path("/furi"), true);
+      dstFs.delete(new Path("/hadoopdir"), true);
       String file = "/tmp/chownTest";
       Path path = new Path(file);
       Path parent = new Path("/tmp");
@@ -613,7 +639,7 @@
     try {
      //first make dir
      Path dir = new Path(chmodDir);
-     fs.delete(dir);
+     fs.delete(dir, true);
      fs.mkdirs(dir);
 
      runCmd(shell, "-chmod", "u+rwx,g=rw,o-rwx", chmodDir);
@@ -636,7 +662,7 @@
      assertEquals("rw-rw-rw-",
                   fs.getFileStatus(file).getPermission().toString());
      
-     fs.delete(dir);     
+     fs.delete(dir, true);     
     } finally {
       try {
         fs.close();
@@ -775,7 +801,7 @@
         }
         assertTrue(val == 0);
       }
-      fileSys.delete(myFile2);
+      fileSys.delete(myFile2, true);
 
       // Verify that we can get with and without crc
       {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java Mon Mar 10 11:53:58 2008
@@ -105,7 +105,7 @@
                                      shell.getConf());
       assertTrue("Directory does not get created", 
                  fs.isDirectory(new Path("/data")));
-      fs.delete(new Path("/data"));
+      fs.delete(new Path("/data"), true);
     } catch (Exception e) {
       System.err.println(e.getMessage());
       e.printStackTrace();

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDecommission.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDecommission.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDecommission.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDecommission.java Mon Mar 10 11:53:58 2008
@@ -54,7 +54,7 @@
 
     // delete if it already exists
     if (fs.exists(name)) {
-      fs.delete(name);
+      fs.delete(name, true);
     }
 
     FSDataOutputStream stm = fs.create(name);
@@ -150,7 +150,7 @@
   
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSInputChecker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSInputChecker.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSInputChecker.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSInputChecker.java Mon Mar 10 11:53:58 2008
@@ -191,7 +191,7 @@
 
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
   

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSOutputSummer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSOutputSummer.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSOutputSummer.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFSOutputSummer.java Mon Mar 10 11:53:58 2008
@@ -102,7 +102,7 @@
 
   private void cleanupFile(Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
   

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileCorruption.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileCorruption.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileCorruption.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileCorruption.java Mon Mar 10 11:53:58 2008
@@ -91,6 +91,6 @@
     } catch (ChecksumException ignore) {
       //expect this exception but let any NPE get thrown
     }
-    fs.delete(file);
+    fs.delete(file, true);
   }
 }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileLimit.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileLimit.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileLimit.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestFileLimit.java Mon Mar 10 11:53:58 2008
@@ -132,7 +132,7 @@
 
       // delete one file
       Path file0 = new Path("/filestatus0");
-      fs.delete(file0);
+      fs.delete(file0, true);
       System.out.println("Deleted file " + file0);
       currentNodes -= 2;
 
@@ -146,7 +146,7 @@
 
       // delete the file again
       file0 = new Path("/filestatus0");
-      fs.delete(file0);
+      fs.delete(file0, true);
       System.out.println("Deleted file " + file0 + " again.");
       currentNodes -= 2;
 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestLocalDFS.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestLocalDFS.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestLocalDFS.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestLocalDFS.java Mon Mar 10 11:53:58 2008
@@ -45,7 +45,7 @@
   
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
   
@@ -62,7 +62,7 @@
       Path file1 = new Path("somewhat/random.txt");
       writeFile(fileSys, file1);
       assertTrue(fileSys.exists(new Path(orig_path, file1.toString())));
-      fileSys.delete(file1);
+      fileSys.delete(file1, true);
       Path subdir1 = new Path("/somewhere");
       fileSys.setWorkingDirectory(subdir1);
       writeFile(fileSys, file1);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestModTime.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestModTime.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestModTime.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestModTime.java Mon Mar 10 11:53:58 2008
@@ -58,7 +58,7 @@
   
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
 
@@ -154,7 +154,7 @@
      // delete newfile
      //
      System.out.println("Deleting testdir2/testnew.dat.");
-     assertTrue(fileSys.delete(newfile));
+     assertTrue(fileSys.delete(newfile, true));
      //
      // verify that modification time of testdir1 has not changed.
      //

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestPread.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestPread.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestPread.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestPread.java Mon Mar 10 11:53:58 2008
@@ -52,7 +52,7 @@
     }
     assertTrue("Error reading beyond file boundary.", res != null);
     in.close();
-    if (!fileSys.delete(name))
+    if (!fileSys.delete(name, true))
       assertTrue("Cannot delete file", false);
     
     // now create the real file
@@ -153,7 +153,7 @@
   
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    assertTrue(fileSys.delete(name));
+    assertTrue(fileSys.delete(name, true));
     assertTrue(!fileSys.exists(name));
   }
   

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java Mon Mar 10 11:53:58 2008
@@ -124,7 +124,7 @@
   
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
   

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSeekBug.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSeekBug.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSeekBug.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSeekBug.java Mon Mar 10 11:53:58 2008
@@ -113,7 +113,7 @@
   
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
   

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSmallBlock.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSmallBlock.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSmallBlock.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestSmallBlock.java Mon Mar 10 11:53:58 2008
@@ -79,7 +79,7 @@
   
   private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
     assertTrue(fileSys.exists(name));
-    fileSys.delete(name);
+    fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
   

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/DFSCIOTest.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/DFSCIOTest.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/DFSCIOTest.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/DFSCIOTest.java Mon Mar 10 11:53:58 2008
@@ -116,7 +116,7 @@
                                         ) throws IOException {
     LOG.info("creating control file: "+fileSize+" mega bytes, "+nrFiles+" files");
 
-    fs.delete(CONTROL_DIR);
+    fs.delete(CONTROL_DIR, true);
 
     for(int i=0; i < nrFiles; i++) {
       String name = getFileName(i);
@@ -204,7 +204,7 @@
           
         // copy the dso and executable from dfs and chmod them
         synchronized (this) {
-          localFS.delete(HDFS_TEST_DIR);
+          localFS.delete(HDFS_TEST_DIR, true);
           if (!(localFS.mkdirs(HDFS_TEST_DIR))) {
             throw new IOException("Failed to create " +	HDFS_TEST_DIR + " on local filesystem");
           }
@@ -256,8 +256,8 @@
   private static void writeTest(FileSystem fs)
     throws IOException {
 
-    fs.delete(DATA_DIR);
-    fs.delete(WRITE_DIR);
+    fs.delete(DATA_DIR, true);
+    fs.delete(WRITE_DIR, true);
     
     runIOTest(WriteMapper.class, WRITE_DIR);
   }
@@ -304,7 +304,7 @@
         
         // copy the dso and executable from dfs
         synchronized (this) {
-          localFS.delete(HDFS_TEST_DIR);
+          localFS.delete(HDFS_TEST_DIR, true);
           if (!(localFS.mkdirs(HDFS_TEST_DIR))) {
             throw new IOException("Failed to create " +	HDFS_TEST_DIR + " on local filesystem");
           }
@@ -361,7 +361,7 @@
   }
 
   private static void readTest(FileSystem fs) throws IOException {
-    fs.delete(READ_DIR);
+    fs.delete(READ_DIR, true);
     runIOTest(ReadMapper.class, READ_DIR);
   }
 
@@ -429,7 +429,7 @@
       FileSystem fs = FileSystem.get(fsConfig);
       
       if (testType != TEST_TYPE_CLEANUP) {
-        fs.delete(HDFS_TEST_DIR);
+        fs.delete(HDFS_TEST_DIR, true);
         if (!fs.mkdirs(HDFS_TEST_DIR)) {
           throw new IOException("Mkdirs failed to create " + 
                                 HDFS_TEST_DIR.toString());
@@ -532,7 +532,7 @@
 
   private static void cleanup(FileSystem fs) throws Exception {
     LOG.info("Cleaning up test files");
-    fs.delete(new Path(TEST_ROOT_DIR));
-    fs.delete(HDFS_TEST_DIR);
+    fs.delete(new Path(TEST_ROOT_DIR), true);
+    fs.delete(HDFS_TEST_DIR, true);
   }
 }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/DistributedFSCheck.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/DistributedFSCheck.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/DistributedFSCheck.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/DistributedFSCheck.java Mon Mar 10 11:53:58 2008
@@ -326,6 +326,6 @@
 
   private void cleanup() throws IOException {
     LOG.info("Cleaning up test files");
-    fs.delete(TEST_ROOT_DIR);
+    fs.delete(TEST_ROOT_DIR, true);
   }
 }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java Mon Mar 10 11:53:58 2008
@@ -208,7 +208,7 @@
     Configuration conf = new Configuration();
     FileSystem fs = FileSystem.getNamed(fsname, conf);
     Path root = new Path(topdir);
-    fs.delete(root);
+    fs.delete(root, true);
   }
   
   /** copy files from local file system to local file system */

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestDFSIO.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestDFSIO.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestDFSIO.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestDFSIO.java Mon Mar 10 11:53:58 2008
@@ -111,7 +111,7 @@
                                         ) throws IOException {
     LOG.info("creating control file: "+fileSize+" mega bytes, "+nrFiles+" files");
 
-    fs.delete(CONTROL_DIR);
+    fs.delete(CONTROL_DIR, true);
 
     for(int i=0; i < nrFiles; i++) {
       String name = getFileName(i);
@@ -212,8 +212,8 @@
   private static void writeTest(FileSystem fs)
     throws IOException {
 
-    fs.delete(DATA_DIR);
-    fs.delete(WRITE_DIR);
+    fs.delete(DATA_DIR, true);
+    fs.delete(WRITE_DIR, true);
     
     runIOTest(WriteMapper.class, WRITE_DIR);
   }
@@ -269,7 +269,7 @@
   }
 
   private static void readTest(FileSystem fs) throws IOException {
-    fs.delete(READ_DIR);
+    fs.delete(READ_DIR, true);
     runIOTest(ReadMapper.class, READ_DIR);
   }
 
@@ -425,6 +425,6 @@
 
   private static void cleanup(FileSystem fs) throws IOException {
     LOG.info("Cleaning up test files");
-    fs.delete(new Path(TEST_ROOT_DIR));
+    fs.delete(new Path(TEST_ROOT_DIR), true);
   }
 }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestFileSystem.java Mon Mar 10 11:53:58 2008
@@ -77,10 +77,10 @@
     writeTest(fs, false);
     readTest(fs, false);
     seekTest(fs, false);
-    fs.delete(CONTROL_DIR);
-    fs.delete(DATA_DIR);
-    fs.delete(WRITE_DIR);
-    fs.delete(READ_DIR);
+    fs.delete(CONTROL_DIR, true);
+    fs.delete(DATA_DIR, true);
+    fs.delete(WRITE_DIR, true);
+    fs.delete(READ_DIR, true);
   }
 
   public static void createControlFile(FileSystem fs,
@@ -90,7 +90,7 @@
     LOG.info("creating control file: "+megaBytes+" bytes, "+numFiles+" files");
 
     Path controlFile = new Path(CONTROL_DIR, "files");
-    fs.delete(controlFile);
+    fs.delete(controlFile, true);
     Random random = new Random(seed);
 
     SequenceFile.Writer writer =
@@ -197,8 +197,8 @@
   public static void writeTest(FileSystem fs, boolean fastCheck)
     throws Exception {
 
-    fs.delete(DATA_DIR);
-    fs.delete(WRITE_DIR);
+    fs.delete(DATA_DIR, true);
+    fs.delete(WRITE_DIR, true);
     
     JobConf job = new JobConf(conf, TestFileSystem.class);
     job.setBoolean("fs.test.fastCheck", fastCheck);
@@ -295,7 +295,7 @@
   public static void readTest(FileSystem fs, boolean fastCheck)
     throws Exception {
 
-    fs.delete(READ_DIR);
+    fs.delete(READ_DIR, true);
 
     JobConf job = new JobConf(conf, TestFileSystem.class);
     job.setBoolean("fs.test.fastCheck", fastCheck);
@@ -392,7 +392,7 @@
   public static void seekTest(FileSystem fs, boolean fastCheck)
     throws Exception {
 
-    fs.delete(READ_DIR);
+    fs.delete(READ_DIR, true);
 
     JobConf job = new JobConf(conf, TestFileSystem.class);
     job.setBoolean("fs.test.fastCheck", fastCheck);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java Mon Mar 10 11:53:58 2008
@@ -345,7 +345,7 @@
   }
   
   private void cleanupDFS() throws IOException {
-    fs.delete(new Path("/user"));
+    fs.delete(new Path("/user"), true);
   }
   
 }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystem.java Mon Mar 10 11:53:58 2008
@@ -37,7 +37,7 @@
   
   private void cleanupFile(FileSystem fs, Path name) throws IOException {
     assertTrue(fs.exists(name));
-    fs.delete(name);
+    fs.delete(name, true);
     assertTrue(!fs.exists(name));
   }
   
@@ -64,7 +64,7 @@
       assertTrue(fileSys.isDirectory(dir1));
       
       // delete the directory and make sure it went away
-      fileSys.delete(dir1);
+      fileSys.delete(dir1, true);
       assertTrue(!fileSys.exists(dir1));
       
       // create files and manipulate them.
@@ -92,7 +92,7 @@
       stm.close();
     } finally {
       fileSys.setWorkingDirectory(origDir);
-      fileSys.delete(subdir);
+      fileSys.delete(subdir, true);
     }
   }
 
@@ -113,7 +113,7 @@
     Path tmp = new Path(src, dst.getName());
     assertTrue(fs.exists(tmp) && fs.exists(dst));
     assertTrue(FileUtil.copy(fs, dst, fs, src, false, true, conf));
-    assertTrue(fs.delete(tmp));
+    assertTrue(fs.delete(tmp, true));
     fs.mkdirs(tmp);
     try {
       FileUtil.copy(fs, dst, fs, src, true, true, conf);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystemPermission.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystemPermission.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystemPermission.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestLocalFileSystemPermission.java Mon Mar 10 11:53:58 2008
@@ -56,7 +56,7 @@
 
   private void cleanupFile(FileSystem fs, Path name) throws IOException {
     assertTrue(fs.exists(name));
-    fs.delete(name);
+    fs.delete(name, true);
     assertTrue(!fs.exists(name));
   }
 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java Mon Mar 10 11:53:58 2008
@@ -98,14 +98,14 @@
         if (isDirectory(path)) {
             // the directory better be empty
             String[] dirEntries = readdir(path);
-            if ((dirEntries.length <= 2) && (localFS.delete(new Path(path))))
+            if ((dirEntries.length <= 2) && (localFS.delete(new Path(path), true)))
                 return 0;
         }
         return -1;
     }
 
     public int remove(String path) throws IOException {
-        if (isFile(path) && (localFS.delete(new Path(path))))
+        if (isFile(path) && (localFS.delete(new Path(path), true)))
             return 0;
         return -1;
     }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java?rev=635650&r1=635649&r2=635650&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java Mon Mar 10 11:53:58 2008
@@ -73,7 +73,7 @@
         Path[] p = kosmosFileSystem.listPaths(baseDir);
         assertEquals(p.length, 1);
 
-        kosmosFileSystem.delete(baseDir);
+        kosmosFileSystem.delete(baseDir, true);
         assertFalse(kosmosFileSystem.exists(baseDir));
     }
 
@@ -100,15 +100,15 @@
         Path[] p = kosmosFileSystem.listPaths(subDir1);
         assertEquals(p.length, 2);
 
-        kosmosFileSystem.delete(file1);
+        kosmosFileSystem.delete(file1, true);
         p = kosmosFileSystem.listPaths(subDir1);
         assertEquals(p.length, 1);
 
-        kosmosFileSystem.delete(file2);
+        kosmosFileSystem.delete(file2, true);
         p = kosmosFileSystem.listPaths(subDir1);
         assertEquals(p, null);
 
-        kosmosFileSystem.delete(baseDir);
+        kosmosFileSystem.delete(baseDir, true);
         assertFalse(kosmosFileSystem.exists(baseDir));
     }
 
@@ -158,11 +158,11 @@
 
         s2.close();
 
-        kosmosFileSystem.delete(file1);
+        kosmosFileSystem.delete(file1, true);
         assertFalse(kosmosFileSystem.exists(file1));        
-        kosmosFileSystem.delete(subDir1);
+        kosmosFileSystem.delete(subDir1, true);
         assertFalse(kosmosFileSystem.exists(subDir1));        
-        kosmosFileSystem.delete(baseDir);
+        kosmosFileSystem.delete(baseDir, true);
         assertFalse(kosmosFileSystem.exists(baseDir));        
     }
     



Mime
View raw message