[
https://issues.apache.org/jira/browse/HBASE-17140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15702781#comment-15702781
]
Matteo Bertozzi commented on HBASE-17140:
-----------------------------------------
can you expand more on why we should do this optimization? do you have a use
specific case? my guess is that disabling a table is rare enough and extra
round trips are not that bad...
then if we are going with this patch, why do we even need to store the
enabled/disabled table state? if we know that all the regions are offline we
know that the table is disabled. and the master can simply compute the state
when rebuilding meta on startup. so there is really no need to have that flag
stored.
also i'm not sure if we have enough coverage to cover the behavior of setting
the offline state for disable. at the moment we only use the offline flag for
split/merge. and the regions may be back if we rollback. so maybe this is not a
trivial change. our code has lots of assumptions and changing things from
TableNotEnabledException to RegionOfflineException feels scary to me.
> 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
> 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. Then throw the
> RegionOfflineException when get region location.
> Review board: https://reviews.apache.org/r/54071/
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)