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 <[email protected]> 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; }
