You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Konstantin Shvachko (JIRA)" <ji...@apache.org> on 2012/07/05 02:48:34 UTC

[jira] [Created] (HADOOP-8558) Hadoop RPC does not allow protocol extension with common interfaces.

Konstantin Shvachko created HADOOP-8558:
-------------------------------------------

             Summary: Hadoop RPC does not allow protocol extension with common interfaces.
                 Key: HADOOP-8558
                 URL: https://issues.apache.org/jira/browse/HADOOP-8558
             Project: Hadoop Common
          Issue Type: Bug
    Affects Versions: 2.0.0-alpha
            Reporter: Konstantin Shvachko


Hadoop RPC fails if MyProtocol extends an interface, which is not a VersionedProtocol even if MyProtocol extends also VersionedProtocol. The reason is that Invocation uses Method.getDeclaringClass(), which returns the interface class rather than the class of MyProtocol.
This is incompatible with former versions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (HADOOP-8558) Hadoop RPC does not allow protocol extension with common interfaces.

Posted by "Konstantin Shvachko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Konstantin Shvachko resolved HADOOP-8558.
-----------------------------------------

       Resolution: Not A Problem
    Fix Version/s: 3.0.0
         Assignee: Konstantin Shvachko

Resolving as not a problem.
                
> Hadoop RPC does not allow protocol extension with common interfaces.
> --------------------------------------------------------------------
>
>                 Key: HADOOP-8558
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8558
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.0.0-alpha
>            Reporter: Konstantin Shvachko
>            Assignee: Konstantin Shvachko
>             Fix For: 3.0.0
>
>         Attachments: TestProtocolExtension.java, TestProtocolExtension.java
>
>
> Hadoop RPC fails if MyProtocol extends an interface, which is not a VersionedProtocol even if MyProtocol extends also VersionedProtocol. The reason is that Invocation uses Method.getDeclaringClass(), which returns the interface class rather than the class of MyProtocol.
> This is incompatible with former versions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HADOOP-8558) Hadoop RPC does not allow protocol extension with common interfaces.

Posted by "Konstantin Shvachko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Konstantin Shvachko updated HADOOP-8558:
----------------------------------------

    Attachment: TestProtocolExtension.java

Attaching version of the test that passes under current trunk.
                
> Hadoop RPC does not allow protocol extension with common interfaces.
> --------------------------------------------------------------------
>
>                 Key: HADOOP-8558
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8558
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.0.0-alpha
>            Reporter: Konstantin Shvachko
>         Attachments: TestProtocolExtension.java, TestProtocolExtension.java
>
>
> Hadoop RPC fails if MyProtocol extends an interface, which is not a VersionedProtocol even if MyProtocol extends also VersionedProtocol. The reason is that Invocation uses Method.getDeclaringClass(), which returns the interface class rather than the class of MyProtocol.
> This is incompatible with former versions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HADOOP-8558) Hadoop RPC does not allow protocol extension with common interfaces.

Posted by "Konstantin Shvachko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-8558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434323#comment-13434323 ] 

Konstantin Shvachko commented on HADOOP-8558:
---------------------------------------------

Turns out that the version can be specified in annotation now. In my example above if I add {{ProtocolInfo}} annotation specifying the version like this
{code}
@ProtocolInfo(
    protocolName = "org.apache.hadoop.ipc.TestProtocolExtension$TestProtocol", 
    protocolVersion = TestProtocol.versionID)
public interface ProtocolExtention {
  void logClassName();
}
{code}
the test will pass. {{ProtocolInfo}} was introduced by HADOOP-7524.
                
> Hadoop RPC does not allow protocol extension with common interfaces.
> --------------------------------------------------------------------
>
>                 Key: HADOOP-8558
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8558
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.0.0-alpha
>            Reporter: Konstantin Shvachko
>         Attachments: TestProtocolExtension.java
>
>
> Hadoop RPC fails if MyProtocol extends an interface, which is not a VersionedProtocol even if MyProtocol extends also VersionedProtocol. The reason is that Invocation uses Method.getDeclaringClass(), which returns the interface class rather than the class of MyProtocol.
> This is incompatible with former versions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HADOOP-8558) Hadoop RPC does not allow protocol extension with common interfaces.

Posted by "Konstantin Shvachko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Konstantin Shvachko updated HADOOP-8558:
----------------------------------------

    Attachment: TestProtocolExtension.java

Here is an example of what I mean.
{{TestProtocol}} extends {{VersionedProtocol}} and {{ProtocolExtension}}. The latter is not versioned, and rpc fails with 
{code}
Tests in error:
testCalls(org.apache.hadoop.ipc.TestProtocolExtension): java.lang.NoSuchFieldException: versionID
{code}

I think there is no reason for this behavior, because {{TestProtocol}} is perfectly versioned.
The solution is to overload in {{TestProtocol}} the method declared in {{ProtocolExtension}}. (Uncomment the lines in the test to make it pass.) This is inconvenient if {{ProtocolExtension}} has a lot of methods.

This basically prevents from using other existing interfaces to define new protocols.
And this is incompatible with previous versions of hadoop, as the same test runs fine with e.g. 0.22.

Solution is simple enough - need get rid of getDeclaringClass() by passing the actual protocol into Invocation constructor. I would like to here if this is done intentionally and has some meaning I don't understand.
                
> Hadoop RPC does not allow protocol extension with common interfaces.
> --------------------------------------------------------------------
>
>                 Key: HADOOP-8558
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8558
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.0.0-alpha
>            Reporter: Konstantin Shvachko
>         Attachments: TestProtocolExtension.java
>
>
> Hadoop RPC fails if MyProtocol extends an interface, which is not a VersionedProtocol even if MyProtocol extends also VersionedProtocol. The reason is that Invocation uses Method.getDeclaringClass(), which returns the interface class rather than the class of MyProtocol.
> This is incompatible with former versions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira