Bläddra i källkod

commit a82eac90ab2d252f1a4b7b1266f6531085838e81
Author: Arun C Murthy <acmurthy@apache.org>
Date: Fri Jul 2 16:49:11 2010 -0700

MAPREDUCE-1914. Ensure unique sub-directories for artifacts in the DistributedCache are cleaned up. Dick King.

+++ b/YAHOO-CHANGES.txt
+ MAPREDUCE-1914. Ensure unique sub-directories for artifacts in the
+ DistributedCache are cleaned up. (Dick King via acmurthy)
+


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077567 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 år sedan
förälder
incheckning
de74a75b36

+ 13 - 2
src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java

@@ -276,10 +276,21 @@ public class TrackerDistributedCacheManager {
     // do the deletion, after releasing the global lock
     for (CacheStatus lcacheStatus : deleteList) {
       synchronized (lcacheStatus) {
-        FileSystem.getLocal(conf).delete(lcacheStatus.localizedLoadPath, true);
+        FileSystem localFS = FileSystem.getLocal(conf);
+
+        Path potentialDeletee = lcacheStatus.localizedLoadPath;
+
+        localFS.delete(potentialDeletee, true);
 
         // Update the maps baseDirSize and baseDirNumberSubDir
-        LOG.info("Deleted path " + lcacheStatus.localizedLoadPath);
+        LOG.info("Deleted path " + potentialDeletee);
+
+        try {
+          localFS.delete(lcacheStatus.getLocalizedUniqueDir(), true);
+        } catch (IOException e) {
+          LOG.warn("Could not delete distributed cache empty directory "
+                   + lcacheStatus.getLocalizedUniqueDir());
+        }
 
         deleteCacheInfoUpdate(lcacheStatus);
       }

+ 1 - 1
src/test/org/apache/hadoop/filecache/TestTrackerDistributedCacheManager.java

@@ -492,7 +492,7 @@ public class TestTrackerDistributedCacheManager extends TestCase {
     conf2.set("user.name", userName);
 
     // We first test the size limit
-    Path localCache = manager.getLocalCache(firstCacheFile.toUri(), conf2, 
+    Path firstLocalCache = manager.getLocalCache(firstCacheFile.toUri(), conf2, 
         TaskTracker.getPrivateDistributedCacheDir(userName),
         fs.getFileStatus(firstCacheFile), false,
         now, new Path(TEST_ROOT_DIR), false, false);