Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-16829 Über-jira: S3A Hadoop 3.3.1 features
  3. HADOOP-17200

Renaming a file under a sibling empty directory doesn't delete dest dir's marker

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.3.0, 3.2.1, 3.1.3
    • 3.3.1
    • fs/s3
    • None

    Description

      This has probably existed for a long time -the fact that nobody has noticed is probably just luck.

      Probably came with the fix of HADOOP-15079.

      Given

      • a base directory /base
      • A file /base/file
      • an empty directory /base/empty (with empty dir marker)
      • if you rename base/file under base/empty (key: with the dir passed in, not the full filename) the file is moved, but the marker /base/empty/ is not

      The issue is that the delete/recreate markers compares src and dest parent for equivalence when skipping marker delete, but if the final path of the rename is under the path "dst" then the comparison is wrong -it must be on the parent of the final path, not the path handed to rename()

          if (!src.getParent().equals(dst.getParent())) {
            LOG.debug("source & dest parents are different; fix up dir markers");
            deleteUnnecessaryFakeDirectories(dst.getParent());
            maybeCreateFakeParentDirectory(src);
          }
      

      Attachments

        Issue Links

          Activity

            People

              stevel@apache.org Steve Loughran
              stevel@apache.org Steve Loughran
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: