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

LocalFileSystem rename() is broken in some cases when destination exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1-win, 2.1.0-beta, 1.3.0, 3.0.0-alpha1
    • 1-win, 2.1.0-beta, 1.3.0
    • fs
    • None

    Description

      The rename() method in RawLocalFileSystem uses FileUtil.copy() without realizing that FileUtil.copy() has a special behavior that if you're copying /foo to /bar and /bar exists and is a directory, it'll copy /foo inside /bar instead of overwriting it, which is not what rename() wants. So you end up with weird behaviors like in this repro:

      c:
      cd \
      md Foo
      md Bar
      md Foo\X
      md Bar\X
      hadoop fs -mv file:///c:/Foo file:///c:/Bar
      

      At the end of this, you would expect to find only Bar\X, but you instead find Bar\X\X.

      Attachments

        1. HADOOP-9507.branch-1-win.patch
          7 kB
          Mostafa Elhemali
        2. HADOOP-9507-branch-1.1.patch
          6 kB
          Chris Nauroth
        3. HADOOP-9507-branch-1.3.patch
          6 kB
          Chris Nauroth
        4. HADOOP-9507-branch-1.4.patch
          6 kB
          Chris Nauroth
        5. HADOOP-9507-branch-1.5.patch
          6 kB
          Chris Nauroth
        6. HADOOP-9507-branch-1-win.1.patch
          7 kB
          Chris Nauroth
        7. HADOOP-9507-branch-1-win.3.patch
          7 kB
          Chris Nauroth
        8. HADOOP-9507-branch-1-win.4.patch
          7 kB
          Chris Nauroth
        9. HADOOP-9507-branch-1-win.5.patch
          7 kB
          Chris Nauroth
        10. HADOOP-9507-trunk.1.patch
          5 kB
          Chris Nauroth
        11. HADOOP-9507-trunk.2.patch
          5 kB
          Chris Nauroth
        12. HADOOP-9507-trunk.3.patch
          5 kB
          Chris Nauroth
        13. HADOOP-9507-trunk.4.patch
          5 kB
          Chris Nauroth
        14. HADOOP-9507-trunk.5.patch
          5 kB
          Chris Nauroth

        Issue Links

          Activity

            People

              cnauroth Chris Nauroth
              mostafae Mostafa Elhemali
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: