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

Elek, Marton commented on HDDS-517:
-----------------------------------

Thanks you very much [~GeLiXin] the patch. Overall it looks good to me, but I 
have some comments about the implementation:

1. My biggest problem, I don't know how does the aws work exactly. According to 
the documentation and the rest pattern by default HEAD request returns 
*without* the body. But (based on the documentation) it's possible that in some 
cases (Range headers?) the body is also added, but I need to test it.

2. I think 'body = bucket.readKey(keyPath);' won't work. Fix me If I am wrong, 
but I think an OutputStream should be used for the body output and the bytes 
should be copied there. Here only the reference of the input body is 
overwritten.

3. I think Content-Length should be 0 in case of missing body.

4. The Date should be (IMHO) the current date.

5. It's not clear why do you need the s3ResMeta (and why do you need the aws 
sdk dependency). Seems to be easier to use just ' .header("x-amz-request-id",  
RandomStringUtils.randomAlphanumeric(15, 33))' (Or I missed something. Or it 
comes from an earlier experiment)

6. x-amz-* requests could be added to CommonHeadersContainerResponseFilter. In 
that case all the REST responses will include them,

7. As [~bharatviswa] wrote the HDDS-560 is (in the meantime) committed. So you 
can throw a typed exception in case of missing key (see HeadBucket for an 
example). Sorry it was a parallel effort.
 
8. Currently I didn't get 404 in in case of missing key. I think the "not 
found" pattern should be modified to "NOT_FOUND". But this is just my guess.


For the sake of the simplicity I suggest to skip the support of the body 
returning. It requires more time to investigate how the current AWS s3 endpoint 
works. It would fix (1.)/(2.) and we can commit this patch after all the small 
header fixes. 


ps:

I tested the 404 with:

{code}
cd hadoop-ozone/dist/target/ozone-0.3.0-SNAPSHOT/compose/ozones3
docker-compose up -d
docker-compose exec scm ozone sh volume create /vol1 --user hadoop
docker-compose exec scm ozone sh bucket create /vol1/bucket
curl -v -I  http://localhost:9878/vol1/bucket/qwe
{code}

> Implement HeadObject REST endpoint
> ----------------------------------
>
>                 Key: HDDS-517
>                 URL: https://issues.apache.org/jira/browse/HDDS-517
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Elek, Marton
>            Assignee: LiXin Ge
>            Priority: Major
>              Labels: newbie
>         Attachments: HDDS-517.000.patch
>
>
> The HEAD operation retrieves metadata from an object without returning the 
> object itself. This operation is useful if you are interested only in an 
> object's metadata. To use HEAD, you must have READ access to the object.
> Steps:
>  1. Look up the volume
>  2. Read the key and return to the user.
> The AWS reference is here:
> https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html
> We have a simple version of this call in HDDS-444 but without Range support.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to