Author: omalley
Date: Tue Aug 12 14:26:52 2008
New Revision: 685322
URL: http://svn.apache.org/viewvc?rev=685322&view=rev
Log:
HADOOP-3202. Use recursive delete rather than FileUtil.fullyDelete.
(Amareshwari Sriramadasu via omalley)
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestUlimit.java
hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java
hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/LocalJobRunner.java
hadoop/core/trunk/src/test/org/apache/hadoop/mapred/pipes/TestPipes.java
hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java
Modified: hadoop/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=685322&r1=685321&r2=685322&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Aug 12 14:26:52 2008
@@ -163,6 +163,9 @@
HADOOP-9. Use roulette scheduling for temporary space when the size
is not known. (Ari Rabkin via omalley)
+ HADOOP-3202. Use recursive delete rather than FileUtil.fullyDelete.
+ (Amareshwari Sriramadasu via omalley)
+
OPTIMIZATIONS
HADOOP-3556. Removed lock contention in MD5Hash by changing the
Modified:
hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestUlimit.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestUlimit.java?rev=685322&r1=685321&r2=685322&view=diff
==============================================================================
---
hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestUlimit.java
(original)
+++
hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestUlimit.java
Tue Aug 12 14:26:52 2008
@@ -20,16 +20,12 @@
import java.io.*;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.MiniMRCluster;
import org.apache.hadoop.mapred.TestMiniMRWithDFS;
-import org.apache.hadoop.util.*;
import junit.framework.TestCase;
@@ -88,7 +84,7 @@
writeInputFile(fs, inputPath);
map = StreamUtil.makeJavaCommand(UlimitApp.class, new String[]{});
runProgram(SET_MEMORY_LIMIT);
- FileUtil.fullyDelete(fs, outputPath);
+ fs.delete(outputPath, true);
assertFalse("output not cleaned up", fs.exists(outputPath));
mr.waitUntilIdle();
} catch(IOException e) {
Modified: hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java?rev=685322&r1=685321&r2=685322&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/fs/FileUtil.java Tue Aug 12
14:26:52 2008
@@ -103,19 +103,11 @@
* @param fs [EMAIL PROTECTED] FileSystem} on which the path is present
* @param dir directory to recursively delete
* @throws IOException
+ * @deprecated Use [EMAIL PROTECTED] FileSystem#delete(Path, boolean)}
*/
+ @Deprecated
public static void fullyDelete(FileSystem fs, Path dir)
throws IOException {
- FileStatus[] paths = fs.listStatus(dir);
- if (paths != null) {
- for (FileStatus p : paths) {
- if (!p.isDir()) {
- fs.delete(p.getPath(), true);
- } else {
- fullyDelete(fs, p.getPath());
- }
- }
- }
fs.delete(dir, true);
}
Modified:
hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/LocalJobRunner.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/LocalJobRunner.java?rev=685322&r1=685321&r2=685322&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/LocalJobRunner.java
(original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/LocalJobRunner.java
Tue Aug 12 14:26:52 2008
@@ -25,7 +25,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.DataOutputBuffer;
@@ -217,7 +216,7 @@
try {
if (outputFs != null) {
if (outputFs.exists(tmpDir)) {
- FileUtil.fullyDelete(outputFs, tmpDir);
+ outputFs.delete(tmpDir, true);
}
}
} catch (IOException e) {
Modified:
hadoop/core/trunk/src/test/org/apache/hadoop/mapred/pipes/TestPipes.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/pipes/TestPipes.java?rev=685322&r1=685321&r2=685322&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/pipes/TestPipes.java
(original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/pipes/TestPipes.java
Tue Aug 12 14:26:52 2008
@@ -46,7 +46,7 @@
LogFactory.getLog(TestPipes.class.getName());
static void cleanup(FileSystem fs, Path p) throws IOException {
- FileUtil.fullyDelete(fs, p);
+ fs.delete(p, true);
assertFalse("output not cleaned up", fs.exists(p));
}
@@ -142,7 +142,7 @@
job.setNumReduceTasks(numReduces);
{
FileSystem fs = dfs.getFileSystem();
- FileUtil.fullyDelete(fs, wordExec.getParent());
+ fs.delete(wordExec.getParent(), true);
fs.copyFromLocalFile(program, wordExec);
Submitter.setExecutable(job, fs.makeQualified(wordExec).toString());
Submitter.setIsJavaRecordReader(job, true);
@@ -187,7 +187,7 @@
Path jobXml = new Path(testDir, "job.xml");
{
FileSystem fs = dfs.getFileSystem();
- FileUtil.fullyDelete(fs, wordExec.getParent());
+ fs.delete(wordExec.getParent(), true);
fs.copyFromLocalFile(program, wordExec);
}
DataOutputStream out = local.create(new Path(inDir, "part0"));
@@ -197,7 +197,7 @@
out = local.create(new Path(inDir, "part1"));
out.writeBytes("all silly things drink java\n");
out.close();
- FileUtil.fullyDelete(local, outDir);
+ local.delete(outDir, true);
local.mkdirs(outDir);
out = local.create(jobXml);
job.write(out);
Modified: hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java?rev=685322&r1=685321&r2=685322&view=diff
==============================================================================
--- hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java (original)
+++ hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java Tue Aug 12
14:26:52 2008
@@ -836,7 +836,7 @@
static void fullyDelete(String dir, Configuration conf) throws IOException {
if (dir != null) {
Path tmp = new Path(dir);
- FileUtil.fullyDelete(tmp.getFileSystem(conf), tmp);
+ tmp.getFileSystem(conf).delete(tmp, true);
}
}