Gargi-jais11 commented on code in PR #9515:
URL: https://github.com/apache/ozone/pull/9515#discussion_r2652675030


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -458,8 +507,8 @@ public BackgroundTaskResult call() {
       container.readLock();
       try {
         // Step 1: Copy container to new Volume's tmp Dir
-        diskBalancerTmpDir = destVolume.getTmpDir().toPath()
-            .resolve(DISK_BALANCER_DIR).resolve(String.valueOf(containerId));
+        diskBalancerTmpDir = getDiskBalancerTmpDir(destVolume)
+            .resolve(String.valueOf(containerId));

Review Comment:
   I checked this part and found that Yes, `FileUtils.copyDirectory()` 
definitely creates parent directories if they don't exist. This is the official 
java doc link 
https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#copyDirectory(java.io.File,java.io.File,boolean).
   
   But still we need **constructTmpDir** as it serves one important purpose: 
**cleanup** - it deletes old diskBalancer directories on startup to prevent 
stale data. Here we can rename it as CleanupTmpDir and we can avoid the complex 
**checkTmpDirExists()** logic. We can remove constructTmpDir and do **Lazy 
initialization: Only creates directories when actually needed** and just keep 
the cleanup logic instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to