Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-15361

RawLocalFileSystem should use Java nio framework for rename

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Currently RawLocalFileSystem uses a fallback logic for cross-volume renames. The fallback logic is a copy-on-fail logic so when rename fails it copies the source then delete it.
      An additional fallback logic was needed for Windows to provide POSIX rename behavior.

      Due to the fallback logic RawLocalFileSystem does not pass the contract tests (HADOOP-13082).

      With using Java nio framework both could be eliminated since it is not platform dependent and provides cross-volume rename.

      In addition the fallback logic for Windows is not correct since Java io overrides the destination only if the source is also a directory but handleEmptyDstDirectoryOnWindows method checks only the destination. That means rename allows to override a directory with a file on Windows but not on Unix.

      File#renameTo and Files#move are not 100% compatible:
      If the source is a directory and the destination is an empty directory File#renameTo overrides the source but Files#move is does not. We have to use StandardCopyOption.REPLACE_EXISTING but it overrides the destination even if the source or the destination is a file. So to make them compatible we have to check that the either the source or the destination is a directory before we add the copy option.

      I think the correct strategy is

      • Where the contract test passed so far it should pass after this
      • Where the contract test failed because of Java specific think and not because of the fallback logic we should keep the original behavior.

      Attachments

        1. HADOOP-15361.01.patch
          13 kB
          Andras Bokor
        2. HADOOP-15361.02.patch
          17 kB
          Andras Bokor
        3. HADOOP-15361.03.patch
          17 kB
          Andras Bokor
        4. HADOOP-15361.04.patch
          17 kB
          Andras Bokor

        Activity

          People

            boky01 Andras Bokor
            boky01 Andras Bokor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: