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

[iotdb] branch IOTDB-4950 created (now 900f75fab2)

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

marklau99 pushed a change to branch IOTDB-4950
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 900f75fab2 add status DELETED

This branch includes the following new commits:

     new 900f75fab2 add status DELETED

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: add status DELETED

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

marklau99 pushed a commit to branch IOTDB-4950
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 900f75fab20820302a1a410784298676b16b77df
Author: LiuXuxin <li...@outlook.com>
AuthorDate: Wed Nov 16 15:39:31 2022 +0800

    add status 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
 }