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

Ayush Saxena commented on HDFS-13998:
-------------------------------------

Thanx [~zvenczel] for working on it and [~xiaochen] for the explanation.

Before HDFS-13732. The code was something like this:
{code:java}
 if (ecPolicyName == null){
          ecPolicyName = "default";
        }
        System.out.println("Set " + ecPolicyName + " erasure coding policy on" +
            " " + path);
{code}
And the intention there seems to be that In case when we doesn't specify the EC 
name explicitly , the case where Default policy is taken automatically.In that 
case we print the name of the actual policy rather than just printing "Default".
 To do so this entire block was replaced with an addl. RPC which got the policy 
name.

And in case of setPolicy -replicate it is returning null.Which is the concern 
over here.

But if instead of removing that if block completely and making an addl. rpc for 
all cases(We just don't know the name in case of Default only?) 
 we can just put this logic of getECPolicy(...) inside the If Block only 
something like this
{code:java}
 if (ecPolicyName == null){
          ecPolicyName =dfs.getErasureCodingPolicy(p).getName();
        }
 {code}
By this we can save the addl. RPC calls when we already know the name of the EC 
Policy and only in the case of Default we can get the name by this.

That way I guess setPolicy -replicate would also not get affected and we would 
be rid of the NPE too.Correct me if I missed something on this. :)

> ECAdmin NPE with -setPolicy -replicate
> --------------------------------------
>
>                 Key: HDFS-13998
>                 URL: https://issues.apache.org/jira/browse/HDFS-13998
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: erasure-coding
>    Affects Versions: 3.2.0, 3.1.2
>            Reporter: Xiao Chen
>            Assignee: Zsolt Venczel
>            Priority: Major
>         Attachments: HDFS-13998.01.patch
>
>
> HDFS-13732 tried to improve the output of the console tool. But we missed the 
> fact that for replication, {{getErasureCodingPolicy}} would return null.
> This jira is to fix it in ECAdmin, and add a unit test.



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