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

Weiwei Yang commented on HDFS-6874:
-----------------------------------

Hi [~elgoiri]

The changes in webHdfsFileSystem was for the downward compatibility. Without 
this, 

Both {{TestHttpFSFWithWebhdfsFileSystem}} and 
{{TestHttpFSFWithSWebhdfsFileSystem}} will fail when operation is 
{{GETFILEBLOCKLOCATIONS}}, with following error
{noformat}
org.apache.hadoop.ipc.RemoteException(java.lang.IllegalArgumentException): 
Unsupported Operation [GET_BLOCK_LOCATIONS]
at 
org.apache.hadoop.hdfs.web.JsonUtilClient.toRemoteException(JsonUtilClient.java:89)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem.validateResponse(WebHdfsFileSystem.java:509)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem.access$200(WebHdfsFileSystem.java:135)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.connect(WebHdfsFileSystem.java:745)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.runWithRetry(WebHdfsFileSystem.java:820)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.access$100(WebHdfsFileSystem.java:648)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner$1.run(WebHdfsFileSystem.java:686)
 at java.security.AccessController.doPrivileged(Native Method)
 at javax.security.auth.Subject.doAs(Subject.java:422)
 at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1876)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.run(WebHdfsFileSystem.java:682)
 at 
org.apache.hadoop.hdfs.web.WebHdfsFileSystem.getFileBlockLocations(WebHdfsFileSystem.java:1761)
 at 
org.apache.hadoop.fs.http.client.BaseTestHttpFSWith.testGetFileBlockLocations(BaseTestHttpFSWith.java:1663)
 at 
org.apache.hadoop.fs.http.client.BaseTestHttpFSWith.operation(BaseTestHttpFSWith.java:1207)
 at 
org.apache.hadoop.fs.http.client.BaseTestHttpFSWith.testOperation(BaseTestHttpFSWith.java:1235)
 at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 at 
org.apache.hadoop.test.TestHdfsHelper$HdfsStatement.evaluate(TestHdfsHelper.java:94)
 at org.apache.hadoop.test.TestDirHelper$1.evaluate(TestDirHelper.java:106)
 at 
org.apache.hadoop.test.TestExceptionHelper$1.evaluate(TestExceptionHelper.java:42)
 at org.apache.hadoop.test.TestJettyHelper$1.evaluate(TestJettyHelper.java:74)
 at org.apache.hadoop.test.TestDirHelper$1.evaluate(TestDirHelper.java:106)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
 at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
 at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
 at org.junit.runners.Suite.runChild(Suite.java:128)
 at org.junit.runners.Suite.runChild(Suite.java:27)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
 at org.junit.runners.Suite.runChild(Suite.java:128)
 at org.junit.runners.Suite.runChild(Suite.java:27)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
 at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
 at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
 at 
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
 at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
 at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
{noformat}
this was because this test case uses {{WebHdfsFileSystem}} to access 
{{HttpFSServer}}, in {{WebHdfsFileSystem#getFileBlockLocations}}
{code:java}
 @Override
  public BlockLocation[] getFileBlockLocations(...) {
    final HttpOpParam.Op op = GetOpParam.Op.GET_BLOCK_LOCATIONS; // this is old 
format
    return new FsPathResponseRunner<BlockLocation[]>(...) {
      @Override
      BlockLocation[] decodeResponse(Map<?,?> json) throws IOException {
        // it is expecting server to return LocatedBlocks, like what was done 
in NamenodeWebHdfsMethods
        return DFSUtilClient.locatedBlocks2Locations(
            JsonUtilClient.toLocatedBlocks(json));
      }
    }.run();
  }
{code}
when this request is submitted to {{HttpFSServer}}, it is denied because 
{{HttpFSServer}} doesn't support {{GET_BLOCK_LOCATIONS}}. You may argue we can 
let {{HttpFSServer}} to support query option {{GET_BLOCK_LOCATIONS}} too, but 
that will not be possible because {{HttpFSServer}} relies on standard 
FileSystem API, so it was not able to return {{LocatedBlocks}} like what is 
expected in {{WebHdfsFileSystem.}}

I tried another approach, by letting {{HttpFSServer}} support 
{{GET_BLOCK_LOCATIONS}}, but that ends up with doing a {{BlockLocation[] -> 
LocatedBlocks}} transforming, which is not possible because {{LocatedBlocks}} 
carries more information that {{BlockLocation}}. So can't find a better 
solution right now.

Please let me know your thought.
 Thanks

> Add GETFILEBLOCKLOCATIONS operation to HttpFS
> ---------------------------------------------
>
>                 Key: HDFS-6874
>                 URL: https://issues.apache.org/jira/browse/HDFS-6874
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: httpfs
>    Affects Versions: 2.4.1, 2.7.3
>            Reporter: Gao Zhong Liang
>            Assignee: Weiwei Yang
>            Priority: Major
>              Labels: BB2015-05-TBR
>         Attachments: HDFS-6874-1.patch, HDFS-6874-branch-2.6.0.patch, 
> HDFS-6874.02.patch, HDFS-6874.03.patch, HDFS-6874.04.patch, 
> HDFS-6874.05.patch, HDFS-6874.06.patch, HDFS-6874.07.patch, 
> HDFS-6874.08.patch, HDFS-6874.09.patch, HDFS-6874.10.patch, HDFS-6874.patch
>
>
> GETFILEBLOCKLOCATIONS operation is missing in HttpFS, which is already 
> supported in WebHDFS.  For the request of GETFILEBLOCKLOCATIONS in 
> org.apache.hadoop.fs.http.server.HttpFSServer, BAD_REQUEST is returned so far:
> .......
>  case GETFILEBLOCKLOCATIONS: {
>         response = Response.status(Response.Status.BAD_REQUEST).build();
>         break;
>       }
> ........ 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to