XuQianJin-Stars commented on a change in pull request #4489:
URL: https://github.com/apache/hudi/pull/4489#discussion_r808605408
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java
##########
@@ -432,4 +458,47 @@ private boolean
isFileSliceNeededForPendingCompaction(FileSlice fileSlice) {
private boolean isFileGroupInPendingCompaction(HoodieFileGroup fg) {
return fgIdToPendingCompactionOperations.containsKey(fg.getFileGroupId());
}
+
+ public boolean isDropPartition(Option<HoodieInstant> instantToRetain) {
+ try {
+ if (instantToRetain.isPresent() &&
HoodieTimeline.REPLACE_COMMIT_ACTION.equals(instantToRetain.get().getAction()))
{
+ HoodieReplaceCommitMetadata replaceCommitMetadata =
HoodieReplaceCommitMetadata.fromBytes(
+
hoodieTable.getActiveTimeline().getInstantDetails(instantToRetain.get()).get(),
HoodieReplaceCommitMetadata.class);
+
+ if (replaceCommitMetadata != null
+ &&
WriteOperationType.DELETE_PARTITION.equals(replaceCommitMetadata.getOperationType()))
{
+ return true;
+ }
+ }
+ } catch (Exception e) {
+ throw new HoodieException("Failed to get commit metadata", e);
+ }
+ return false;
+ }
+
+ public List<String> getDropPartitions(Option<HoodieInstant> instantToRetain)
{
+ try {
+ if (!instantToRetain.isPresent()) {
+ LOG.info("No earliest commit to retain. No need to scan partitions
!!");
+ return Collections.emptyList();
+ }
+
+ if
(HoodieTimeline.REPLACE_COMMIT_ACTION.equals(instantToRetain.get().getAction()))
{
Review comment:
well, I see what you mean, I'll check again.
--
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]