zhuanshenbsj1 commented on PR #7405:
URL: https://github.com/apache/hudi/pull/7405#issuecomment-1365865646

   > @danny0405, @zhuanshenbsj1, @stream2000, IMO, the clean operation should 
modify the `getEarliestCommitToRetain` to keep the linear cleaning with the 
following:
   > 
   > ```
   > if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_COMMITS
   >         && commitTimeline.countInstants() > commitsRetained) {
   >       Option<HoodieInstant> earliestPendingCommits = 
hoodieTable.getMetaClient()
   >           .getActiveTimeline()
   >           .getCommitsTimeline()
   >           .filter(s -> !s.isCompleted()).firstInstant();
   >       if (earliestPendingCommits.isPresent()) {
   >         earliestCommitToRetain =
   >             commitTimeline.nthInstant(commitTimeline.countInstants() - 
commitsRetained).map(nthInstant -> {
   >               if (nthInstant.compareTo(earliestPendingCommits.get()) <= 0) 
{
   >                 return Option.of(nthInstant);
   >               } else {
   >                 return 
commitTimeline.findInstantsBefore(earliestPendingCommits.get().getTimestamp()).lastInstant();
   >               }
   >             }).orElse(Option.empty());
   >       } else {
   >         earliestCommitToRetain = 
commitTimeline.nthInstant(commitTimeline.countInstants() - commitsRetained); 
//15 instants total, 10 commits to retain, this gives 6th instant in the list
   >       }
   >  }
   > ```
   > 
   > WDYT?
   
   It still need to confirm whether clustering instant has been cleaned when 
archiving.


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