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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8f87fd3  fix cannot set version when recover the uncompleted files 
(#1346)
8f87fd3 is described below

commit 8f87fd3f07cd989f1e7437349e1beb42fccb308f
Author: Haonan <[email protected]>
AuthorDate: Thu Jun 11 14:49:21 2020 +0800

    fix cannot set version when recover the uncompleted files (#1346)
---
 tsfile/src/main/java/org/apache/iotdb/tsfile/utils/VersionUtils.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/VersionUtils.java 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/VersionUtils.java
index bd31800..621c9c9 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/VersionUtils.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/VersionUtils.java
@@ -36,6 +36,11 @@ public class VersionUtils {
       while (chunkMetadata.getOffsetOfChunkHeader() >= 
versionInfo.get(versionIndex).left) {
         versionIndex++;
       }
+      // When the TsFile is uncompleted, 
+      // skip the chunkMetadatas those don't have their version information
+      if (versionIndex >= versionInfo.size()) {
+        break;
+      }
       chunkMetadata.setVersion(versionInfo.get(versionIndex).right);
     }
   }

Reply via email to