[
https://issues.apache.org/jira/browse/HDFS-11156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15739324#comment-15739324
]
Weiwei Yang commented on HDFS-11156:
------------------------------------
Hello [~andrew.wang]
Thanks for the comments, here
bq. We don't need to close the FS in NamenodeWebHdfsMethods
Fixed that in v13 patch.
bq. offset and length are both required parameters for the FileSystem API. We
should require them here too. I don't know why GET_BLOCK_LOCATIONS allows a
null length, since they're both required in the PB RPC format too. A test for
this would be good.
Current behavior allows user to submit a http request with or without
{{offset}} and {{length}} parameters, so "op=GET_BLOCK_LOCATIONS" and
"op=GET_BLOCK_LOCATIONS&offset=0&length=..." both works. The default value for
OffsetParam is 0 but default value for LengthParam is null, I think that was
why length has an additional check on null value. I did not change this in v13
patch, otherwise we are not 100% backwards compatible. I added some tests in
{{TestWebHDFS}} to make sure both forms of rest call works. Hope that is enough
for this.
bq. typo "Loactions" in comment in TestWebHDFS
Fixed that in v13 patch.
Thanks.
> Add new op GETFILEBLOCKLOCATIONS to WebHDFS REST API
> ----------------------------------------------------
>
> Key: HDFS-11156
> URL: https://issues.apache.org/jira/browse/HDFS-11156
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: webhdfs
> Affects Versions: 2.7.3
> Reporter: Weiwei Yang
> Assignee: Weiwei Yang
> Attachments: BlockLocationProperties_JSON_Schema.jpg,
> BlockLocations_JSON_Schema.jpg, FileStatuses_JSON_Schema.jpg,
> HDFS-11156.01.patch, HDFS-11156.02.patch, HDFS-11156.03.patch,
> HDFS-11156.04.patch, HDFS-11156.05.patch, HDFS-11156.06.patch,
> HDFS-11156.07.patch, HDFS-11156.08.patch, HDFS-11156.09.patch,
> HDFS-11156.10.patch, HDFS-11156.11.patch, HDFS-11156.12.patch,
> HDFS-11156.13.patch, Output_JSON_format_v10.jpg, SampleResponse_JSON.jpg
>
>
> Following webhdfs REST API
> {code}
> http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=GET_BLOCK_LOCATIONS&offset=0&length=1
> {code}
> will get a response like
> {code}
> {
> "LocatedBlocks" : {
> "fileLength" : 1073741824,
> "isLastBlockComplete" : true,
> "isUnderConstruction" : false,
> "lastLocatedBlock" : { ... },
> "locatedBlocks" : [ {...} ]
> }
> }
> {code}
> This represents for *o.a.h.h.p.LocatedBlocks*. However according to
> *FileSystem* API,
> {code}
> public BlockLocation[] getFileBlockLocations(Path p, long start, long len)
> {code}
> clients would expect an array of BlockLocation. This mismatch should be
> fixed. Marked as Incompatible change as this will change the output of the
> GET_BLOCK_LOCATIONS API.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]