jt2594838 commented on code in PR #17664:
URL: https://github.com/apache/iotdb/pull/17664#discussion_r3242205220


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/StorageEngine.java:
##########
@@ -1086,9 +1086,11 @@ private void 
stopTimedServiceAndThrow(ScheduledExecutorService pool, String pool
 
   public void getDiskSizeByDataRegion(
       Map<Integer, Long> dataRegionDisk, List<Integer> dataRegionIds) {
+    final java.util.Collection<Integer> targetDataRegionIds =
+        dataRegionIds.size() > 1 ? new java.util.HashSet<>(dataRegionIds) : 
dataRegionIds;
     dataRegionMap.forEach(
         (dataRegionId, dataRegion) -> {
-          if (dataRegionIds.contains(dataRegionId.getId())) {
+          if (targetDataRegionIds.contains(dataRegionId.getId())) {
             dataRegionDisk.put(dataRegionId.getId(), 
dataRegion.countRegionDiskSize());
           }

Review Comment:
   for id : dataRegionIds
      dataRegionMap.computeIfPresent?



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/filescan/impl/ClosedFileScanHandleImpl.java:
##########
@@ -87,10 +89,22 @@ public boolean isDeviceTimeDeleted(IDeviceID deviceID, long 
timestamp)
         curFileModEntries != null
             ? curFileModEntries
             : queryContext.loadAllModificationsFromDisk(tsFileResource);
-    List<ModEntry> modifications = 
queryContext.getPathModifications(curFileModEntries, deviceID);
-    List<TimeRange> timeRangeList =
-        
modifications.stream().map(ModEntry::getTimeRange).collect(Collectors.toList());
-    return ModificationUtils.isPointDeletedWithoutOrderedRange(timestamp, 
timeRangeList);
+    List<TimeRange> timeRangeList = deviceToDeletionRanges.get(deviceID);
+    if (timeRangeList == null) {
+      timeRangeList =
+          
getMergedTimeRanges(queryContext.getPathModifications(curFileModEntries, 
deviceID));
+      deviceToDeletionRanges.put(deviceID, timeRangeList);
+    }
+    return ModificationUtils.isPointDeleted(timestamp, timeRangeList);
+  }

Review Comment:
   ComputeIfAbsent?
   Is the additional memory footprint risky?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to