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

DelegateToFileSystem should implement getFsStatus(final Path f).

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.7.0
    • fs
    • None

    Description

      DelegateToFileSystem only implemented getFsStatus() and didn't implement getFsStatus(final Path f). So if you call getFsStatus(final Path f), it will call AbstractFileSystem.getFsStatus(final Path f) which will also call DelegateToFileSystem.getFsStatus(). It should implement getFsStatus(final Path f) to call fsImpl.getStatus(f) instead of calling fsImpl.getStatus() from getFsStatus().
      Also based on the following description for FileContext.getFsStatus:

       
      /**
         * Returns a status object describing the use and capacity of the
         * file system denoted by the Parh argument p.
         * If the file system has multiple partitions, the
         * use and capacity of the partition pointed to by the specified
         * path is reflected.
         * 
         * @param f Path for which status should be obtained. null means the
         * root partition of the default file system. 
         *
         * @return a FsStatus object
         *
         * @throws AccessControlException If access is denied
         * @throws FileNotFoundException If <code>f</code> does not exist
         * @throws UnsupportedFileSystemException If file system for <code>f</code> is
         *           not supported
         * @throws IOException If an I/O error occurred
         * 
         * Exceptions applicable to file systems accessed over RPC:
         * @throws RpcClientException If an exception occurred in the RPC client
         * @throws RpcServerException If an exception occurred in the RPC server
         * @throws UnexpectedServerException If server implementation throws 
         *           undeclared exception to RPC server
         */
        public FsStatus getFsStatus(final Path f) throws AccessControlException,
            FileNotFoundException, UnsupportedFileSystemException, IOException {
          if (f == null) {
            return defaultFS.getFsStatus();
          }
          final Path absF = fixRelativePart(f);
          return new FSLinkResolver<FsStatus>() {
            @Override
            public FsStatus next(final AbstractFileSystem fs, final Path p) 
              throws IOException, UnresolvedLinkException {
              return fs.getFsStatus(p);
            }
          }.resolve(this, absF);
        }
      

      we should differentiate getFsStatus(final Path f) from getFsStatus() in DelegateToFileSystem.

      Attachments

        1. HADOOP-11156.000.patch
          0.7 kB
          Zhihai Xu

        Activity

          People

            zxu Zhihai Xu
            zxu Zhihai Xu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: