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

[PR] [HUDI-7151] Modify the "fs.delete" to prioritize moving paths and files under distributed file systems to the trash instead of directly deleting them [hudi]

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

   ### Change Logs
   
   Calling the "fs.delete" method will cause the path and file to be deleted directly instead of moving to the trash. This will cause the path, data and other information to be lost directly and cannot be recovered.
   
   This modification introduces a new method "handleFileSystemDeletion". When FileSystem is a Distributed File System, the file and path will be moved to Trash, which is consistent with online deletion logic. 
   
   The methods involved are: deleteDir, deleteSubPath and deleteFilesParallelize.
   
   ### Impact
   
   Theoretically no impact.
   
   ### Risk level (write none, low medium or high below)
   
   none.
   
   ### Documentation Update
   
   _Describe any necessary documentation update if there is any new feature, config, or user-facing change_
   
   - _The config description must be updated if new configs are added or the default value of the configs are changed_
   - _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
     ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
     changes to the website._
   
   ### 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


Re: [PR] [HUDI-7151] Modify the "fs.delete" to prioritize moving paths and files under distributed file systems to the trash instead of directly deleting them [hudi]

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


##########
hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java:
##########
@@ -887,4 +888,28 @@ public interface SerializableFunction<T, R> extends Function<T, R>, Serializable
   private static Option<HoodieLogFile> getLatestLogFile(Stream<HoodieLogFile> logFiles) {
     return Option.fromJavaOptional(logFiles.min(HoodieLogFile.getReverseLogFileComparator()));
   }
+
+  /**
+   * Delete a file or move the file and path to the trash when on the distributed file system.
+   *
+   * @param fs                  {@link FileSystem} instance.
+   * @param relativeFilePath    Path to delete.
+   * @param recursive           If path is a directory and set to true, the directory is deleted else throws an exception. In case of a file the recursive can be set to either true or false.
+   * @return true if delete is successful else false.
+   */
+  public static boolean handleFileSystemDeletion(FileSystem fs, Path relativeFilePath, Boolean recursive) throws IOException {

Review Comment:
   There are actually usages that are using `fs.delete` directly. 
   
   For example:
   
   https://github.com/apache/hudi/blob/9d9a9a302077b7beb7b1f309c1278638a3f11fb8/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala#L856-L873
   
   Would it be better if we also modify direct calls `fs.delete` to use `FSUtils.handleFileSystemDeletion` directly in this PR? 
   



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


Re: [PR] [HUDI-7151] Modify the "fs.delete" to prioritize moving paths and files under distributed file systems to the trash instead of directly deleting them [hudi]

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "49819f4394ed57124e1671ac0e78257432cd2406",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21487",
       "triggerID" : "49819f4394ed57124e1671ac0e78257432cd2406",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 49819f4394ed57124e1671ac0e78257432cd2406 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21487) 
   
   <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


Re: [PR] [HUDI-7151] Modify the "fs.delete" to prioritize moving paths and files under distributed file systems to the trash instead of directly deleting them [hudi]

Posted by "LeshracTheMalicious (via GitHub)" <gi...@apache.org>.
LeshracTheMalicious closed pull request #10322: [HUDI-7151] Modify the "fs.delete" to prioritize moving paths and files under distributed file systems to the trash instead of directly deleting them
URL: https://github.com/apache/hudi/pull/10322


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


Re: [PR] [HUDI-7151] Modify the "fs.delete" to prioritize moving paths and files under distributed file systems to the trash instead of directly deleting them [hudi]

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "49819f4394ed57124e1671ac0e78257432cd2406",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21487",
       "triggerID" : "49819f4394ed57124e1671ac0e78257432cd2406",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 49819f4394ed57124e1671ac0e78257432cd2406 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21487) 
   
   <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


Re: [PR] [HUDI-7151] Modify the "fs.delete" to prioritize moving paths and files under distributed file systems to the trash instead of directly deleting them [hudi]

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "49819f4394ed57124e1671ac0e78257432cd2406",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "49819f4394ed57124e1671ac0e78257432cd2406",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 49819f4394ed57124e1671ac0e78257432cd2406 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