jt2594838 commented on a change in pull request #460:
URL: https://github.com/apache/iotdb/pull/460#discussion_r537403023



##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
##########
@@ -585,20 +555,34 @@ public void removeModFile() throws IOException {
    * Remove the data file, its resource file, and its modification file 
physically.
    */
   public void remove() {
-    file.delete();
-    fsFactory.getFile(file.getPath() + RESOURCE_SUFFIX).delete();
-    fsFactory.getFile(file.getPath() + ModificationFile.FILE_SUFFIX).delete();
+    try {
+      Files.deleteIfExists(file.toPath());
+    } catch (IOException e) {
+      logger.warn("TsFile {} cannot be deleted: {}", file, e.getMessage());
+    }
+    removeResourceFile();
+    try {
+      Files.deleteIfExists(
+          fsFactory.getFile(file.getPath() + 
ModificationFile.FILE_SUFFIX).toPath());
+    } catch (IOException e) {
+      logger.warn("ModificationFile {} cannot be deleted: {}", file, 
e.getMessage());

Review comment:
       See above.

##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
##########
@@ -585,20 +555,34 @@ public void removeModFile() throws IOException {
    * Remove the data file, its resource file, and its modification file 
physically.
    */
   public void remove() {
-    file.delete();
-    fsFactory.getFile(file.getPath() + RESOURCE_SUFFIX).delete();
-    fsFactory.getFile(file.getPath() + ModificationFile.FILE_SUFFIX).delete();
+    try {
+      Files.deleteIfExists(file.toPath());
+    } catch (IOException e) {
+      logger.warn("TsFile {} cannot be deleted: {}", file, e.getMessage());
+    }
+    removeResourceFile();
+    try {
+      Files.deleteIfExists(
+          fsFactory.getFile(file.getPath() + 
ModificationFile.FILE_SUFFIX).toPath());
+    } catch (IOException e) {
+      logger.warn("ModificationFile {} cannot be deleted: {}", file, 
e.getMessage());
+    }
   }
 
   public void removeResourceFile() {
-    fsFactory.getFile(file.getPath() + RESOURCE_SUFFIX).delete();
+    try {
+      Files.deleteIfExists(fsFactory.getFile(file.getPath() + 
RESOURCE_SUFFIX).toPath());
+    } catch (IOException e) {
+      logger.warn("TsFileResource {} cannot be deleted: {}", file, 
e.getMessage());

Review comment:
       See above.




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

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


Reply via email to