chungen0126 commented on code in PR #11547:
URL: https://github.com/apache/ozone/pull/11547#discussion_r4479288799


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java:
##########
@@ -103,6 +108,18 @@ public void run() {
     }
   }
 
+  private void cleanupContainerCopyDir() {
+    // Startup loads containers before starting the replication server, so no 
imports can be in progress here.
+    try {
+      File copyDir = ContainerImporter.getUntarDirectory(hddsVolume).toFile();
+      if (copyDir.exists()) {
+        FileUtils.cleanDirectory(copyDir);
+      }
+    } catch (IOException | RuntimeException e) {
+      LOG.warn("Failed to remove leftover container import files under {}", 
hddsVolume.getVolumeRootDir(), e);
+    }
+  }

Review Comment:
   Thanks @andyhuangdev for working on this. I'd suggest listing the files 
inside the directory and deleting them individually. If deleting a specific 
file fails, we can log its path.
   
   The difference from the current approach is that if any file fails to be 
deleted, the logs will clearly show which one it is, allowing the user to 
manually remove it based on the log.



-- 
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