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

hxd pushed a commit to branch ut_close_socket
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/ut_close_socket by this push:
     new 32b6a79  debug why files can not be deleted
32b6a79 is described below

commit 32b6a79a0b2808f702516b239a76556bdde66d6d
Author: xiangdong huang <[email protected]>
AuthorDate: Tue Feb 18 19:11:33 2020 +0800

    debug why files can not be deleted
---
 server/src/main/java/org/apache/iotdb/db/utils/FileUtils.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/utils/FileUtils.java 
b/server/src/main/java/org/apache/iotdb/db/utils/FileUtils.java
index 60f17ff..a18afa2 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/FileUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/FileUtils.java
@@ -37,11 +37,19 @@ public class FileUtils {
       for (File file : folder.listFiles()) {
         deleteDirectory(file);
       }
+      while (folder.listFiles().length > 0) {
+        logger.warn("after deletion, folder {} still has files, continue to 
delete them.", folder.getAbsolutePath());
+        for (File file : folder.listFiles()) {
+          deleteDirectory(file);
+        }
+      }
     }
     try {
       Files.delete(folder.toPath());
     } catch (NoSuchFileException | DirectoryNotEmptyException e) {
-      logger.warn(Arrays.toString(folder.list()), e);
+      logger.warn("{}: {}", e.getMessage(), Arrays.toString(folder.list()), e);
+    } catch (IOException | SecurityException e) {
+      logger.warn("{}: {}", e.getMessage(), folder.getName(), e);
     }
   }
 }

Reply via email to