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

Ayush Saxena edited comment on HDFS-14156 at 12/19/18 8:52 AM:
---------------------------------------------------------------

Thanx [~shubham.dewan] for taking this up.

Checked the root cause for the same ::
{code:java}
return Collections.singletonMap(location, clazz.cast(result));
{code}
Here the clazz.cast() is actually not supporting AutoBoxing.

if we Replace it with something Like ::
{code:java}
  return Collections.singletonMap(location, (R) result);
{code}
The primitive to Wrapper and reverse both shall be supported and we won't be 
facing this issue as I find couple of other places too using this same approach 
of using primitive type as expected and may be some where else too.

For reference it has been handled in this way only at invokeSequential() and 
invokeSingle()

At invokeSequential()
{code:java}
  T ret = (T)firstResult;
{code}
 
 And at invokeSingle()
{code:java}
  T ret = (T)invokeSingle(nsId, method);
{code}
Not sure but I guess reason for specifying primitive there might be since the 
namenode returns the same.

Just an ALT.If doesn't suits can handle changing all primitives to Wrappers and 
even leave a comment up on the above classes too regarding the approach to 
avoid confusions for people handling it in future as mostly people might expect 
or check from the namenode side only. :)


was (Author: ayushtkn):
Thanx [~shubham.dewan] for taking this up.

Checked the root cause for the same ::
{code:java}
return Collections.singletonMap(location, clazz.cast(result));
{code}

Here the clazz.cast() is actually not supporting AutoBoxing.

if we Replace it with something Like ::

{code:java}
  return Collections.singletonMap(location, (R) result);
{code}

The primitive to Wrapper and reverse both shall be supported and we won't be 
facing this issue as I find couple of other places too using this same approach 
of using primitive type as expected and may be some where else too.

Not sure but I guess reason for specifying primitive there might be since the 
namenode returns the same.

Just an ALT.If doesn't suits can handle changing all primitives to Wrappers and 
even leave a comment up on the above classes too regarding the approach to 
avoid confusions for people handling it in future as mostly people might expect 
or check from the namenode side only. :)

> RBF : RollEdit command fail with router
> ---------------------------------------
>
>                 Key: HDFS-14156
>                 URL: https://issues.apache.org/jira/browse/HDFS-14156
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>            Reporter: Harshakiran Reddy
>            Assignee: Shubham Dewan
>            Priority: Major
>              Labels: RBF
>         Attachments: HDFS-14156.001.patch
>
>
> {noformat}
> bin> ./hdfs dfsadmin -rollEdits
> rollEdits: Cannot cast java.lang.Long to long
> bin>
> {noformat}
> Trace :-
> {noformat}
> org.apache.hadoop.ipc.RemoteException(java.lang.ClassCastException): Cannot 
> cast java.lang.Long to long
>         at java.lang.Class.cast(Class.java:3369)
>         at 
> org.apache.hadoop.hdfs.server.federation.router.RouterRpcClient.invokeConcurrent(RouterRpcClient.java:1085)
>         at 
> org.apache.hadoop.hdfs.server.federation.router.RouterRpcClient.invokeConcurrent(RouterRpcClient.java:982)
>         at 
> org.apache.hadoop.hdfs.server.federation.router.RouterClientProtocol.rollEdits(RouterClientProtocol.java:900)
>         at 
> org.apache.hadoop.hdfs.server.federation.router.RouterRpcServer.rollEdits(RouterRpcServer.java:862)
>         at 
> org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.rollEdits(ClientNamenodeProtocolServerSideTranslatorPB.java:899)
>         at 
> org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
>         at 
> org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:524)
>         at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:991)
>         at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:878)
>         at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:824)
>         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:1729)
>         at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2684)
>         at org.apache.hadoop.ipc.Client.getRpcResponse(Client.java:1520)
>         at org.apache.hadoop.ipc.Client.call(Client.java:1466)
>         at org.apache.hadoop.ipc.Client.call(Client.java:1376)
>         at 
> org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
>         at 
> org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:116)
>         at com.sun.proxy.$Proxy11.rollEdits(Unknown Source)
>         at 
> org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.rollEdits(ClientNamenodeProtocolTranslatorPB.java:804)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at 
> org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:422)
>         at 
> org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeMethod(RetryInvocationHandler.java:165)
>         at 
> org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invoke(RetryInvocationHandler.java:157)
>         at 
> org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeOnce(RetryInvocationHandler.java:95)
>         at 
> org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:359)
>         at com.sun.proxy.$Proxy12.rollEdits(Unknown Source)
>         at org.apache.hadoop.hdfs.DFSClient.rollEdits(DFSClient.java:2350)
>         at 
> org.apache.hadoop.hdfs.DistributedFileSystem.rollEdits(DistributedFileSystem.java:1550)
>         at org.apache.hadoop.hdfs.tools.DFSAdmin.rollEdits(DFSAdmin.java:850)
>         at org.apache.hadoop.hdfs.tools.DFSAdmin.run(DFSAdmin.java:2353)
>         at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
>         at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:90)
>         at org.apache.hadoop.hdfs.tools.DFSAdmin.main(DFSAdmin.java:2568)
> {noformat}



--
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