Github user tejasapatil commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13042#discussion_r63051771
  
    --- Diff: 
common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java
 ---
    @@ -79,14 +81,32 @@ public static String bytesToString(ByteBuffer b) {
         return Unpooled.wrappedBuffer(b).toString(StandardCharsets.UTF_8);
       }
     
    -  /*
    +  /**
        * Delete a file or directory and its contents recursively.
        * Don't follow directories if they are symlinks.
    -   * Throws an exception if deletion is unsuccessful.
    +   *
    +   * @param file Input file / dir to be deleted
    +   * @throws IOException if deletion is unsuccessful
        */
       public static void deleteRecursively(File file) throws IOException {
         if (file == null) { return; }
     
    +    // On Unix systems, use operating system command to run faster
    +    // If that does not work out, fallback to the Java IO way
    +    if (SystemUtils.IS_OS_UNIX) {
    +      try {
    +        deleteRecursivelyUsingUnixNative(file);
    +        return;
    +      } catch (IOException e) {
    +        logger.warn("Attempt to delete using native Unix OS command failed 
for path = {}. " +
    +                        "Falling back to Java IO way", 
file.getAbsolutePath(), e);
    +      }
    +    }
    +
    +    deleteRecursivelyUsingJavaIO(file);
    --- End diff --
    
    - I kept it outside catch because we need to also take care of case when 
the OS is non unix
    - Reverted removing the blank line near the end of file


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to