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

Enis Soztutar commented on HBASE-17140:
---------------------------------------

We have to be careful here table disabled and region offline are different 
concepts. In the current code, region offline can mean two things (depending on 
meta or AM context): 
(1) Region is not assigned yet. 
(2) Region is no more "assignable", meaning the region is split or merged. 

In the case of (2), the HRI for parent region is saved with split=true, 
offline=true (similar for merge). If we are marking every region to be offline 
in a disable table, we have to be careful of this double meaning. When the 
table is re-enabled again, we do not want to bring back the old parents. 

Can we instead do a multi-get to meta for getting the table state and the 
region location everytime? This way there will be a single RPC to the meta 
table returning both the result of table state and the region location. 

> Reduce meta request number by skipping table state check
> --------------------------------------------------------
>
>                 Key: HBASE-17140
>                 URL: https://issues.apache.org/jira/browse/HBASE-17140
>             Project: HBase
>          Issue Type: Improvement
>          Components: Client
>    Affects Versions: 2.0.0
>            Reporter: Guanghao Zhang
>            Assignee: Guanghao Zhang
>         Attachments: HBASE-17140-v1.patch, HBASE-17140-v2.patch, 
> HBASE-17140-v3.patch, HBASE-17140-v4.patch, HBASE-17140-v5.patch
>
>
> Now when request for a disabled table, it need 3 rpc calls before fail.
> 1. get region location
> 2. send call to rs and get NotServeRegionException
> 3. retry and check the table state, then throw TableNotEnabledException
> The table state check is added for disabled table. But now the prepare method 
> in RegionServerCallable shows that all retry request will get table state 
> first.
> {code}
> public void prepare(final boolean reload) throws IOException {
>     // check table state if this is a retry
>     if (reload && !tableName.equals(TableName.META_TABLE_NAME) &&
>         getConnection().isTableDisabled(tableName)) {
>       throw new TableNotEnabledException(tableName.getNameAsString() + " is 
> disabled.");
>     }
>     try (RegionLocator regionLocator = 
> connection.getRegionLocator(tableName)) {
>       this.location = regionLocator.getRegionLocation(row);
>     }
>     if (this.location == null) {
>       throw new IOException("Failed to find location, tableName=" + tableName 
> +
>           ", row=" + Bytes.toString(row) + ", reload=" + reload);
>     }
>     setStubByServiceName(this.location.getServerName());
> }
> {code}
> An improvement is set the region offline in HRegionInfo and throw the 
> RegionOfflineException when get region location. Then we don't need check 
> table state for any retry request.
> Review board: https://reviews.apache.org/r/54071/



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

Reply via email to