You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2006/06/07 21:35:47 UTC
svn commit: r412496 - in /lucene/hadoop/trunk: CHANGES.txt
src/java/org/apache/hadoop/fs/FileSystem.java
src/java/org/apache/hadoop/fs/LocalFileSystem.java
Author: cutting
Date: Wed Jun 7 12:35:46 2006
New Revision: 412496
URL: http://svn.apache.org/viewvc?rev=412496&view=rev
Log:
HADOOP-277. Fix a race condition when creating directories.
Modified:
lucene/hadoop/trunk/CHANGES.txt
lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java
Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=412496&r1=412495&r2=412496&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Jun 7 12:35:46 2006
@@ -20,6 +20,9 @@
5. HADOOP-285. Fix DFS datanodes to be able to re-join the cluster
after the connection to the namenode is lost. (omalley via cutting)
+ 6. HADOOP-277. Fix a race condition when creating directories.
+ (Sameer Paranjpye via cutting)
+
Release 0.3.1 - 2006-06-05
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?rev=412496&r1=412495&r2=412496&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Wed Jun 7 12:35:46 2006
@@ -459,7 +459,8 @@
/**
* Make the given file and all non-existent parents into
- * directories.
+ * directories. Has the semantics of Unix 'mkdir -p'.
+ * Existence of the directory hierarchy is not an error.
*/
public abstract boolean mkdirs(Path f) throws IOException;
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java?rev=412496&r1=412495&r2=412496&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/LocalFileSystem.java Wed Jun 7 12:35:46 2006
@@ -223,11 +223,18 @@
}
return results;
}
-
+
+ /**
+ * Creates the specified directory hierarchy. Does not
+ * treat existence as an error.
+ */
public boolean mkdirs(Path f) throws IOException {
- return pathToFile(f).mkdirs();
+ Path parent = f.getParent();
+ File p2f = pathToFile(f);
+ return (parent == null || mkdirs(parent)) &&
+ (p2f.mkdir() || p2f.isDirectory());
}
-
+
/**
* Set the working directory to the given directory.
*/