[jira] [Updated] (HADOOP-13430) Optimize and fix getFileStatus in S3A

2016-08-18 Thread Steve Loughran (JIRA)

 [ 
https://issues.apache.org/jira/browse/HADOOP-13430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steve Loughran updated HADOOP-13430:

Assignee: Steven K. Wong

> Optimize and fix getFileStatus in S3A
> -
>
> Key: HADOOP-13430
> URL: https://issues.apache.org/jira/browse/HADOOP-13430
> Project: Hadoop Common
>  Issue Type: Sub-task
>  Components: fs/s3
>Affects Versions: 2.8.0
>Reporter: Steven K. Wong
>Assignee: Steven K. Wong
>Priority: Minor
> Attachments: HADOOP-13430.001.WIP.patch
>
>
> Currently, S3AFileSystem.getFileStatus(Path f) sends up to 3 requests to S3 
> when pathToKey(f) = key = "foo/bar" is a directory:
> 1. HEAD key=foo/bar \[continue if not found]
> 2. HEAD key=foo/bar/ \[continue if not found]
> 3. LIST prefix=foo/bar/ delimiter=/ max-keys=1
> My experience (and generally true, I reckon) is that almost all directories 
> are nonempty directories without a "fake directory" file (e.g. "foo/bar/"). 
> Under this condition, request #2 is mostly unhelpful; it only slows down 
> getFileStatus. Therefore, I propose swapping the order of requests #2 and #3. 
> The swapped HEAD request will be skipped in practically all cases.
> Furthermore, when key = "foo/bar" is a nonempty directory that contains a 
> "fake directory" file (in addition to actual files), getFileStatus currently 
> returns an S3AFileStatus with isEmptyDirectory=true, which is wrong. Swapping 
> will fix this. The swapped LIST request will use max-keys=2 to determine 
> isEmptyDirectory correctly. (Removing the delimiter from the LIST request 
> should make the logic a little simpler than otherwise.)
> Note that key = "foo/bar/" has the same problem with isEmptyDirectory. To fix 
> it, I propose skipping request #1 when key ends with "/". The price is this 
> will, for an empty directory, replace a HEAD request with a LIST request 
> that's generally more taxing on S3.



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

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



[jira] [Updated] (HADOOP-13430) Optimize and fix getFileStatus in S3A

2016-08-04 Thread Steven K. Wong (JIRA)

 [ 
https://issues.apache.org/jira/browse/HADOOP-13430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steven K. Wong updated HADOOP-13430:

Description: 
Currently, S3AFileSystem.getFileStatus(Path f) sends up to 3 requests to S3 
when pathToKey(f) = key = "foo/bar" is a directory:

1. HEAD key=foo/bar \[continue if not found]
2. HEAD key=foo/bar/ \[continue if not found]
3. LIST prefix=foo/bar/ delimiter=/ max-keys=1

My experience (and generally true, I reckon) is that almost all directories are 
nonempty directories without a "fake directory" file (e.g. "foo/bar/"). Under 
this condition, request #2 is mostly unhelpful; it only slows down 
getFileStatus. Therefore, I propose swapping the order of requests #2 and #3. 
The swapped HEAD request will be skipped in practically all cases.

Furthermore, when key = "foo/bar" is a nonempty directory that contains a "fake 
directory" file (in addition to actual files), getFileStatus currently returns 
an S3AFileStatus with isEmptyDirectory=true, which is wrong. Swapping will fix 
this. The swapped LIST request will use max-keys=2 to determine 
isEmptyDirectory correctly. (Removing the delimiter from the LIST request 
should make the logic a little simpler than otherwise.)

Note that key = "foo/bar/" has the same problem with isEmptyDirectory. To fix 
it, I propose skipping request #1 when key ends with "/". The price is this 
will, for an empty directory, replace a HEAD request with a LIST request that's 
generally more taxing on S3.



  was:
Currently, S3AFileSystem.getFileStatus(Path f) sends up to 3 requests to S3 
when pathToKey(f) = key = "foo/bar" is a directory:

1. HEAD key=foo/bar \[continue if not found]
2. HEAD key=foo/bar/ \[continue if not found]
3. LIST prefix=foo/bar/ delimiter=/ max-keys=1

My experience (and generally true, I reckon) is that almost all directories are 
nonempty directories without a "fake directory" file (e.g. "foo/bar/"). Under 
this condition, request #2 is mostly unhelpful; it only slows down 
getFileStatus. Therefore, I propose swapping the order of requests #2 and #3.

Furthermore, when key = "foo/bar" is a nonempty directory that contains a "fake 
directory" file (in addition to actual files), getFileStatus currently returns 
an S3AFileStatus with isEmptyDirectory=true, which is wrong. Swapping will fix 
this. The swapped LIST request will use max-keys=2 to determine 
isEmptyDirectory correctly. The swapped HEAD request will be skipped if the 
directory is empty. (Removing the delimiter from the LIST request should make 
the logic a little simpler than otherwise.)

Note that key = "foo/bar/" has the same problem with isEmptyDirectory. To fix 
it, I propose skipping request #1 when key ends with "/". The price is this 
will, for an empty directory, replace a HEAD request with a LIST request that's 
generally more taxing on S3.




> Optimize and fix getFileStatus in S3A
> -
>
> Key: HADOOP-13430
> URL: https://issues.apache.org/jira/browse/HADOOP-13430
> Project: Hadoop Common
>  Issue Type: Sub-task
>  Components: fs/s3
>Affects Versions: 2.8.0
>Reporter: Steven K. Wong
>Priority: Minor
> Attachments: HADOOP-13430.001.WIP.patch
>
>
> Currently, S3AFileSystem.getFileStatus(Path f) sends up to 3 requests to S3 
> when pathToKey(f) = key = "foo/bar" is a directory:
> 1. HEAD key=foo/bar \[continue if not found]
> 2. HEAD key=foo/bar/ \[continue if not found]
> 3. LIST prefix=foo/bar/ delimiter=/ max-keys=1
> My experience (and generally true, I reckon) is that almost all directories 
> are nonempty directories without a "fake directory" file (e.g. "foo/bar/"). 
> Under this condition, request #2 is mostly unhelpful; it only slows down 
> getFileStatus. Therefore, I propose swapping the order of requests #2 and #3. 
> The swapped HEAD request will be skipped in practically all cases.
> Furthermore, when key = "foo/bar" is a nonempty directory that contains a 
> "fake directory" file (in addition to actual files), getFileStatus currently 
> returns an S3AFileStatus with isEmptyDirectory=true, which is wrong. Swapping 
> will fix this. The swapped LIST request will use max-keys=2 to determine 
> isEmptyDirectory correctly. (Removing the delimiter from the LIST request 
> should make the logic a little simpler than otherwise.)
> Note that key = "foo/bar/" has the same problem with isEmptyDirectory. To fix 
> it, I propose skipping request #1 when key ends with "/". The price is this 
> will, for an empty directory, replace a HEAD request with a LIST request 
> that's generally more taxing on S3.



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

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

[jira] [Updated] (HADOOP-13430) Optimize and fix getFileStatus in S3A

2016-08-04 Thread Steven K. Wong (JIRA)

 [ 
https://issues.apache.org/jira/browse/HADOOP-13430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steven K. Wong updated HADOOP-13430:

Attachment: HADOOP-13430.001.WIP.patch

HADOOP-13430.001.WIP.patch - It's a work in progress. Early feedback welcome.

> Optimize and fix getFileStatus in S3A
> -
>
> Key: HADOOP-13430
> URL: https://issues.apache.org/jira/browse/HADOOP-13430
> Project: Hadoop Common
>  Issue Type: Sub-task
>  Components: fs/s3
>Affects Versions: 2.8.0
>Reporter: Steven K. Wong
>Priority: Minor
> Attachments: HADOOP-13430.001.WIP.patch
>
>
> Currently, S3AFileSystem.getFileStatus(Path f) sends up to 3 requests to S3 
> when pathToKey(f) = key = "foo/bar" is a directory:
> 1. HEAD key=foo/bar \[continue if not found]
> 2. HEAD key=foo/bar/ \[continue if not found]
> 3. LIST prefix=foo/bar/ delimiter=/ max-keys=1
> My experience (and generally true, I reckon) is that almost all directories 
> are nonempty directories without a "fake directory" file (e.g. "foo/bar/"). 
> Under this condition, request #2 is mostly unhelpful; it only slows down 
> getFileStatus. Therefore, I propose swapping the order of requests #2 and #3.
> Furthermore, when key = "foo/bar" is a nonempty directory that contains a 
> "fake directory" file (in addition to actual files), getFileStatus currently 
> returns an S3AFileStatus with isEmptyDirectory=true, which is wrong. Swapping 
> will fix this. The swapped LIST request will use max-keys=2 to determine 
> isEmptyDirectory correctly. The swapped HEAD request will be skipped if the 
> directory is empty. (Removing the delimiter from the LIST request should make 
> the logic a little simpler than otherwise.)
> Note that key = "foo/bar/" has the same problem with isEmptyDirectory. To fix 
> it, I propose skipping request #1 when key ends with "/". The price is this 
> will, for an empty directory, replace a HEAD request with a LIST request 
> that's generally more taxing on S3.



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

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



[jira] [Updated] (HADOOP-13430) Optimize and fix getFileStatus in S3A

2016-07-27 Thread Steve Loughran (JIRA)

 [ 
https://issues.apache.org/jira/browse/HADOOP-13430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steve Loughran updated HADOOP-13430:

Issue Type: Sub-task  (was: Improvement)
Parent: HADOOP-13204

> Optimize and fix getFileStatus in S3A
> -
>
> Key: HADOOP-13430
> URL: https://issues.apache.org/jira/browse/HADOOP-13430
> Project: Hadoop Common
>  Issue Type: Sub-task
>  Components: fs/s3
>Affects Versions: 2.8.0
>Reporter: Steven K. Wong
>Priority: Minor
>
> Currently, S3AFileSystem.getFileStatus(Path f) sends up to 3 requests to S3 
> when pathToKey(f) = key = "foo/bar" is a directory:
> 1. HEAD key=foo/bar \[continue if not found]
> 2. HEAD key=foo/bar/ \[continue if not found]
> 3. LIST prefix=foo/bar/ delimiter=/ max-keys=1
> My experience (and generally true, I reckon) is that almost all directories 
> are nonempty directories without a "fake directory" file (e.g. "foo/bar/"). 
> Under this condition, request #2 is mostly unhelpful; it only slows down 
> getFileStatus. Therefore, I propose swapping the order of requests #2 and #3.
> Furthermore, when key = "foo/bar" is a nonempty directory that contains a 
> "fake directory" file (in addition to actual files), getFileStatus currently 
> returns an S3AFileStatus with isEmptyDirectory=true, which is wrong. Swapping 
> will fix this. The swapped LIST request will use max-keys=2 to determine 
> isEmptyDirectory correctly. The swapped HEAD request will be skipped if the 
> directory is empty. (Removing the delimiter from the LIST request should make 
> the logic a little simpler than otherwise.)
> Note that key = "foo/bar/" has the same problem with isEmptyDirectory. To fix 
> it, I propose skipping request #1 when key ends with "/". The price is this 
> will, for an empty directory, replace a HEAD request with a LIST request 
> that's generally more taxing on S3.



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

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