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

haonan pushed a commit to branch jira-762-10
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit b254b4c6d1b21e4cc98e4baa9dd35ac2b103be59
Author: HTHou <[email protected]>
AuthorDate: Thu Jun 11 11:56:41 2020 +0800

    fix cannot set version when recover the uncompleted files
---
 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