JackieTien97 commented on a change in pull request #429: [IOTDB-205]Support 
storage-group-level data ttl
URL: https://github.com/apache/incubator-iotdb/pull/429#discussion_r336874974
 
 

 ##########
 File path: 
server/src/main/java/org/apache/iotdb/db/engine/merge/manage/MergeResource.java
 ##########
 @@ -68,9 +68,21 @@
   private boolean cacheDeviceMeta = false;
 
   public MergeResource(List<TsFileResource> seqFiles, List<TsFileResource> 
unseqFiles) {
-    this.seqFiles = 
seqFiles.stream().filter(TsFileResource::isClosed).collect(Collectors.toList());
+    this.seqFiles = seqFiles.stream().filter(res -> res.isClosed() && 
!res.isDeleted())
+        .collect(Collectors.toList());
     this.unseqFiles =
-        
unseqFiles.stream().filter(TsFileResource::isClosed).collect(Collectors.toList());
+        unseqFiles.stream().filter(res -> res.isClosed() && !res.isDeleted())
+            .collect(Collectors.toList());
+  }
+
+  public MergeResource(List<TsFileResource> seqFiles, List<TsFileResource> 
unseqFiles,
+      long timeBound) {
+    this.seqFiles =
+        seqFiles.stream().filter(res -> res.isClosed() && !res.isDeleted()
+            && res.stillLives(timeBound)).collect(Collectors.toList());
+    this.unseqFiles =
+        unseqFiles.stream().filter(res -> res.isClosed() && !res.isDeleted()
+            && res.stillLives(timeBound)).collect(Collectors.toList());
 
 Review comment:
   Every time the function `MergeResource` is invoked, two new class will be 
created because the `timeBound` in lambda express may be different among 
different invocations.
   It's better to write a class to implement the interface Predicate<T> and 
maintain a field named `timeBound`. And set the field to different value in the 
function `MergeResource`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to