You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "Zouxxyy (via GitHub)" <gi...@apache.org> on 2023/06/12 13:47:08 UTC

[GitHub] [hudi] Zouxxyy opened a new pull request, #8941: [HUDI-6363] Unify instant interface in HoodieActiveTimeline

Zouxxyy opened a new pull request, #8941:
URL: https://github.com/apache/hudi/pull/8941

   ### Change Logs
   
   The addition, deletion, and existence of instants are managed uniformly through `HoodieActiveTimeline`:
   
   - deleteInstantIfExists
   - deleteInstant
   - instantExists
   - createInstant
   
   After this PR, I will also modify some test cases so that they all use the above interface
   
   ### Impact
   
   _Describe any public API or user-facing feature change or any performance impact._
   
   ### Risk level (write none, low medium or high below)
   
   low
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


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


[GitHub] [hudi] Zouxxyy commented on a diff in pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on code in PR #8941:
URL: https://github.com/apache/hudi/pull/8941#discussion_r1227954534


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java:
##########
@@ -234,73 +234,63 @@ public HoodieInstant revertToInflight(HoodieInstant instant) {
 
   public void deleteInflight(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isInflight());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deletePending(HoodieInstant instant) {
     ValidationUtils.checkArgument(!instant.isCompleted());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deleteCompletedRollback(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isCompleted());
-    deleteInstantFile(instant);
-  }
-
-  public static void deleteInstantFile(FileSystem fs, String metaPath, HoodieInstant instant) {
-    try {
-      fs.delete(new Path(metaPath, instant.getFileName()), false);
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not delete instant file" + instant.getFileName(), e);
-    }
+    deleteInstant(instant);
   }
 
   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);
+    deleteInstant(instant);
   }
 
   /**
    * Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant,
    * and completed commit instant in an archive operation.
    */
