You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/07/25 07:56:12 UTC

[incubator-iotdb] branch fix_load_file_version created (now bb20d56)

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

qiaojialin pushed a change to branch fix_load_file_version
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at bb20d56  fix load file

This branch includes the following new commits:

     new bb20d56  fix load file

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.



[incubator-iotdb] 01/01: fix load file

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

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

commit bb20d56d9e829e4a14f660260692c303d94112c9
Author: qiaojialin <64...@qq.com>
AuthorDate: Sat Jul 25 15:55:45 2020 +0800

    fix load file
---
 .../java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java  | 2 +-
 .../src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java   | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

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 54070ac..205aaab 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
@@ -96,7 +96,7 @@ public class TsFileResource {
   // This field helps us compare the files that are generated by different IoTDBs that share the
   // same file generation policy but have their own merge policies.
   // https://issues.apache.org/jira/browse/IOTDB-702 for improve this field.
-  private Set<Long> historicalVersions;
+  private Set<Long> historicalVersions = new HashSet<>();
 
   private TsFileLock tsFileLock = new TsFileLock();
 
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index bd4c74f..7420dcd 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -697,6 +697,10 @@ public class PlanExecutor implements IPlanExecutor {
       return;
     }
     TsFileResource tsFileResource = new TsFileResource(file);
+    long fileVersion =
+        Long.parseLong(
+            tsFileResource.getTsFile().getName().split(IoTDBConstant.FILE_NAME_SEPARATOR)[1]);
+    tsFileResource.setHistoricalVersions(Collections.singleton(fileVersion));
     tsFileResource.setClosed(true);
     try {
       // check file