This is an automated email from the ASF dual-hosted git repository.

ethanli pushed a commit to branch 2.1.x-branch
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/2.1.x-branch by this push:
     new 6dbb5b5  STORM-3524 create complete blobstore path in case parent 
directory ge… (#3144)
6dbb5b5 is described below

commit 6dbb5b597ca1afa91edfaefaea74c01f1caa654b
Author: agresch <[email protected]>
AuthorDate: Thu Oct 17 13:47:46 2019 -0500

    STORM-3524 create complete blobstore path in case parent directory ge… 
(#3144)
    
    * STORM-3524 create complete blobstore path in case parent directory gets 
deleted
---
 .../java/org/apache/storm/localizer/LocalizedResource.java   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java 
b/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java
index ea3bdac..6bea6b1 100644
--- 
a/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java
+++ 
b/storm-server/src/main/java/org/apache/storm/localizer/LocalizedResource.java
@@ -143,6 +143,9 @@ public class LocalizedResource extends LocallyCachedBlob {
     }
 
     static void completelyRemoveUnusedUser(Path localBaseDir, String user) 
throws IOException {
+        Path localUserDir = getLocalUserDir(localBaseDir, user);
+        LOG.info("completelyRemoveUnusedUser {} for directory {}", user, 
localUserDir);
+
         Path userFileCacheDir = getLocalUserFileCacheDir(localBaseDir, user);
         // baseDir/supervisor/usercache/user1/filecache/files
         Files.deleteIfExists(getCacheDirForFiles(userFileCacheDir));
@@ -151,7 +154,7 @@ public class LocalizedResource extends LocallyCachedBlob {
         // baseDir/supervisor/usercache/user1/filecache
         Files.deleteIfExists(userFileCacheDir);
         // baseDir/supervisor/usercache/user1
-        Files.deleteIfExists(getLocalUserDir(localBaseDir, user));
+        Files.deleteIfExists(localUserDir);
     }
 
     static List<String> getLocalizedArchiveKeys(Path localBaseDir, String 
user) throws IOException {
@@ -254,9 +257,12 @@ public class LocalizedResource extends LocallyCachedBlob {
                 if (!Files.exists(parent)) {
                     //There is a race here that we can still lose
                     try {
-                        Files.createDirectory(parent);
+                        Files.createDirectories(parent);
                     } catch (FileAlreadyExistsException e) {
                         //Ignored
+                    } catch (IOException e) {
+                        LOG.error("Failed to create parent directory {}", 
parent, e);
+                        throw e;
                     }
                 }
                 return path;
@@ -397,7 +403,7 @@ public class LocalizedResource extends LocallyCachedBlob {
                 }
             }
         } catch (NoSuchFileException e) {
-            LOG.warn("Nothing to cleanup with badeDir {} even though we 
expected there to be something there", baseDir);
+            LOG.warn("Nothing to cleanup with baseDir {} even though we 
expected there to be something there", baseDir);
         }
     }
 

Reply via email to