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

Nihal Jain commented on HBASE-21636:
------------------------------------

{quote} 
{code:java}
replica_id = args[REGION_REPLICA_ID]
isolation_level = args[ISOLATION_LEVEL]
read_type = args[READ_TYPE]
{code}
 Dumb question: how do these fields get the default values?
{quote}
The following lines ensure that we set the corresponding fields for {{scan}} 
object only if the corresponding argument was passed by user. 
{code:java}
563             scan.setReplicaId(replica_id) if replica_id
564             
scan.setIsolationLevel(org.apache.hadoop.hbase.client.IsolationLevel.valueOf(isolation_level))
 if isolation_level
565             
scan.setReadType(org.apache.hadoop.hbase.client::Scan::ReadType.valueOf(read_type))
 if read_type
{code}
For example: {{replica_id = args[REGION_REPLICA_ID]}} would initialize 
{{replica_id}} to some {{non-nil}} value if user passes it in {{args}}, 
otherwise it is initialized as {{nil}}.
 Next, the body of statement: {{scan.setReplicaId(replica_id) if replica_id}}, 
would execute if the condition: {{if replica_id}} evaluates to {{true}}.

In case {{replica_id}} is {{nil}}, we won't even execute 
{{scan.setReplicaId(replica_id).}} So, we don't need to initialize to default 
values, as we won't even make the scan.setX() call.

I hope this makes sense.

[Sorry for delayed reply, was away from my laptop]

> Enhance the shell scan command to support missing scanner specifications like 
> ReadType, IsolationLevel etc.
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-21636
>                 URL: https://issues.apache.org/jira/browse/HBASE-21636
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>    Affects Versions: 3.0.0, 2.0.0, 2.1.2
>            Reporter: Nihal Jain
>            Assignee: Nihal Jain
>            Priority: Major
>         Attachments: HBASE-21636.master.001.patch, 
> HBASE-21636.master.002.patch
>
>
> Enhance the shell scan command to support scanner specifications:
>  - ReadType
>  - IsolationLevel
>  - Region replica id
>  - Allow partial results
>  - Batch
>  - Max result size
> Also, make use of \{{limit}} and set it in the scan object to limit the 
> number of rows returned by the scanner.
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to