You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "John Zhuge (JIRA)" <ji...@apache.org> on 2016/10/10 05:02:20 UTC

[jira] [Commented] (HDFS-10982) 'errno' set on successful code path in hdfsOpenFileImpl()

    [ https://issues.apache.org/jira/browse/HDFS-10982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15561281#comment-15561281 ] 

John Zhuge commented on HDFS-10982:
-----------------------------------

The only other {{readDirect}} call in {{hdfsRead}} is fine because it does want to pass along {{ENOTSUP}}
{code:title=hdfsRead}
    if (f->flags & HDFS_FILE_SUPPORTS_DIRECT_READ) {
      return readDirect(fs, f, buffer, length);
    }
{code}

> 'errno' set on successful code path in hdfsOpenFileImpl()
> ---------------------------------------------------------
>
>                 Key: HDFS-10982
>                 URL: https://issues.apache.org/jira/browse/HDFS-10982
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: libhdfs
>    Affects Versions: 2.7.0
>            Reporter: Sailesh Mukil
>            Assignee: John Zhuge
>              Labels: easyfix
>
> 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)):
> {code:java}
>     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;
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org