vinothchandar commented on a change in pull request #1576:
URL: https://github.com/apache/incubator-hudi/pull/1576#discussion_r418090411



##########
File path: hudi-client/src/test/java/org/apache/hudi/table/TestCleaner.java
##########
@@ -128,10 +128,8 @@ private void 
insertFirstBigBatchForClientCleanerTest(HoodieWriteConfig cfg, Hood
 
     assertFalse(table.getCompletedCommitsTimeline().empty());
     String instantTime = 
table.getCompletedCommitsTimeline().getInstants().findFirst().get().getTimestamp();
+    // We no longer write empty cleaner plans when there are not enough 
commits present

Review comment:
       do we have enough tests that now test when a valid cleaner plan?

##########
File path: 
hudi-client/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java
##########
@@ -111,10 +111,15 @@ public CleanPlanner(HoodieTable<T> hoodieTable, 
HoodieWriteConfig config) {
    * @throws IOException when underlying file-system throws this exception
    */
   public List<String> getPartitionPathsToClean(Option<HoodieInstant> 
newInstantToRetain) throws IOException {
-    if (config.incrementalCleanerModeEnabled() && 
newInstantToRetain.isPresent()
+
+    if (!newInstantToRetain.isPresent() && 
(HoodieCleaningPolicy.KEEP_LATEST_COMMITS == config.getCleanerPolicy())) {
+      LOG.info("No earliest commit to retain. No need to scan partitions !!");
+      return new ArrayList<>();

Review comment:
       Collections.emptyList()? 

##########
File path: 
hudi-client/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java
##########
@@ -111,10 +111,15 @@ public CleanPlanner(HoodieTable<T> hoodieTable, 
HoodieWriteConfig config) {
    * @throws IOException when underlying file-system throws this exception
    */
   public List<String> getPartitionPathsToClean(Option<HoodieInstant> 
newInstantToRetain) throws IOException {
-    if (config.incrementalCleanerModeEnabled() && 
newInstantToRetain.isPresent()
+
+    if (!newInstantToRetain.isPresent() && 
(HoodieCleaningPolicy.KEEP_LATEST_COMMITS == config.getCleanerPolicy())) {

Review comment:
       can we break this method up into two, based on the policy? it feels very 
overloaded now..




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


Reply via email to