You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Appy (JIRA)" <ji...@apache.org> on 2016/07/31 01:41:20 UTC

[jira] [Comment Edited] (HBASE-14345) Consolidate printUsage in IntegrationTestLoadAndVerify

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

Appy edited comment on HBASE-14345 at 7/31/16 1:40 AM:
-------------------------------------------------------

[~reidchan], Enis is right that we can't use System.exit here. The reason is as he mentioned
bq. We should not call System.exit() if it is not main() method. Tool instances can be invoked programmatically as well in which case you don't want to call exit.
Basically, what if a user writes own test using this test, exit will forcefully bring down his/her program. That's why, the right way in general is to thrown exceptions from functions which can be invoked programmatically by user, so that they can handle failure scenarios as they deem fit.
Since main() function is something invoked from command line and isn't supposed to be called from a user function, it's fine to use exits there.

In this case specifically, we can thrown runtime exception with appropriate message instead of arraybound exception. Similar to {{throw new RuntimeException("Incorrect Number of args.");}} in processOptions() function.



was (Author: appy):
[~reidchan], Enis is right that we can't use System.exit here. The reason is as he mentioned
bq. We should not call System.exit() if it is not main() method. Tool instances can be invoked programmatically as well in which case you don't want to call exit.
Basically, what if a user writes own test using this test, exit will forcefully bring down his/her program. That's why, the right way in general is to thrown exceptions which user can handle as they deem fit.
Since main() function is something invoked from command line and won't be used as a library function, it's fine to use exits there.

In this case specifically, we can thrown runtime exception with appropriate message instead of arraybound exception. Similar to {{throw new RuntimeException("Incorrect Number of args.");}} in processOptions() function.


> Consolidate printUsage in IntegrationTestLoadAndVerify
> ------------------------------------------------------
>
>                 Key: HBASE-14345
>                 URL: https://issues.apache.org/jira/browse/HBASE-14345
>             Project: HBase
>          Issue Type: Improvement
>          Components: integration tests
>            Reporter: Nick Dimiduk
>            Assignee: Reid Chan
>            Priority: Trivial
>              Labels: beginner
>         Attachments: 2016-07-30-Without System_exit.png, HBASE-14345.002.patch, HBASE-14345.patch, itlav-2016-07-07.png, itlv.png
>
>
> Investigating the use of {{itlav}} is a little screwy. Subclasses are not overriding the {{printUsage()}} methods correctly, so you have to pass {{--help}} to get some info and no arguments to get the rest.
> {noformat}
> [hbase@ndimiduk-112rc2-7 ~]$ hbase org.apache.hadoop.hbase.test.IntegrationTestLoadAndVerify --help
> usage: bin/hbase org.apache.hadoop.hbase.test.IntegrationTestLoadAndVerify <options>
> Options:
>  -h,--help                 Show usage
>  -m,--monkey <arg>         Which chaos monkey to run
>  -monkeyProps <arg>        The properties file for specifying chaos monkey properties.
>  -ncc,--noClusterCleanUp   Don't clean up the cluster at the end
> [hbase@ndimiduk-112rc2-7 ~]$ hbase org.apache.hadoop.hbase.test.IntegrationTestLoadAndVerify
> IntegrationTestLoadAndVerify [-Doptions] <load|verify|loadAndVerify>
>   Loads a table with row dependencies and verifies the dependency chains
> Options
>   -Dloadmapper.table=<name>        Table to write/verify (default autogen)
>   -Dloadmapper.backrefs=<n>        Number of backreferences per row (default 50)
>   -Dloadmapper.num_to_write=<n>    Number of rows per mapper (default 100,000 per mapper)
>   -Dloadmapper.deleteAfter=<bool>  Delete after a successful verify (default true)
>   -Dloadmapper.numPresplits=<n>    Number of presplit regions to start with (default 40)
>   -Dloadmapper.map.tasks=<n>       Number of map tasks for load (default 200)
>   -Dverify.reduce.tasks=<n>        Number of reduce tasks for verify (default 35)
>   -Dverify.scannercaching=<n>      Number hbase scanner caching rows to read (default 50)
> {noformat}



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