hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Solomon Duskis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-13327) Use Admin in ConnectionCache
Date Wed, 25 Mar 2015 16:30:55 GMT

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

Solomon Duskis commented on HBASE-13327:
----------------------------------------

So I have a question to the group at large.  I essentially copied the default behavior from
HBaseAdmin compact/majorCompact(byte[]) which is not replicated in the complementary methods
that take TableName as a parameter.  

Those methods in HBaseAdmin rely on IllegalArgumentException to differentiate between tableName
and region. 

{code}
  @Deprecated
  public void majorCompact(final byte[] tableNameOrRegionName, final byte[] columnFamily)
  throws IOException {
    try {
      compactRegion(tableNameOrRegionName, columnFamily, true);
    } catch (IllegalArgumentException e) {
      // Invalid region, try table
      compact(TableName.valueOf(tableNameOrRegionName), columnFamily, true);
    }
  }
{code}

That's a bit unpleasant in HBaseAdmin and quite a bit worse from the perspective of the thrift
server, since it relies on internal details.  I need a nested try in order to 

1) inner try - capture the HBaseAdmin logic to differentiate between region and table and

2) outer try - uniformly handle IOExceptions from either compactRegion or compact table

[~tedyu] suggested the following logic:

{code}
      try {
        if (TableName.isLegalTableQualifierName(tableNameOrRegionNameArray) {
          getAdmin().compact(TableName.valueOf(tableNameOrRegionNameArray));
        } else {
          getAdmin().compactRegion(tableNameOrRegionNameArray);
        }
       } catch (IOException e) {
         LOG.warn(e.getMessage(), e);
         throw new IOError(e.getMessage());
       } 
{code}

If that makes sense, I'll supply an addendum with that logic.

> Use Admin in ConnectionCache
> ----------------------------
>
>                 Key: HBASE-13327
>                 URL: https://issues.apache.org/jira/browse/HBASE-13327
>             Project: HBase
>          Issue Type: Sub-task
>    Affects Versions: 2.0.0, 1.0.1, 1.1.0
>            Reporter: Solomon Duskis
>            Assignee: Solomon Duskis
>             Fix For: 2.0.0, 1.0.1, 1.1.0
>
>         Attachments: HBASE-13327.patch
>
>
> Replace HBaseAdmin usage with Admin in ConnectionCache and users of ConnectionCache.



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

Mime
View raw message