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 05:17:00 UTC
[iotdb] branch rel/0.11 updated: avoid Collections.max(empty set)
incur null pointer (#2783)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.11 by this push:
new a7a97d0 avoid Collections.max(empty set) incur null pointer (#2783)
a7a97d0 is described below
commit a7a97d073e7a45f7928f219176d447329d11e7d6
Author: Haonan <hh...@outlook.com>
AuthorDate: Tue Mar 9 13:16:37 2021 +0800
avoid Collections.max(empty set) incur null pointer (#2783)
Co-authored-by: qiaojialin <64...@qq.com>
---
.../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;
}