You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2020/06/11 03:57:54 UTC

[incubator-iotdb] 01/01: fix cannot set version when recover the uncompleted files

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 <hh...@outlook.com>
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);
     }
   }