You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/03/12 08:00:36 UTC

[GitHub] [iotdb] tsunghanjacktsai commented on a change in pull request #5198: [IOTDB-2503] Import a Status for TsFileResource

tsunghanjacktsai commented on a change in pull request #5198:
URL: https://github.com/apache/iotdb/pull/5198#discussion_r825264516



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
##########
@@ -577,32 +570,62 @@ public int hashCode() {
     return Objects.hash(file);
   }
 
-  public void setClosed(boolean closed) {
-    this.closed = closed;
-  }
-
   public boolean isDeleted() {
-    return deleted;
-  }
-
-  public void setDeleted(boolean deleted) {
-    this.deleted = deleted;
+    return this.status == TsFileResourceStatus.DELETED;
   }
 
   public boolean isCompacting() {
-    return isCompacting;
-  }
-
-  public void setCompacting(boolean compacting) {
-    isCompacting = compacting;
+    return this.status == TsFileResourceStatus.COMPACTING;
   }
 
   public boolean isCompactionCandidate() {
-    return compactionCandidate;
+    return this.status == TsFileResourceStatus.COMPACTION_CANDIDATE;
   }
 
-  public void setCompactionCandidate(boolean compactionCandidate) {
-    this.compactionCandidate = compactionCandidate;
+  public boolean setStatus(TsFileResourceStatus status) {
+    boolean success = false;
+    switch (status) {
+      case CLOSED:
+        {
+          if (this.status != TsFileResourceStatus.DELETED) {
+            this.status = TsFileResourceStatus.CLOSED;
+            success = true;
+          }
+          break;
+        }
+      case UNCLOSED:
+        // Can we set a tsfile resource to unclosed status?

Review comment:
       We'd set it to an unclosed state in a test case in RewriteCompactionFileSelectorTest.  So I think we could just keep it and print a warning to users.




-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org