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 2007/06/20 21:23:33 UTC
svn commit: r549200 - in /lucene/hadoop/trunk: CHANGES.txt
src/java/org/apache/hadoop/filecache/DistributedCache.java
src/java/org/apache/hadoop/mapred/TaskTracker.java
Author: cutting
Date: Wed Jun 20 12:23:33 2007
New Revision: 549200
URL: http://svn.apache.org/viewvc?view=rev&rev=549200
Log:
Clear tasktracker's file cache before it re-initializes, to avoid confusion. Contributed by Owen.
Modified:
lucene/hadoop/trunk/CHANGES.txt
lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java
lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=549200&r1=549199&r2=549200
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Jun 20 12:23:33 2007
@@ -182,6 +182,9 @@
56. HADOOP-1207. Fix FsShell's 'rm' command to not stop when one of
the named files does not exist. (Tsz Wo Sze via cutting)
+ 57. HADOOP-1475. Clear tasktracker's file cache before it
+ re-initializes, to avoid confusion. (omalley via cutting)
+
Release 0.13.0 - 2007-06-08
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=549200&r1=549199&r2=549200
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java Wed Jun 20 12:23:33 2007
@@ -40,6 +40,8 @@
private static TreeMap<String, CacheStatus> cachedArchives = new TreeMap<String, CacheStatus>();
// buffer size for reading checksum files
private static final int CRC_BUFFER_SIZE = 64 * 1024;
+ private static final Log LOG =
+ LogFactory.getLog(DistributedCache.class);
/**
*
@@ -679,4 +681,22 @@
public byte[] md5;
}
+ /**
+ * Clear the entire contents of the cache and delete the backing files. This
+ * should only be used when the server is reinitializing, because the users
+ * are going to lose their files.
+ */
+ public static void purgeCache(Configuration conf) throws IOException {
+ synchronized (cachedArchives) {
+ FileSystem localFs = FileSystem.getLocal(conf);
+ for (Map.Entry<String,CacheStatus> f: cachedArchives.entrySet()) {
+ try {
+ localFs.delete(f.getValue().localLoadPath);
+ } catch (IOException ie) {
+ LOG.debug("Error cleaning up cache", ie);
+ }
+ }
+ cachedArchives.clear();
+ }
+ }
}
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?view=diff&rev=549200&r1=549199&r2=549200
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Wed Jun 20 12:23:33 2007
@@ -45,6 +45,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.filecache.DistributedCache;
import org.apache.hadoop.fs.DF;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSError;
@@ -349,6 +350,7 @@
LOG.info("Starting tracker " + taskTrackerName);
// Clear out temporary files that might be lying around
+ DistributedCache.purgeCache(this.fConf);
this.mapOutputFile.cleanupStorage();
this.justStarted = true;