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 2021/03/09 04:28:48 UTC

[iotdb] branch fix_historical_version_0.11 created (now 006e433)

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

qiaojialin pushed a change to branch fix_historical_version_0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 006e433  avoid Collections.max(empty set) incur null pointer

This branch includes the following new commits:

     new 006e433  avoid Collections.max(empty set) incur null pointer

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.



[iotdb] 01/01: avoid Collections.max(empty set) incur null pointer

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

qiaojialin pushed a commit to branch fix_historical_version_0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 006e4336e7b8d4ca4e5c75c663165ba7ebb0e66a
Author: qiaojialin <64...@qq.com>
AuthorDate: Tue Mar 9 12:28:17 2021 +0800

    avoid Collections.max(empty set) incur null pointer
---
 .../iotdb/db/engine/storagegroup/StorageGroupProcessor.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index 5c9cc4d..4394fda 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -341,13 +341,13 @@ public class StorageGroupProcessor {
         long partitionNum = resource.getTimePartition();
         partitionDirectFileVersions.computeIfAbsent(partitionNum, p -> new HashSet<>())
             .addAll(resource.getHistoricalVersions());
-        updatePartitionFileVersion(partitionNum, Collections.max(resource.getHistoricalVersions()));
+        updatePartitionFileVersion(partitionNum, resource.getMaxVersion());
       }
       for (TsFileResource resource : tsFileManagement.getTsFileList(false)) {
         long partitionNum = resource.getTimePartition();
         partitionDirectFileVersions.computeIfAbsent(partitionNum, p -> new HashSet<>())
             .addAll(resource.getHistoricalVersions());
-        updatePartitionFileVersion(partitionNum, Collections.max(resource.getHistoricalVersions()));
+        updatePartitionFileVersion(partitionNum, resource.getMaxVersion());
       }
       updateLatestFlushedTime();
     } catch (IOException | MetadataException e) {
@@ -1960,7 +1960,7 @@ public class StorageGroupProcessor {
       partitionDirectFileVersions.computeIfAbsent(partitionNum, p -> new HashSet<>())
           .addAll(newTsFileResource.getHistoricalVersions());
       updatePartitionFileVersion(partitionNum,
-          Collections.max(newTsFileResource.getHistoricalVersions()));
+          newTsFileResource.getMaxVersion());
     } catch (DiskSpaceInsufficientException e) {
       logger.error(
           "Failed to append the tsfile {} to storage group processor {} because the disk space is insufficient.",
@@ -2303,7 +2303,7 @@ public class StorageGroupProcessor {
         p -> new HashSet<>()).addAll(tsFileResource.getHistoricalVersions());
     if (!tsFileResource.getHistoricalVersions().isEmpty()) {
       updatePartitionFileVersion(filePartitionId,
-          Collections.max(tsFileResource.getHistoricalVersions()));
+          tsFileResource.getMaxVersion());
     }
     return true;
   }