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 om...@apache.org on 2011/03/04 05:47:05 UTC

svn commit: r1077711 - /hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java

Author: omalley
Date: Fri Mar  4 04:47:04 2011
New Revision: 1077711

URL: http://svn.apache.org/viewvc?rev=1077711&view=rev
Log:
commit 04e76d4c09950795f3953b32d56d712214da0f63
Author: Owen O'Malley <om...@apache.org>
Date:   Mon Sep 20 09:32:55 2010 -0700

    correct the relative paths so that the private dc is cleaned up correctly.

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java?rev=1077711&r1=1077710&r2=1077711&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java Fri Mar  4 04:47:04 2011
@@ -303,24 +303,20 @@ public class TrackerDistributedCacheMana
         Path potentialDeletee = lcacheStatus.localizedLoadPath;
         Path localizedDir = lcacheStatus.getLocalizedUniqueDir();
         if (lcacheStatus.user == null) {
-
-          localFs.delete(potentialDeletee, true);
-
-          // Update the maps baseDirSize and baseDirNumberSubDir
-          LOG.info("Deleted path " + potentialDeletee);
-
+          LOG.info("Deleted path " + localizedDir);
           try {
             localFs.delete(localizedDir, true);
           } catch (IOException e) {
             LOG.warn("Could not delete distributed cache empty directory "
-                     + localizedDir);
+                     + localizedDir, e);
           }
-        } else {
-          int userDir = TaskTracker.getUserDir(lcacheStatus.user).length();
-          taskController.deleteAsUser(lcacheStatus.user,
-                                      potentialDeletee.toString().substring(userDir));
-          taskController.deleteAsUser(lcacheStatus.user,
-                                      localizedDir.toString().substring(userDir));          
+        } else {         
+          LOG.info("Deleted path " + localizedDir + " as " + lcacheStatus.user);
+          String base = lcacheStatus.getBaseDir().toString();
+          String userDir = TaskTracker.getUserDir(lcacheStatus.user);
+          int skip = base.length() + 1 + userDir.length() + 1;
+          String relative = localizedDir.toString().substring(skip);
+          taskController.deleteAsUser(lcacheStatus.user, relative);
         }
         deleteCacheInfoUpdate(lcacheStatus);
       }