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/11/02 05:28:47 UTC
svn commit: r470226 - in /lucene/hadoop/trunk: CHANGES.txt
src/java/org/apache/hadoop/filecache/DistributedCache.java
Author: cutting
Date: Wed Nov 1 20:28:46 2006
New Revision: 470226
URL: http://svn.apache.org/viewvc?view=rev&rev=470226
Log:
HADOOP-671. Fix file cache to check for pre-existence before creating symlinks. Contributed by Mahadev.
Modified:
lucene/hadoop/trunk/CHANGES.txt
lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java
Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=470226&r1=470225&r2=470226
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Nov 1 20:28:46 2006
@@ -137,6 +137,9 @@
38. HADOOP-647. Permit map outputs to use a different compression
type than the job output. (omalley via cutting)
+39. HADOOP-671. File cache should not create symlinks when they
+ already exist. (Mahadev Konar via cutting)
+
Release 0.7.2 - 2006-10-18
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java?view=diff&rev=470226&r1=470225&r2=470226
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java Wed Nov 1 20:28:46 2006
@@ -164,19 +164,23 @@
boolean doSymlink = getSymlink(conf);
FileSystem dfs = getFileSystem(cache, conf);
b = ifExistsAndFresh(cacheStatus, cache, dfs, md5, conf);
+ String link = currentWorkDir.toString() + Path.SEPARATOR + cache.getFragment();
+ File flink = new File(link);
if (b) {
if (isArchive) {
- if (doSymlink)
- FileUtil.symLink(cacheStatus.localLoadPath.toString(),
- currentWorkDir.toString() + Path.SEPARATOR + cache.getFragment());
-
+ if (doSymlink){
+ if (!flink.exists())
+ FileUtil.symLink(cacheStatus.localLoadPath.toString(),
+ link);
+ }
return cacheStatus.localLoadPath;
}
else {
- if (doSymlink)
- FileUtil.symLink(cacheFilePath(cacheStatus.localLoadPath).toString(),
- currentWorkDir.toString() + Path.SEPARATOR + cache.getFragment());
-
+ if (doSymlink){
+ if (!flink.exists())
+ FileUtil.symLink(cacheFilePath(cacheStatus.localLoadPath).toString(),
+ link);
+ }
return cacheFilePath(cacheStatus.localLoadPath);
}
} else {
@@ -219,16 +223,21 @@
cacheStatus.currentStatus = true;
cacheStatus.md5 = checkSum;
}
+
if (isArchive){
- if (doSymlink)
- FileUtil.symLink(cacheStatus.localLoadPath.toString(),
- currentWorkDir.toString() + Path.SEPARATOR + cache.getFragment());
+ if (doSymlink){
+ if (!flink.exists())
+ FileUtil.symLink(cacheStatus.localLoadPath.toString(),
+ link);
+ }
return cacheStatus.localLoadPath;
}
else {
- if (doSymlink)
- FileUtil.symLink(cacheFilePath(cacheStatus.localLoadPath).toString(),
- currentWorkDir.toString() + Path.SEPARATOR + cache.getFragment());
+ if (doSymlink){
+ if (!flink.exists())
+ FileUtil.symLink(cacheFilePath(cacheStatus.localLoadPath).toString(),
+ link);
+ }
return cacheFilePath(cacheStatus.localLoadPath);
}
}