vinothchandar commented on a change in pull request #600:  Timeline Service 
with Incremental View Syncing support
URL: https://github.com/apache/incubator-hudi/pull/600#discussion_r276510781
 
 

 ##########
 File path: 
hoodie-client/src/main/java/com/uber/hoodie/io/HoodieCleanHelper.java
 ##########
 @@ -86,32 +86,38 @@ public HoodieCleanHelper(HoodieTable<T> hoodieTable, 
HoodieWriteConfig config) {
 
     for (HoodieFileGroup fileGroup : fileGroups) {
       int keepVersions = config.getCleanerFileVersionsRetained();
-      Iterator<FileSlice> fileSliceIterator = 
fileGroup.getAllFileSlices().iterator();
+      Iterator<FileSlice> fileSliceIterator = fileGroup.getAllFileSlices()
+          .filter(fs -> !isFileSliceNeededForPendingCompaction(fs)).iterator();
+      if (isFileGroupInPendingCompaction(fileGroup)) {
+        // We have already saved the last version of file-groups for pending 
compaction Id
+        keepVersions--;
+      }
+
       while (fileSliceIterator.hasNext() && keepVersions > 0) {
         // Skip this most recent version
         FileSlice nextSlice = fileSliceIterator.next();
         Optional<HoodieDataFile> dataFile = nextSlice.getDataFile();
         if (dataFile.isPresent() && 
savepointedFiles.contains(dataFile.get().getFileName())) {
-          // do not clean up a savepoint data file
+          // do not clean up a savepoint data file or one required for pending 
compaction
           continue;
         }
+
 
 Review comment:
   nit: extra line

----------------------------------------------------------------
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