You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/11/16 13:07:34 UTC

[iotdb] branch master updated: [IOTDB-4950] Add TsFileResourceStatus DELETED

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

jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 0615b672e6 [IOTDB-4950] Add TsFileResourceStatus DELETED
0615b672e6 is described below

commit 0615b672e6c88ed313f73f053caf68708edea416
Author: Liu Xuxin <37...@users.noreply.github.com>
AuthorDate: Wed Nov 16 21:07:28 2022 +0800

    [IOTDB-4950] Add TsFileResourceStatus DELETED
---
 .../java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java  | 4 +++-
 .../org/apache/iotdb/db/engine/storagegroup/TsFileResourceStatus.java | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
index 0c6126183e..a73ada0e33 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
@@ -510,6 +510,7 @@ public class TsFileResource {
    * file physically.
    */
   public boolean remove() {
+    this.status = TsFileResourceStatus.DELETED;
     try {
       fsFactory.deleteIfExists(file);
       fsFactory.deleteIfExists(
@@ -577,7 +578,7 @@ public class TsFileResource {
   }
 
   public boolean isDeleted() {
-    return !this.file.exists();
+    return this.status == TsFileResourceStatus.DELETED;
   }
 
   public boolean isCompacting() {
@@ -862,6 +863,7 @@ public class TsFileResource {
               .getFile(file.toPath() + TsFileResource.RESOURCE_SUFFIX)
               .toPath());
     }
+    this.status = TsFileResourceStatus.DELETED;
   }
 
   public long getMaxPlanIndex() {
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResourceStatus.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResourceStatus.java
index bf8805db65..42eaf481d3 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResourceStatus.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResourceStatus.java
@@ -22,5 +22,6 @@ public enum TsFileResourceStatus {
   UNCLOSED,
   CLOSED,
   COMPACTION_CANDIDATE,
-  COMPACTING
+  COMPACTING,
+  DELETED
 }