Steve Loughran commented on HADOOP-13884:

* Moot for S3Guard
* For raw S3, that initial HEAD $path is faster than doing a list, so if you 
are overwriting a file you are doing a HEAD $path/ and a LIST path (two calls, 
one slower), and there'll be no negative caching anyway.

We'd be increasing the cost of overwriting an existing file, but reducing the 
cost of creating a new file and risk of caching 404, so in some codepaths 
things would get better, some would get worse

The safest way to handle this would be add a hint in file creation to say "this 
create doesn't expect the dest to exist" vs "this create expects a file at the 
dest" or even "don't bother with any exists checks at all", which is what is 
secretly done in the commit code via WriteOperationsHelper offering a put() API 

> s3a create(overwrite=true) to only look for dir/ and list entries, not file
> ---------------------------------------------------------------------------
>                 Key: HADOOP-13884
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13884
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3
>    Affects Versions: 2.9.0
>            Reporter: Steve Loughran
>            Priority: Minor
> before doing a create(), s3a does a getFileStatus() to make sure there isn't 
> a directory there, and, if overwrite=false, that there isn't a file.
> Because S3 caches negative HEAD/GET requests, if there isn't a file, then 
> even after the PUT, a later GET/HEAD may return 404; we are generating create 
> consistency where none need exist. 
> when overwrite=true we don't care whether the file exists or not, only that 
> the path isn't a directory. So we can just do the HEAD path +"/' and the LIST 
> calls, skipping the {{HEAD path}}. This will save an HTTP round trip of a few 
> hundred millis, and ensure that there's no 404 cached in the S3 front end for 
> later callers

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to