[
https://issues.apache.org/jira/browse/HADOOP-13884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16837281#comment-16837281
]
Steve Loughran edited comment on HADOOP-13884 at 5/10/19 1:27 PM:
------------------------------------------------------------------
Revisiting:
#. sometimes that negative entry can last minutes rather than a few seconds.
# we also do existence checks on rename, so the same risk can occur there: you
copy to a destination and the new file isn't immediately visible.
Proposed: a new operation checkIsNotDirectory(key): boolean. which returns true
if there is either nothing at the far end or a file, that is "no directory
entry"
we can have a sequence of
* S3Guard: check the store to make sure it's not a directory entry.
* S3: HEAD key + "/"; LIST key.
Use in createFile and when renaming a file on rename/2 if the source is a file.
It's a bit odder on rename/2 as if the dest is a directory it is inserted
underneath. on
Rename 3 copy(file, dest) will fail if one of
* isDirectory(dest)
* isFile(dest) and !overwrite
This makes it possible to use the {{checkIsNotDirectory(key):}} probe when
source is file and overwrite is true.
was (Author: [email protected]):
Revisiting:
#. sometimes that negative entry can last minutes rather than a few seconds.
# we also do existence checks on rename, so the same risk can occur there: you
copy to a destination and the new file isn't immediately visible.
Proposed: a new operation checkIsNotDirectory(key): boolean. which returns true
if there is either nothing at the far end or a file, that is "no directory
entry"
we can have a sequence of
* S3Guard: check the store to make sure it's not a directory entry.
* S3: HEAD key + "/"; LIST key.
*
> 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
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]