Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-10982

'errno' set on successful code path in hdfsOpenFileImpl()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.0
    • None
    • libhdfs

    Description

      In hdfsOpenFileImpl() in libhdfs/hdfs.c, the following code is used to check if the underlying FileSystem class supports direct reads (i.e. read(ByteBuffer)):

          if ((flags & O_WRONLY) == 0) {
              // Try a test read to see if we can do direct reads
              char buf;
              if (readDirect(fs, file, &buf, 0) == 0) {
                  // Success - 0-byte read should return 0
                  file->flags |= HDFS_FILE_SUPPORTS_DIRECT_READ;
              } else if (errno != ENOTSUP) {
                  // Unexpected error. Clear it, don't set the direct flag.
                  fprintf(stderr,
                        "hdfsOpenFile(%s): WARN: Unexpected error %d when testing "
                        "for direct read compatibility\n", path, errno);
              }
          }
          ret = 0;
      

      The S3A connector, specifically S3AInputStream does not support direct reads, and therefore it sets 'errno = ENOTSUP' on a call to readDirect().

      This 'errno' should be reset before returning the call because this is not an actual error and we're okay with not having direct reads supported.

      Attachments

        Activity

          People

            jzhuge John Zhuge
            sailesh Sailesh Mukil
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: