Repository: storm
Updated Branches:
  refs/heads/master 367464a3d -> a726589d8


STORM-1629 Files/move doesn't work properly with non-empty directory in Windows

* Use FileUtils/moveDirectory on Windows
  * It copies whole contents inside directory, and delete directory
* Keep using Files/move on non-Windows
  * it's still better option since doesn't require copying contents inside 
directory


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/02f9308d
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/02f9308d
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/02f9308d

Branch: refs/heads/master
Commit: 02f9308d80da67b6da634b96a08e169268bd9262
Parents: 1a0ed9a
Author: Jungtaek Lim <[email protected]>
Authored: Wed Mar 16 00:06:58 2016 +0900
Committer: Jungtaek Lim <[email protected]>
Committed: Wed Mar 16 00:06:58 2016 +0900

----------------------------------------------------------------------
 storm-core/src/clj/org/apache/storm/daemon/supervisor.clj | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/02f9308d/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj 
b/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
index fd8f6c9..498e10a 100644
--- a/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
+++ b/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj
@@ -1060,9 +1060,13 @@
     (if (download-blobs-for-topology-succeed? 
(ConfigUtils/supervisorStormConfPath tmproot) tmproot)
       (do
         (log-message "Successfully downloaded blob resources for storm-id " 
storm-id)
-        (FileUtils/forceMkdir (File. stormroot))
-        (Files/move (.toPath (File. tmproot)) (.toPath (File. stormroot))
-          (doto (make-array StandardCopyOption 1) (aset 0 
StandardCopyOption/ATOMIC_MOVE)))
+        (if (Utils/isOnWindows)
+          ; Files/move with non-empty directory doesn't work well on Windows
+          (FileUtils/moveDirectory (File. tmproot) (File. stormroot))
+          (do
+            (FileUtils/forceMkdir (File. stormroot))
+            (Files/move (.toPath (File. tmproot)) (.toPath (File. stormroot))
+                        (doto (make-array StandardCopyOption 1) (aset 0 
StandardCopyOption/ATOMIC_MOVE)))))
         (setup-storm-code-dir conf (clojurify-structure 
(ConfigUtils/readSupervisorStormConf conf storm-id)) stormroot))
       (do
         (log-message "Failed to download blob resources for storm-id " 
storm-id)

Reply via email to