-  public void deleteInstantFileIfExists(HoodieInstant instant) {
-    LOG.info("Deleting instant " + instant);
-    Path commitFilePath = getInstantFileNamePath(instant.getFileName());
-    try {
-      if (metaClient.getFs().exists(commitFilePath)) {
-        boolean result = metaClient.getFs().delete(commitFilePath, false);
-        if (result) {
-          LOG.info("Removed instant " + instant);
-        } else {
-          throw new HoodieIOException("Could not delete instant " + instant);
-        }
-      } else {
-        LOG.warn("The commit " + commitFilePath + " to remove does not exist");
-      }
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not remove commit " + commitFilePath, e);
+  public void deleteInstantIfExists(HoodieInstant instant) {
+    if (instantExists(instant)) {

Review Comment:
   change `deleteInstantFileIfExists`  to `deleteInstantIfExists`, because instant can't just be a file in FS, in RFC-36, it's a record in database.
   
   An instant object contains state, action, timestamp, which can uniquely determine a 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: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #8941: [HUDI-6363] Unify instant interface in HoodieActiveTimeline

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8941:
URL: https://github.com/apache/hudi/pull/8941#issuecomment-1587502403

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17771",
       "triggerID" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2840b67b6d15e15dc91d330f7ce6a077d5a93664 UNKNOWN
   * b6df2c706182c5bb28df93a0e4fee95208170e9e Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17771) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] danny0405 commented on a diff in pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #8941:
URL: https://github.com/apache/hudi/pull/8941#discussion_r1228867099


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java:
##########
@@ -234,73 +234,63 @@ public HoodieInstant revertToInflight(HoodieInstant instant) {
 
   public void deleteInflight(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isInflight());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deletePending(HoodieInstant instant) {
     ValidationUtils.checkArgument(!instant.isCompleted());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deleteCompletedRollback(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isCompleted());
-    deleteInstantFile(instant);
-  }
-
-  public static void deleteInstantFile(FileSystem fs, String metaPath, HoodieInstant instant) {
-    try {
-      fs.delete(new Path(metaPath, instant.getFileName()), false);
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not delete instant file" + instant.getFileName(), e);
-    }
+    deleteInstant(instant);
   }
 
   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);
+    deleteInstant(instant);
   }
 
   /**
    * Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant,
    * and completed commit instant in an archive operation.
    */
-  public void deleteInstantFileIfExists(HoodieInstant instant) {
-    LOG.info("Deleting instant " + instant);
-    Path commitFilePath = getInstantFileNamePath(instant.getFileName());
-    try {
-      if (metaClient.getFs().exists(commitFilePath)) {
-        boolean result = metaClient.getFs().delete(commitFilePath, false);
-        if (result) {
-          LOG.info("Removed instant " + instant);
-        } else {
-          throw new HoodieIOException("Could not delete instant " + instant);
-        }
-      } else {
-        LOG.warn("The commit " + commitFilePath + " to remove does not exist");
-      }
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not remove commit " + commitFilePath, e);
+  public void deleteInstantIfExists(HoodieInstant instant) {
+    if (instantExists(instant)) {

Review Comment:
   Have no strong options here, just thought that `HoodieInstant` and metadata are different notions in Hudi.



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


[GitHub] [hudi] hudi-bot commented on pull request #8941: [HUDI-6363] Unify instant interface in HoodieActiveTimeline

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8941:
URL: https://github.com/apache/hudi/pull/8941#issuecomment-1587687290

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17771",
       "triggerID" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "84d7b5aa3306e049f10423f4f0e393cc18bcc4af",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17777",
       "triggerID" : "84d7b5aa3306e049f10423f4f0e393cc18bcc4af",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2840b67b6d15e15dc91d330f7ce6a077d5a93664 UNKNOWN
   * b6df2c706182c5bb28df93a0e4fee95208170e9e Azure: [CANCELED](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17771) 
   * 84d7b5aa3306e049f10423f4f0e393cc18bcc4af Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17777) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] Zouxxyy commented on a diff in pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on code in PR #8941:
URL: https://github.com/apache/hudi/pull/8941#discussion_r1227954534


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java:
##########
@@ -234,73 +234,63 @@ public HoodieInstant revertToInflight(HoodieInstant instant) {
 
   public void deleteInflight(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isInflight());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deletePending(HoodieInstant instant) {
     ValidationUtils.checkArgument(!instant.isCompleted());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deleteCompletedRollback(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isCompleted());
-    deleteInstantFile(instant);
-  }
-
-  public static void deleteInstantFile(FileSystem fs, String metaPath, HoodieInstant instant) {
-    try {
-      fs.delete(new Path(metaPath, instant.getFileName()), false);
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not delete instant file" + instant.getFileName(), e);
-    }
+    deleteInstant(instant);
   }
 
   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);
+    deleteInstant(instant);
   }
 
   /**
    * Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant,
    * and completed commit instant in an archive operation.
    */
-  public void deleteInstantFileIfExists(HoodieInstant instant) {
-    LOG.info("Deleting instant " + instant);
-    Path commitFilePath = getInstantFileNamePath(instant.getFileName());
-    try {
-      if (metaClient.getFs().exists(commitFilePath)) {
-        boolean result = metaClient.getFs().delete(commitFilePath, false);
-        if (result) {
-          LOG.info("Removed instant " + instant);
-        } else {
-          throw new HoodieIOException("Could not delete instant " + instant);
-        }
-      } else {
-        LOG.warn("The commit " + commitFilePath + " to remove does not exist");
-      }
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not remove commit " + commitFilePath, e);
+  public void deleteInstantIfExists(HoodieInstant instant) {
+    if (instantExists(instant)) {

Review Comment:
   change `deleteInstantFileIfExists`  to `deleteInstantIfExists`, because instant can't just be a file in FS, in RFC-36, it's a record in database.
   
   An instant object contains state, action, timestamp, which can uniquely determine a metadata file.
   
   And i may not understand what `And do we must check the file existence then` mean 



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


[GitHub] [hudi] hudi-bot commented on pull request #8941: [HUDI-6363] Unify instant interface in HoodieActiveTimeline

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8941:
URL: https://github.com/apache/hudi/pull/8941#issuecomment-1587674067

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17771",
       "triggerID" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "84d7b5aa3306e049f10423f4f0e393cc18bcc4af",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "84d7b5aa3306e049f10423f4f0e393cc18bcc4af",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2840b67b6d15e15dc91d330f7ce6a077d5a93664 UNKNOWN
   * b6df2c706182c5bb28df93a0e4fee95208170e9e Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17771) 
   * 84d7b5aa3306e049f10423f4f0e393cc18bcc4af UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] Zouxxyy commented on a diff in pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on code in PR #8941:
URL: https://github.com/apache/hudi/pull/8941#discussion_r1228891710


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java:
##########
@@ -234,73 +234,63 @@ public HoodieInstant revertToInflight(HoodieInstant instant) {
 
   public void deleteInflight(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isInflight());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deletePending(HoodieInstant instant) {
     ValidationUtils.checkArgument(!instant.isCompleted());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deleteCompletedRollback(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isCompleted());
-    deleteInstantFile(instant);
-  }
-
-  public static void deleteInstantFile(FileSystem fs, String metaPath, HoodieInstant instant) {
-    try {
-      fs.delete(new Path(metaPath, instant.getFileName()), false);
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not delete instant file" + instant.getFileName(), e);
-    }
+    deleteInstant(instant);
   }
 
   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);
+    deleteInstant(instant);
   }
 
   /**
    * Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant,
    * and completed commit instant in an archive operation.
    */
-  public void deleteInstantFileIfExists(HoodieInstant instant) {
-    LOG.info("Deleting instant " + instant);
-    Path commitFilePath = getInstantFileNamePath(instant.getFileName());
-    try {
-      if (metaClient.getFs().exists(commitFilePath)) {
-        boolean result = metaClient.getFs().delete(commitFilePath, false);
-        if (result) {
-          LOG.info("Removed instant " + instant);
-        } else {
-          throw new HoodieIOException("Could not delete instant " + instant);
-        }
-      } else {
-        LOG.warn("The commit " + commitFilePath + " to remove does not exist");
-      }
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not remove commit " + commitFilePath, e);
+  public void deleteInstantIfExists(HoodieInstant instant) {
+    if (instantExists(instant)) {

Review Comment:
   @danny0405 Yes, but the current `HoodieInstant` contains a state attribute, so it actually refers to a certain state of an intant. Besides, `instantExists` is a new method, what does prefer the original name mean?



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


[GitHub] [hudi] hudi-bot commented on pull request #8941: [HUDI-6363] Unify instant interface in HoodieActiveTimeline

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8941:
URL: https://github.com/apache/hudi/pull/8941#issuecomment-1587487372

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2840b67b6d15e15dc91d330f7ce6a077d5a93664 UNKNOWN
   * b6df2c706182c5bb28df93a0e4fee95208170e9e UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] Zouxxyy closed pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy closed pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline
URL: https://github.com/apache/hudi/pull/8941


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


[GitHub] [hudi] danny0405 commented on a diff in pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #8941:
URL: https://github.com/apache/hudi/pull/8941#discussion_r1227914282


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java:
##########
@@ -234,73 +234,63 @@ public HoodieInstant revertToInflight(HoodieInstant instant) {
 
   public void deleteInflight(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isInflight());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deletePending(HoodieInstant instant) {
     ValidationUtils.checkArgument(!instant.isCompleted());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deleteCompletedRollback(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isCompleted());
-    deleteInstantFile(instant);
-  }
-
-  public static void deleteInstantFile(FileSystem fs, String metaPath, HoodieInstant instant) {
-    try {
-      fs.delete(new Path(metaPath, instant.getFileName()), false);
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not delete instant file" + instant.getFileName(), e);
-    }
+    deleteInstant(instant);
   }
 
   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);
+    deleteInstant(instant);
   }
 
   /**
    * Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant,
    * and completed commit instant in an archive operation.
    */
-  public void deleteInstantFileIfExists(HoodieInstant instant) {
-    LOG.info("Deleting instant " + instant);
-    Path commitFilePath = getInstantFileNamePath(instant.getFileName());
-    try {
-      if (metaClient.getFs().exists(commitFilePath)) {
-        boolean result = metaClient.getFs().delete(commitFilePath, false);
-        if (result) {
-          LOG.info("Removed instant " + instant);
-        } else {
-          throw new HoodieIOException("Could not delete instant " + instant);
-        }
-      } else {
-        LOG.warn("The commit " + commitFilePath + " to remove does not exist");
-      }
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not remove commit " + commitFilePath, e);
+  public void deleteInstantIfExists(HoodieInstant instant) {
+    if (instantExists(instant)) {

Review Comment:
   I prefer the original name, one instant may constans 3 metadata files.
   And do we must check the file existence then?



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


[GitHub] [hudi] Zouxxyy commented on a diff in pull request #8941: [HUDI-6363] Unify instant management with HoodieActiveTimeline

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on code in PR #8941:
URL: https://github.com/apache/hudi/pull/8941#discussion_r1227954534


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieActiveTimeline.java:
##########
@@ -234,73 +234,63 @@ public HoodieInstant revertToInflight(HoodieInstant instant) {
 
   public void deleteInflight(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isInflight());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deletePending(HoodieInstant instant) {
     ValidationUtils.checkArgument(!instant.isCompleted());
-    deleteInstantFile(instant);
+    deleteInstant(instant);
   }
 
   public void deleteCompletedRollback(HoodieInstant instant) {
     ValidationUtils.checkArgument(instant.isCompleted());
-    deleteInstantFile(instant);
-  }
-
-  public static void deleteInstantFile(FileSystem fs, String metaPath, HoodieInstant instant) {
-    try {
-      fs.delete(new Path(metaPath, instant.getFileName()), false);
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not delete instant file" + instant.getFileName(), e);
-    }
+    deleteInstant(instant);
   }
 
   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);
+    deleteInstant(instant);
   }
 
   /**
    * Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant,
    * and completed commit instant in an archive operation.
    */
-  public void deleteInstantFileIfExists(HoodieInstant instant) {
-    LOG.info("Deleting instant " + instant);
-    Path commitFilePath = getInstantFileNamePath(instant.getFileName());
-    try {
-      if (metaClient.getFs().exists(commitFilePath)) {
-        boolean result = metaClient.getFs().delete(commitFilePath, false);
-        if (result) {
-          LOG.info("Removed instant " + instant);
-        } else {
-          throw new HoodieIOException("Could not delete instant " + instant);
-        }
-      } else {
-        LOG.warn("The commit " + commitFilePath + " to remove does not exist");
-      }
-    } catch (IOException e) {
-      throw new HoodieIOException("Could not remove commit " + commitFilePath, e);
+  public void deleteInstantIfExists(HoodieInstant instant) {
+    if (instantExists(instant)) {

Review Comment:
   change `deleteInstantFileIfExists`  to `deleteInstantIfExists`, because instant can't just be a file in FS, in RFC-36, it's a record in database.
   
   An instant object contains state, action, timestamp, which can uniquely determine a metadata file.
   
   And i may not understand what `And do we must check the file existence then?  mean` 



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


[GitHub] [hudi] hudi-bot commented on pull request #8941: [HUDI-6363] Unify instant interface in HoodieActiveTimeline

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8941:
URL: https://github.com/apache/hudi/pull/8941#issuecomment-1588138436

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17771",
       "triggerID" : "b6df2c706182c5bb28df93a0e4fee95208170e9e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "84d7b5aa3306e049f10423f4f0e393cc18bcc4af",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17777",
       "triggerID" : "84d7b5aa3306e049f10423f4f0e393cc18bcc4af",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2840b67b6d15e15dc91d330f7ce6a077d5a93664 UNKNOWN
   * 84d7b5aa3306e049f10423f4f0e393cc18bcc4af Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=17777) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] hudi-bot commented on pull request #8941: [HUDI-6363] Unify instant interface in HoodieActiveTimeline

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8941:
URL: https://github.com/apache/hudi/pull/8941#issuecomment-1587471549

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2840b67b6d15e15dc91d330f7ce6a077d5a93664",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2840b67b6d15e15dc91d330f7ce6a077d5a93664 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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