You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Guanghao Zhang (JIRA)" <ji...@apache.org> on 2016/11/21 09:01:16 UTC

[jira] [Updated] (HBASE-17140) Throw RegionOfflineException directly when request for a disabled table

     [ https://issues.apache.org/jira/browse/HBASE-17140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guanghao Zhang updated HBASE-17140:
-----------------------------------
    Description: 
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. Then throw the RegionOfflineException when get region location.

  was:
Now when request for a disabled table, it need 3 rpc call 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. Then throw the RegionOfflineException when get region location.


> Throw RegionOfflineException directly when request for a disabled table
> -----------------------------------------------------------------------
>
>                 Key: HBASE-17140
>                 URL: https://issues.apache.org/jira/browse/HBASE-17140
>             Project: HBase
>          Issue Type: Improvement
>          Components: Client
>            Reporter: Guanghao Zhang
>
> 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. Then throw the RegionOfflineException when get region location.



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