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

Mingliang Liu commented on HDFS-9387:
-------------------------------------

Thanks for your review [~xyao].

Yes the implementation to parse the {{namenode}} argument is different from 
parsing other parameters. When parsing {{-namenode}}, It calls the 
{{StringUtils.popOptionWithArgument}}. In that helper method, if there is no 
following argument, it will throw an IllegalArgumentException. The 
{{verifyOpArgument}} catches the exception and calls {{printUsage()}} to exit. 
I think it should work just fine?

> Parse namenodeUri parameter only once in 
> NNThroughputBenchmark$OperationStatsBase#verifyOpArgument()
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-9387
>                 URL: https://issues.apache.org/jira/browse/HDFS-9387
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>            Reporter: Mingliang Liu
>            Assignee: Mingliang Liu
>         Attachments: HDFS-9387.000.patch
>
>
> In {{NNThroughputBenchmark$OperationStatsBase#verifyOpArgument()}}, the   
> {{namenodeUri}} is always parsed from {{-namenode}} argument. This works just 
> fine if the {{-op}} parameter is not {{all}}, as the single benchmark will 
> need to parse the {{namenodeUri}} from args anyway.
> When the {{-op}} is {{all}}, namely all sub-benchmark will run, multiple 
> sub-benchmark will call the {{verifyOpArgument()}} method. In this case, the 
> first sub-benchmark reads the {{namenode}} argument and removes it from args. 
> The other sub-benchmarks will thereafter read {{null}} value since the 
> argument is removed. This contradicts the intension of providing {{namenode}} 
> for all sub-benchmarks.
> {code:title=current code}
>       try {
>         namenodeUri = StringUtils.popOptionWithArgument("-namenode", args);
>       } catch (IllegalArgumentException iae) {
>         printUsage();
>       }
> {code}
> The fix is to parse the {{namenodeUri}}, which is shared by all 
> sub-benchmarks, from {{-namenode}} argument only once. This follows the 
> convention of parsing other global arguments in 
> {{OperationStatsBase#verifyOpArgument()}}.
> {code:title=simple fix}
>       if (args.indexOf("-namenode") >= 0) {
>         try {
>           namenodeUri = StringUtils.popOptionWithArgument("-namenode", args);
>         } catch (IllegalArgumentException iae) {
>           printUsage();
>         }
>       }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to