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

Erik Krogen commented on HDFS-15032:
------------------------------------

Hey [~shv], that's a great question. In many cases, only a reference to the 
proxy is kept, so it is the direct {{toString}} method of the proxy that you 
see. For example, this is what a debugger stopped in 
{{ObserverReadProxyProvider}} looks like without this change:
 !debugger_without_tostring.png! 
You can see that the proxy (which is really a combined proxy) is reporting that 
it is a {{NameNodeProtocolTranslatorPB}}, because it is the {{toString()}} 
method of the first proxy which is being used. This was misleading to me when I 
was trying to investigate this issue, as it led me to believe a plain 
{{NameNodeProtocol}} was showing up where I expected a {{BalancerProtocol}}. 
However with the change, it is more obvious what is going on:
 !debugger_with_tostring.png! 

I see your concern about the performance, however. I've added a v003 patch 
which replaces to string comparison with a call to {{Method.equals()}}, which I 
confirmed internally only does a few reference equality checks:
{code}
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof Method) {
            Method other = (Method)obj;
            if ((getDeclaringClass() == other.getDeclaringClass())
                && (getName() == other.getName())) {
                if (!returnType.equals(other.getReturnType()))
                    return false;
                return equalParamTypes(parameterTypes, other.parameterTypes);
            }
        }
        return false;
    }
{code}
Let me know if that addresses your concerns. If you think it's too risky for 
performance, I'm fine with removing it.

> Balancer crashes when it fails to contact an unavailable NN via 
> ObserverReadProxyProvider
> -----------------------------------------------------------------------------------------
>
>                 Key: HDFS-15032
>                 URL: https://issues.apache.org/jira/browse/HDFS-15032
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: balancer & mover
>    Affects Versions: 2.10.0
>            Reporter: Erik Krogen
>            Assignee: Erik Krogen
>            Priority: Major
>         Attachments: HDFS-15032.000.patch, HDFS-15032.001.patch, 
> HDFS-15032.002.patch, HDFS-15032.003.patch, debugger_with_tostring.png, 
> debugger_without_tostring.png
>
>
> When trying to run the Balancer using ObserverReadProxyProvider (to allow it 
> to read from the Observer Node as described in HDFS-14979), if one of the NNs 
> isn't running, the Balancer will crash.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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