danny0405 commented on code in PR #18322:
URL: https://github.com/apache/hudi/pull/18322#discussion_r2937961289
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java:
##########
@@ -590,13 +590,30 @@ public Pair<Boolean, List<CleanFileInfo>>
getDeletePaths(String partitionPath, O
*/
public Option<HoodieInstant> getEarliestCommitToRetain() {
if (!earliestCommitToRetain.isPresent()) {
+ // Get the previous clean's earliest commit to retain, if available
+ Option<String> previousEarliestCommitToRetain = Option.empty();
+ Option<HoodieInstant> lastClean =
hoodieTable.getCleanTimeline().filterCompletedInstants().lastInstant();
+ if (lastClean.isPresent()) {
+ try {
+ HoodieCleanMetadata cleanMetadata =
hoodieTable.getActiveTimeline().readCleanMetadata(lastClean.get());
Review Comment:
since the default value of `hoodie.clean.max.commits.to.clean` is
`Long.MAX_VALUE`, can we check the value first before reading the clean commit
metadata?
also wondering if we can cache the last `HoodieCleanMetadata` in the clean
planner so that it could be utilized in the following call to
`planner.getPartitionPathsToClean` which also read and deserialize the clean
metadata(to fetch the last retained instant and extra metadata info).
So that we eliminate unnecessary read for the clean metadata file.
--
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]