You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Steve Loughran (JIRA)" <ji...@apache.org> on 2016/10/12 10:13:21 UTC
[jira] [Commented] (HADOOP-13712) S3A open to avoid needless HEAD
on the successful execution path
[ https://issues.apache.org/jira/browse/HADOOP-13712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15568300#comment-15568300 ]
Steve Loughran commented on HADOOP-13712:
-----------------------------------------
Pseudo-code
{code}
OutputStream open(path) {
if (!path.endsWith."/") {
try {
return GET path
} catch (404) {
// not a file
}
}
// either no file or looking for "/", fallback for exception
// this will raise the FNFE if the path isn't there
S3AFileStatus status = getFileStatus(path);
if (status.isDirectory()) {
throw new PathIsDirectoryException(path);
} else {
// we could only get here if there wasn't a file before, but there is now.
// Race condition? And how to react? Recursion?
}
}
{code}
> S3A open to avoid needless HEAD on the successful execution path
> ----------------------------------------------------------------
>
> Key: HADOOP-13712
> URL: https://issues.apache.org/jira/browse/HADOOP-13712
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs/s3
> Affects Versions: 2.7.3
> Reporter: Steve Loughran
>
> S3A's open() operation does a {{getFileStatus()}} check to see if a file is not a directory before opening with a GET. That initial check will take up at least one HEAD request if the file is present, more if it isn't.
> As the GET itself performs the existence check, it is needless. A successful GET of a path which doesn't end in "/" means a file was there. The only reason a getFileStatus call is needed is to choose which error message to display if the path isn't there: is it an FNFE or is it path-is-directory.
> Proposed: reorder the code to do the GET; only if that fails fallback to getFileStatus()
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org