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

Need translate java.nio.file.NoSuchFileException to FileNotFoundException to avoid regression

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: fs
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      need translate java.nio.file.NoSuchFileException to FileNotFoundException to avoid regression.
      HADOOP-12045 adds nio to support access time, but nio will create java.nio.file.NoSuchFileException instead of FileNotFoundException.
      many hadoop codes depend on FileNotFoundException to decide whether a file exists. for example FileContext.util().exists().

          public boolean exists(final Path f) throws AccessControlException,
            UnsupportedFileSystemException, IOException {
            try {
              FileStatus fs = FileContext.this.getFileStatus(f);
              assert fs != null;
              return true;
            } catch (FileNotFoundException e) {
              return false;
            }
          }
      

      same for FileSystem#exists

        public boolean exists(Path f) throws IOException {
          try {
            return getFileStatus(f) != null;
          } catch (FileNotFoundException e) {
            return false;
          }
        }
      

      NoSuchFileException will break these functions.
      Since exists is one of the most used API in FileSystem, this issue is very critical.

      Several test failures for TestDeletionService are caused by this issue:
      https://builds.apache.org/job/PreCommit-YARN-Build/8630/testReport/org.apache.hadoop.yarn.server.nodemanager/TestDeletionService/testRelativeDelete/
      https://builds.apache.org/job/PreCommit-YARN-Build/8632/testReport/org.apache.hadoop.yarn.server.nodemanager/TestDeletionService/testAbsDelete/

        Attachments

        1. HADOOP-12258.002.patch
          22 kB
          zhihai xu
        2. HADOOP-12258.001.patch
          26 kB
          zhihai xu
        3. HADOOP-12258.000.patch
          3 kB
          zhihai xu

          Issue Links

            Activity

              People

              • Assignee:
                zxu zhihai xu
                Reporter:
                zxu zhihai xu
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: