Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-11694 Über-jira: S3a phase II: robustness, scale and performance
  3. HADOOP-12169

ListStatus on empty dir in S3A lists itself instead of returning an empty list

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0, 2.7.0, 2.7.1
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: fs/s3
    • Labels:
      None
    • Flags:
      Patch

      Description

      Upon testing the patch for HADOOP-11918, I stumbled upon a weird behaviour this introduces to the S3AFileSystem-class. Calling ListStatus() on an empty bucket returns an empty list, while doing the same on an empty directory, returns an array of length 1 containing only this directory itself.

      The bugfix is quite simple. In the line of code

      ...if (keyPath.equals(f)...

      (S3AFileSystem:758), keyPath is qualified wrt. the fs and f is not. Therefore, this returns false while it shouldn't. The bugfix to make f qualified in this line of code.

      More formally: accoring to the formal definition of The Hadoop FileSystem API Definition, more specifically FileSystem.listStatus, only child elements of a directory should be returned upon a listStatus()-call.

      In detail:

      elif isDir(FS, p): result [getFileStatus(c) for c in children(FS, p) where f(c) == True]
      

      and

      def children(FS, p) = {q for q in paths(FS) where parent(q) == p}
      

      Which translates to the result of listStatus on an empty directory being an empty list. This is the same behaviour as ls has in Unix, which is what someone would expect from a FileSystem.

      Note: it seemed appropriate to add the test of this patch to the same file as the test for HADOOP-11918, but as a result, one of the two will have to be rebased wrt. the other before being applied to trunk.

        Attachments

        1. HADOOP-12169-002.patch
          6 kB
          Pieter Reuse
        2. HADOOP-12169-001.patch
          3 kB
          Pieter Reuse

          Issue Links

            Activity

              People

              • Assignee:
                PieterReuse Pieter Reuse
                Reporter:
                PieterReuse Pieter Reuse
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: