You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/11/15 08:10:49 UTC

[GitHub] [hudi] YannByron commented on a diff in pull request #7196: [MINOR] move logic for deleting active instant to HoodieActiveTimeline

YannByron commented on code in PR #7196:
URL: https://github.com/apache/hudi/pull/7196#discussion_r1022461347


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java:
##########
@@ -257,46 +257,36 @@ public static void deleteInstantFile(FileSystem fs, String metaPath, HoodieInsta
 
   public void deleteEmptyInstantIfExists(HoodieInstant instant) {
     ValidationUtils.checkArgument(isEmpty(instant));
-    deleteInstantFileIfExists(instant);
+    deleteInstantIfExists(instant);
   }
 
   public void deleteCompactionRequested(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isRequested());
     ValidationUtils.checkArgument(Objects.equals(instant.getAction(), HoodieTimeline.COMPACTION_ACTION));
-    deleteInstantFile(instant);
+    deleteInstantIfExists(instant);
   }
 
-  public void deleteInstantFileIfExists(HoodieInstant instant) {
-    LOG.info("Deleting instant " + instant);
-    Path inFlightCommitFilePath = getInstantFileNamePath(instant.getFileName());
-    try {
-      if (metaClient.getFs().exists(inFlightCommitFilePath)) {
-        boolean result = metaClient.getFs().delete(inFlightCommitFilePath, false);

Review Comment:
   no.
   the major change is that, when need to delete active instant in archive operation, use HoodieActiveTimeline's `deleteInstantIfExists` instead of calling the naked api (fs.delete). After the changes, `HoodieActiveTimeline` becomes the standard route to operate active instants.
   
   For this above, merge the origin method `deleteInstantFile` (used in current class and subclass) and `deleteInstantFileIfExists` (used outside) to one, and rename to `deleteInstantIfExists`. 



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org