Browse Source

commit 04e76d4c09950795f3953b32d56d712214da0f63
Author: Owen O'Malley <omalley@apache.org>
Date: Mon Sep 20 09:32:55 2010 -0700

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


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

Owen O'Malley 14 năm trước cách đây
mục cha
commit
61e424c383

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

@@ -303,24 +303,20 @@ public class TrackerDistributedCacheManager {
         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);
       }